|
|
@@ -27,7 +27,31 @@
|
|
|
<q-scroll-area class="dialog-form-scroll">
|
|
|
<q-card-section class="q-pt-sm">
|
|
|
<div v-show="activeTab === 'dados'">
|
|
|
- <div class="text-subtitle1 q-mb-md">Dados do Aluno</div>
|
|
|
+ <div class="text-subtitle1 q-mb-md">Dados da Unidade</div>
|
|
|
+
|
|
|
+ <div class="row q-col-gutter-sm">
|
|
|
+ <DefaultInput
|
|
|
+ :model-value="unitDetails.name"
|
|
|
+ :error="!!validationErrors.unit_id"
|
|
|
+ :error-message="validationErrors.unit_id"
|
|
|
+ label="Nome da Unidade"
|
|
|
+ class="col-12 col-md-6"
|
|
|
+ readonly
|
|
|
+ />
|
|
|
+
|
|
|
+ <DefaultInput
|
|
|
+ :model-value="unitDetails.cnpj"
|
|
|
+ :error="!!validationErrors.unit_id"
|
|
|
+ :error-message="validationErrors.unit_id"
|
|
|
+ label="CNPJ"
|
|
|
+ class="col-12 col-md-6"
|
|
|
+ readonly
|
|
|
+ :mask="masks.Brasil.cnpj"
|
|
|
+ :rules="[inputRules.cnpj]"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="text-subtitle1 q-mt-lg q-mb-md">Dados do Aluno</div>
|
|
|
|
|
|
<div class="row q-col-gutter-sm">
|
|
|
<div v-if="props.selectStudent" class="col-12">
|
|
|
@@ -90,6 +114,7 @@
|
|
|
:error-message="validationErrors.document_number"
|
|
|
label="CPF / CNH"
|
|
|
disable
|
|
|
+ :mask="masks.Brasil.cpf"
|
|
|
/>
|
|
|
</div>
|
|
|
|
|
|
@@ -466,7 +491,9 @@ import DefaultInputDatePicker from "src/components/defaults/DefaultInputDatePick
|
|
|
import AddEditStudentDialog from "src/pages/students/components/AddEditStudentDialog.vue";
|
|
|
import { useSubmitHandler } from "src/composables/useSubmitHandler";
|
|
|
import { useFormUpdateTracker } from "src/composables/useFormUpdateTracker";
|
|
|
+import { useInputRules } from "src/composables/useInputRules";
|
|
|
import { formatDateYMDtoDMY, formatDateDMYtoYMD } from "src/helpers/utils";
|
|
|
+import masks from "src/helpers/masks";
|
|
|
import { getUnitPackagesForSelect } from "src/api/package";
|
|
|
import { getFinancialMe } from "src/api/unit_financial";
|
|
|
import { permissionStore } from "src/stores/permission";
|
|
|
@@ -476,6 +503,8 @@ import {
|
|
|
} from "src/api/studentContract";
|
|
|
import { getContractMedias, deleteContractMedia } from "src/api/student_media";
|
|
|
import { getStudentsForSelect } from "src/api/student";
|
|
|
+import { getUnitMe } from "src/api/unit";
|
|
|
+import { userStore } from "src/stores/user";
|
|
|
|
|
|
const props = defineProps({
|
|
|
student: {
|
|
|
@@ -498,6 +527,8 @@ const { dialogRef, onDialogHide, onDialogOK, onDialogCancel } =
|
|
|
useDialogPluginComponent();
|
|
|
|
|
|
const $q = useQuasar();
|
|
|
+const { inputRules } = useInputRules();
|
|
|
+const store = userStore();
|
|
|
const permissions = permissionStore();
|
|
|
const canViewFinancial = computed(() =>
|
|
|
permissions.getAccess("franchisee_financial", "view"),
|
|
|
@@ -727,6 +758,7 @@ const weekdays = [
|
|
|
];
|
|
|
|
|
|
const packages = ref([]);
|
|
|
+const unitDetails = ref(store.selectedUnit ?? {});
|
|
|
|
|
|
const mediaColumns = [
|
|
|
{ name: "created_at", label: "Data de Anexo", field: "created_at", align: "left" },
|
|
|
@@ -748,11 +780,16 @@ watch(activeTab, (tab) => {
|
|
|
});
|
|
|
|
|
|
onMounted(async () => {
|
|
|
- const requests = [getUnitPackagesForSelect()];
|
|
|
+ const unitRequest = getUnitMe().catch((error) => {
|
|
|
+ console.error("Falha ao carregar os dados da unidade:", error);
|
|
|
+ return store.selectedUnit;
|
|
|
+ });
|
|
|
+ const requests = [getUnitPackagesForSelect(), unitRequest];
|
|
|
if (props.selectStudent) requests.push(getStudentsForSelect());
|
|
|
|
|
|
- const [unitPackages, unitStudents = []] = await Promise.all(requests);
|
|
|
+ const [unitPackages, unitData, unitStudents = []] = await Promise.all(requests);
|
|
|
packages.value = unitPackages;
|
|
|
+ unitDetails.value = unitData ?? store.selectedUnit ?? {};
|
|
|
students.value = unitStudents;
|
|
|
filteredStudents.value = unitStudents;
|
|
|
|