Bläddra i källkod

feat: adiciona dia recorrente

ebagabee 1 månad sedan
förälder
incheckning
d49ee40c99

+ 59 - 53
src/pages/students/components/CreateContractDialog.vue

@@ -2,9 +2,12 @@
   <q-dialog ref="dialogRef" @hide="onDialogHide">
     <q-card
       class="q-dialog-plugin overflow-hidden"
-      style="width: 100%; max-width: 1100px"
+      style="width: 100%; max-width: 1350px"
     >
-      <DefaultDialogHeader :title="props.contract ? 'Editar Contrato' : 'Novo Contrato'" @close="onDialogCancel" />
+      <DefaultDialogHeader
+        :title="props.contract ? 'Editar Contrato' : 'Novo Contrato'"
+        @close="onDialogCancel"
+      />
 
       <q-card-section class="q-pt-sm" style="height: 65vh; overflow-y: auto">
         <div class="text-subtitle1 q-mb-md">Dados do Aluno</div>
@@ -154,9 +157,10 @@
 
         <div class="row q-col-gutter-sm">
           <div class="col-4">
-            <DefaultInputDatePicker
-              v-model="form.due_date"
-              label="Vencimento"
+            <DefaultInput
+              v-model="form.due_day"
+              label="Dia de Vencimento"
+              type="number"
             />
           </div>
 
@@ -178,10 +182,7 @@
           </div>
 
           <div class="col-3">
-            <DefaultCurrencyInput
-              v-model="form.down_payment"
-              label="Entrada"
-            />
+            <DefaultCurrencyInput v-model="form.down_payment" label="Entrada" />
           </div>
 
           <div class="col-3">
@@ -285,7 +286,10 @@ import { useSubmitHandler } from "src/composables/useSubmitHandler";
 import { useFormUpdateTracker } from "src/composables/useFormUpdateTracker";
 import { formatDateYMDtoDMY, formatDateDMYtoYMD } from "src/helpers/utils";
 import { getUnitPackages } from "src/api/package";
-import { createStudentContract, updateStudentContract } from "src/api/studentContract";
+import {
+  createStudentContract,
+  updateStudentContract,
+} from "src/api/studentContract";
 
 const props = defineProps({
   student: {
@@ -306,28 +310,28 @@ const { dialogRef, onDialogHide, onDialogOK, onDialogCancel } =
 const trimTime = (t) => (t ? t.slice(0, 5) : null);
 
 const { form } = useFormUpdateTracker({
-  protocol:               props.contract?.protocol ?? null,
-  signature_date:         props.contract?.signature_date ?? null,
-  end_date:               props.contract?.end_date ?? null,
-  package_id:             props.contract?.class_package_unit_id ?? null,
-  class_quantity:         props.contract?.class_quantity ?? null,
-  weekday:                props.contract?.weekday ?? null,
-  start_time:             trimTime(props.contract?.start_time),
-  end_time:               trimTime(props.contract?.end_time),
-  second_weekday:         props.contract?.second_weekday ?? null,
-  second_start_time:      trimTime(props.contract?.second_start_time),
-  second_end_time:        trimTime(props.contract?.second_end_time),
-  due_date:               props.contract?.due_date ?? null,
-  enrollment_fee:         props.contract?.tax_register ?? null,
-  total_classes:          props.contract?.class_quantity ?? null,
-  down_payment:           props.contract?.down_payment ?? null,
-  installments:           props.contract?.installments ?? null,
+  protocol: props.contract?.protocol ?? null,
+  signature_date: props.contract?.signature_date ?? null,
+  end_date: props.contract?.end_date ?? null,
+  package_id: props.contract?.class_package_unit_id ?? null,
+  class_quantity: props.contract?.class_quantity ?? null,
+  weekday: props.contract?.weekday ?? null,
+  start_time: trimTime(props.contract?.start_time),
+  end_time: trimTime(props.contract?.end_time),
+  second_weekday: props.contract?.second_weekday ?? null,
+  second_start_time: trimTime(props.contract?.second_start_time),
+  second_end_time: trimTime(props.contract?.second_end_time),
+  due_day: props.contract?.recurring_day ?? null,
+  enrollment_fee: props.contract?.tax_register ?? null,
+  total_classes: props.contract?.class_quantity ?? null,
+  down_payment: props.contract?.down_payment ?? null,
+  installments: props.contract?.installments ?? null,
   early_payment_discount: props.contract?.early_payment_discount ?? null,
-  material_value:         props.contract?.material_value ?? null,
-  material_installments:  props.contract?.material_installments ?? null,
-  interest_rate:          props.contract?.interest_rate ?? null,
-  payment_method:         props.contract?.payment_method ?? null,
-  late_fee:               props.contract?.fine_cancelled ?? null,
+  material_value: props.contract?.material_value ?? null,
+  material_installments: props.contract?.material_installments ?? null,
+  interest_rate: props.contract?.interest_rate ?? null,
+  payment_method: props.contract?.payment_method ?? null,
+  late_fee: props.contract?.fine_cancelled ?? null,
 });
 
 const installmentOptions = Array.from({ length: 12 }, (_, i) => ({
@@ -378,28 +382,30 @@ const { loading: saving, execute } = useSubmitHandler({
 
 function buildPayload() {
   return {
-    student_id:              props.student.id,
-    protocol:                form.protocol,
-    signature_date:          form.signature_date ? formatDateDMYtoYMD(form.signature_date) : null,
-    end_date:                form.end_date ? formatDateDMYtoYMD(form.end_date) : null,
-    class_package_unit_id:   form.package_id,
-    class_quantity:          form.class_quantity,
-    weekday:                 form.weekday,
-    start_time:              form.start_time,
-    end_time:                form.end_time,
-    second_weekday:          form.second_weekday,
-    second_start_time:       form.second_start_time,
-    second_end_time:         form.second_end_time,
-    due_date:                form.due_date ? formatDateDMYtoYMD(form.due_date) : null,
-    tax_register:            form.enrollment_fee,
-    down_payment:            form.down_payment ?? 0,
-    installments:            form.installments,
-    early_payment_discount:  form.early_payment_discount,
-    material_value:          form.material_value,
-    material_installments:   form.material_installments,
-    interest_rate:           form.interest_rate,
-    payment_method:          form.payment_method,
-    fine_cancelled:          form.late_fee,
+    student_id: props.student.id,
+    protocol: form.protocol,
+    signature_date: form.signature_date
+      ? formatDateDMYtoYMD(form.signature_date)
+      : null,
+    end_date: form.end_date ? formatDateDMYtoYMD(form.end_date) : null,
+    class_package_unit_id: form.package_id,
+    class_quantity: form.class_quantity,
+    weekday: form.weekday,
+    start_time: form.start_time,
+    end_time: form.end_time,
+    second_weekday: form.second_weekday,
+    second_start_time: form.second_start_time,
+    second_end_time: form.second_end_time,
+    due_day: form.due_day ? parseInt(form.due_day) : null,
+    tax_register: form.enrollment_fee,
+    down_payment: form.down_payment ?? 0,
+    installments: form.installments,
+    early_payment_discount: form.early_payment_discount,
+    material_value: form.material_value,
+    material_installments: form.material_installments,
+    interest_rate: form.interest_rate,
+    payment_method: form.payment_method,
+    fine_cancelled: form.late_fee,
   };
 }
 

+ 1 - 1
src/pages/students/components/EditStudentDialog.vue

@@ -2,7 +2,7 @@
   <q-dialog ref="dialogRef" @hide="onDialogHide">
     <q-card
       class="q-dialog-plugin overflow-hidden"
-      style="width: 100%; max-width: 1100px"
+      style="width: 100%; max-width: 1400px"
     >
       <DefaultDialogHeader title="Dados do Aluno" @close="onDialogCancel" />
 

+ 1 - 1
src/pages/students/tabs/ContractTab.vue

@@ -33,7 +33,7 @@
       </template>
 
       <template #body-cell-actions="{ row }">
-        <q-td auto-width>
+        <q-td align="center">
           <q-item-section class="no-wrap" style="flex-direction: row; gap: 4px">
             <q-btn
               outline