|
|
@@ -30,18 +30,34 @@
|
|
|
|
|
|
<div class="row q-col-gutter-sm">
|
|
|
<div v-if="props.selectStudent" class="col-12">
|
|
|
- <DefaultSelect
|
|
|
- v-model="selectedStudent"
|
|
|
- label="Aluno"
|
|
|
- :options="filteredStudents"
|
|
|
- option-label="name"
|
|
|
- use-input
|
|
|
- fill-input
|
|
|
- hide-selected
|
|
|
- input-debounce="0"
|
|
|
- dropdown-icon="mdi-magnify"
|
|
|
- @filter="filterStudents"
|
|
|
- />
|
|
|
+ <div class="row items-start no-wrap q-col-gutter-sm">
|
|
|
+ <DefaultSelect
|
|
|
+ v-model="selectedStudent"
|
|
|
+ label="Aluno"
|
|
|
+ class="col"
|
|
|
+ :options="filteredStudents"
|
|
|
+ option-label="name"
|
|
|
+ use-input
|
|
|
+ fill-input
|
|
|
+ hide-selected
|
|
|
+ input-debounce="0"
|
|
|
+ dropdown-icon="mdi-magnify"
|
|
|
+ @filter="filterStudents"
|
|
|
+ />
|
|
|
+ <div v-if="canAddStudents" class="col-auto">
|
|
|
+ <q-btn
|
|
|
+ round
|
|
|
+ unelevated
|
|
|
+ color="primary"
|
|
|
+ icon="mdi-plus"
|
|
|
+ aria-label="Cadastrar novo aluno"
|
|
|
+ style="margin-top: 8px"
|
|
|
+ @click="openCreateStudent"
|
|
|
+ >
|
|
|
+ <q-tooltip>Cadastrar novo aluno</q-tooltip>
|
|
|
+ </q-btn>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
|
|
|
<div v-if="!props.selectStudent" class="col-12">
|
|
|
@@ -384,6 +400,7 @@ import DefaultSelect from "src/components/defaults/DefaultSelect.vue";
|
|
|
import DefaultTable from "src/components/defaults/DefaultTable.vue";
|
|
|
import DefaultCurrencyInput from "src/components/defaults/DefaultCurrencyInput.vue";
|
|
|
import DefaultInputDatePicker from "src/components/defaults/DefaultInputDatePicker.vue";
|
|
|
+import AddEditStudentDialog from "src/pages/students/components/AddEditStudentDialog.vue";
|
|
|
import { useSubmitHandler } from "src/composables/useSubmitHandler";
|
|
|
import { useFormUpdateTracker } from "src/composables/useFormUpdateTracker";
|
|
|
import { formatDateYMDtoDMY, formatDateDMYtoYMD } from "src/helpers/utils";
|
|
|
@@ -422,6 +439,9 @@ const permissions = permissionStore();
|
|
|
const canViewFinancial = computed(() =>
|
|
|
permissions.getAccess("franchisee_financial", "view"),
|
|
|
);
|
|
|
+const canAddStudents = computed(() =>
|
|
|
+ permissions.getAccess("franchisee_students", "add"),
|
|
|
+);
|
|
|
const activeTab = ref("dados");
|
|
|
const medias = ref([]);
|
|
|
const loadingMedias = ref(false);
|
|
|
@@ -447,6 +467,19 @@ function filterStudents(value, update) {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+function openCreateStudent() {
|
|
|
+ $q.dialog({
|
|
|
+ component: AddEditStudentDialog,
|
|
|
+ }).onOk(async (createdStudent) => {
|
|
|
+ const unitStudents = await getStudentsForSelect();
|
|
|
+ students.value = unitStudents;
|
|
|
+ filteredStudents.value = unitStudents;
|
|
|
+ selectedStudent.value =
|
|
|
+ unitStudents.find((student) => student.id === createdStudent?.id) ??
|
|
|
+ createdStudent;
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
const trimTime = (t) => (t ? t.slice(0, 5) : null);
|
|
|
|
|
|
function calculateEndTime(startTime, durationMinutes = 120) {
|