|
|
@@ -311,153 +311,6 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
- <div class="text-subtitle2 q-mt-md q-mb-sm text-grey-8">
|
|
|
- Matrícula
|
|
|
- </div>
|
|
|
-
|
|
|
- <div class="row q-col-gutter-sm">
|
|
|
- <div :class="registrationIncluded ? 'col-12' : 'col-3'">
|
|
|
- <DefaultCurrencyInput
|
|
|
- v-model="form.enrollment_fee"
|
|
|
- v-model:error="validationErrors.tax_register"
|
|
|
- label="Valor da Matrícula"
|
|
|
- :disable="registrationIncluded || !props.contract"
|
|
|
- />
|
|
|
- </div>
|
|
|
-
|
|
|
- <template v-if="!registrationIncluded">
|
|
|
- <div class="col-3">
|
|
|
- <DefaultSelect
|
|
|
- v-model="form.installments"
|
|
|
- v-model:error="validationErrors.installments"
|
|
|
- emit-value
|
|
|
- label="Qtde Parcelas"
|
|
|
- map-options
|
|
|
- option-label="label"
|
|
|
- option-value="value"
|
|
|
- :options="enrollmentInstallmentOptions"
|
|
|
- :rules="[inputRules.integerRange(1, 12)]"
|
|
|
- />
|
|
|
- </div>
|
|
|
-
|
|
|
- <div class="col-3">
|
|
|
- <DefaultCurrencyInput
|
|
|
- v-model:error="validationErrors.installments"
|
|
|
- :model-value="enrollmentInstallmentValue"
|
|
|
- disable
|
|
|
- label="Valor da Parcela"
|
|
|
- />
|
|
|
- </div>
|
|
|
-
|
|
|
- <div class="col-3">
|
|
|
- <DefaultInputDatePicker
|
|
|
- v-model="form.enrollment_due_date"
|
|
|
- v-model:error="validationErrors.enrollment_due_date"
|
|
|
- label="Data Vencimento"
|
|
|
- :rules="[inputRules.date]"
|
|
|
- />
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- </div>
|
|
|
-
|
|
|
- <div class="text-subtitle2 q-mt-md q-mb-sm text-grey-8">
|
|
|
- Aulas
|
|
|
- </div>
|
|
|
-
|
|
|
- <div class="row q-col-gutter-sm">
|
|
|
- <div :class="classesIncluded ? 'col-12' : 'col-3'">
|
|
|
- <DefaultCurrencyInput
|
|
|
- v-model="form.package_value"
|
|
|
- v-model:error="validationErrors.package_value"
|
|
|
- label="Valor das Aulas"
|
|
|
- :disable="classesIncluded || !props.contract"
|
|
|
- />
|
|
|
- </div>
|
|
|
-
|
|
|
- <template v-if="!classesIncluded">
|
|
|
- <div class="col-3">
|
|
|
- <DefaultSelect
|
|
|
- v-model="form.package_installments"
|
|
|
- v-model:error="validationErrors.package_installments"
|
|
|
- emit-value
|
|
|
- label="Qtde Parcelas"
|
|
|
- map-options
|
|
|
- option-label="label"
|
|
|
- option-value="value"
|
|
|
- :options="packageInstallmentOptions"
|
|
|
- :rules="[inputRules.integerRange(1, 13)]"
|
|
|
- />
|
|
|
- </div>
|
|
|
-
|
|
|
- <div class="col-3">
|
|
|
- <DefaultCurrencyInput
|
|
|
- v-model:error="validationErrors.package_installments"
|
|
|
- :model-value="packageInstallmentValue"
|
|
|
- disable
|
|
|
- label="Valor da Parcela"
|
|
|
- />
|
|
|
- </div>
|
|
|
-
|
|
|
- <div class="col-3">
|
|
|
- <DefaultInputDatePicker
|
|
|
- v-model="form.package_due_date"
|
|
|
- v-model:error="validationErrors.package_due_date"
|
|
|
- label="Data 1ª Parcela"
|
|
|
- :rules="[inputRules.date]"
|
|
|
- />
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- </div>
|
|
|
-
|
|
|
- <div class="text-subtitle2 q-mt-md q-mb-sm text-grey-8">
|
|
|
- Materiais
|
|
|
- </div>
|
|
|
-
|
|
|
- <div class="row q-col-gutter-sm">
|
|
|
- <div :class="materialsIncluded ? 'col-12' : 'col-3'">
|
|
|
- <DefaultCurrencyInput
|
|
|
- v-model="form.materials_value"
|
|
|
- v-model:error="validationErrors.materials_value"
|
|
|
- label="Valor dos Materiais"
|
|
|
- :disable="materialsIncluded || !props.contract"
|
|
|
- />
|
|
|
- </div>
|
|
|
-
|
|
|
- <template v-if="!materialsIncluded">
|
|
|
- <div class="col-3">
|
|
|
- <DefaultSelect
|
|
|
- v-model="form.materials_installments"
|
|
|
- v-model:error="validationErrors.materials_installments"
|
|
|
- emit-value
|
|
|
- label="Qtde Parcelas"
|
|
|
- map-options
|
|
|
- option-label="label"
|
|
|
- option-value="value"
|
|
|
- :options="packageInstallmentOptions"
|
|
|
- :rules="[inputRules.integerRange(1, 13)]"
|
|
|
- />
|
|
|
- </div>
|
|
|
-
|
|
|
- <div class="col-3">
|
|
|
- <DefaultCurrencyInput
|
|
|
- v-model:error="validationErrors.materials_installments"
|
|
|
- :model-value="materialsInstallmentValue"
|
|
|
- disable
|
|
|
- label="Valor da Parcela"
|
|
|
- />
|
|
|
- </div>
|
|
|
-
|
|
|
- <div class="col-3">
|
|
|
- <DefaultInputDatePicker
|
|
|
- v-model="form.materials_due_date"
|
|
|
- v-model:error="validationErrors.materials_due_date"
|
|
|
- label="Data 1ª Parcela"
|
|
|
- :rules="[inputRules.date]"
|
|
|
- />
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- </div>
|
|
|
-
|
|
|
<div class="text-subtitle2 q-mt-md q-mb-sm text-grey-8">
|
|
|
Total do Curso
|
|
|
</div>
|
|
|
@@ -668,38 +521,12 @@ const dialogCardStyle = computed(() => ({
|
|
|
width: "100%",
|
|
|
}));
|
|
|
|
|
|
-const enrollmentInstallmentValue = computed(() => {
|
|
|
- if (!form.enrollment_fee || !form.installments) {
|
|
|
- return null;
|
|
|
- }
|
|
|
-
|
|
|
- return Number((form.enrollment_fee / form.installments).toFixed(2));
|
|
|
-});
|
|
|
-
|
|
|
const formattedBirthDate = computed(() =>
|
|
|
currentStudent.value?.birth_date
|
|
|
? formatDateYMDtoDMY(currentStudent.value.birth_date)
|
|
|
: "",
|
|
|
);
|
|
|
|
|
|
-const packageInstallmentValue = computed(() => {
|
|
|
- if (!form.package_value || !form.package_installments) {
|
|
|
- return null;
|
|
|
- }
|
|
|
-
|
|
|
- return Number((form.package_value / form.package_installments).toFixed(2));
|
|
|
-});
|
|
|
-
|
|
|
-const materialsInstallmentValue = computed(() => {
|
|
|
- if (!form.materials_value || !form.materials_installments) {
|
|
|
- return null;
|
|
|
- }
|
|
|
-
|
|
|
- return Number(
|
|
|
- (form.materials_value / form.materials_installments).toFixed(2),
|
|
|
- );
|
|
|
-});
|
|
|
-
|
|
|
const totalInstallmentValue = computed(() => {
|
|
|
if (!form.total_value || !form.total_installments) {
|
|
|
return null;
|
|
|
@@ -726,29 +553,6 @@ const modalityOptions = computed(() => {
|
|
|
return options;
|
|
|
});
|
|
|
|
|
|
-const selectedModality = computed(() => {
|
|
|
- const selectedPackage = packages.value.find(
|
|
|
- (item) => item.id === form.package_id,
|
|
|
- );
|
|
|
-
|
|
|
- return form.pricing_mode === "irrecusavel"
|
|
|
- ? selectedPackage?.irrecusavel
|
|
|
- : selectedPackage?.pavao;
|
|
|
-});
|
|
|
-
|
|
|
-// Item "incluso no valor do curso" não gera cobrança separada — só o campo
|
|
|
-// de valor aparece (informativo, desabilitado); parcelas/vencimento somem.
|
|
|
-const registrationIncluded = computed(() =>
|
|
|
- Boolean(selectedModality.value?.registration_included_in_course),
|
|
|
-);
|
|
|
-
|
|
|
-const classesIncluded = computed(() =>
|
|
|
- Boolean(selectedModality.value?.classes_included_in_course),
|
|
|
-);
|
|
|
-
|
|
|
-const materialsIncluded = computed(() =>
|
|
|
- Boolean(selectedModality.value?.materials_included_in_course),
|
|
|
-);
|
|
|
|
|
|
const completeDatePattern = /^\d{2}\/\d{2}\/\d{4}$/;
|
|
|
|
|
|
@@ -763,11 +567,6 @@ const defaultContractDates = (() => {
|
|
|
};
|
|
|
})();
|
|
|
|
|
|
-const enrollmentInstallmentOptions = Array.from({ length: 12 }, (_, index) => ({
|
|
|
- label: `${index + 1}x`,
|
|
|
- value: index + 1,
|
|
|
-}));
|
|
|
-
|
|
|
const packageInstallmentOptions = Array.from({ length: 13 }, (_, index) => ({
|
|
|
label: `${index + 1}x`,
|
|
|
value: index + 1,
|
|
|
@@ -829,24 +628,11 @@ const { form, getUpdatedFields } = useForm({
|
|
|
|
|
|
end_time: trimTime(props.contract?.end_time),
|
|
|
|
|
|
- enrollment_due_date: props.contract?.enrollment_due_date ?? null,
|
|
|
-
|
|
|
- enrollment_fee: props.contract?.tax_register ?? null,
|
|
|
- installments: props.contract?.installments ?? null,
|
|
|
late_fee: props.contract?.fine_cancelled ?? null,
|
|
|
- package_due_date: props.contract?.package_due_date ?? null,
|
|
|
-
|
|
|
package_id: props.contract?.class_package_unit_id ?? null,
|
|
|
|
|
|
- package_installments: props.contract?.package_installments ?? null,
|
|
|
-
|
|
|
- package_value: props.contract?.package_value ?? null,
|
|
|
payment_method: props.contract?.payment_method ?? null,
|
|
|
|
|
|
- materials_due_date: props.contract?.materials_due_date ?? null,
|
|
|
- materials_installments: props.contract?.materials_installments ?? null,
|
|
|
- materials_value: props.contract?.materials_value ?? null,
|
|
|
-
|
|
|
pricing_mode: props.contract?.pricing_mode ?? null,
|
|
|
protocol: props.contract?.protocol ?? null,
|
|
|
|
|
|
@@ -919,25 +705,7 @@ const buildPayload = () => ({
|
|
|
|
|
|
end_time: form.end_time,
|
|
|
|
|
|
- enrollment_due_date: form.enrollment_due_date
|
|
|
- ? formatDateDMYtoYMD(form.enrollment_due_date)
|
|
|
- : null,
|
|
|
-
|
|
|
fine_cancelled: form.late_fee,
|
|
|
- installments: form.installments,
|
|
|
-
|
|
|
- materials_due_date: form.materials_due_date
|
|
|
- ? formatDateDMYtoYMD(form.materials_due_date)
|
|
|
- : null,
|
|
|
- materials_installments: form.materials_installments,
|
|
|
- materials_value: form.materials_value,
|
|
|
-
|
|
|
- package_due_date: form.package_due_date
|
|
|
- ? formatDateDMYtoYMD(form.package_due_date)
|
|
|
- : null,
|
|
|
-
|
|
|
- package_installments: form.package_installments,
|
|
|
- package_value: form.package_value,
|
|
|
payment_method: form.payment_method,
|
|
|
pricing_mode: form.pricing_mode,
|
|
|
protocol: form.protocol,
|
|
|
@@ -951,8 +719,6 @@ const buildPayload = () => ({
|
|
|
|
|
|
start_time: form.start_time,
|
|
|
student_id: currentStudent.value?.id ?? null,
|
|
|
- tax_register: form.enrollment_fee,
|
|
|
-
|
|
|
total_due_date: form.total_due_date
|
|
|
? formatDateDMYtoYMD(form.total_due_date)
|
|
|
: null,
|
|
|
@@ -1007,7 +773,6 @@ const handleSave = async () => {
|
|
|
const updatePayload = {};
|
|
|
|
|
|
const fieldMap = {
|
|
|
- enrollment_fee: "tax_register",
|
|
|
late_fee: "fine_cancelled",
|
|
|
package_id: "class_package_unit_id",
|
|
|
total_classes: "class_quantity",
|
|
|
@@ -1022,13 +787,8 @@ const handleSave = async () => {
|
|
|
"second_weekday",
|
|
|
"second_start_time",
|
|
|
"second_end_time",
|
|
|
- "installments",
|
|
|
- "package_value",
|
|
|
- "package_installments",
|
|
|
"payment_method",
|
|
|
"pricing_mode",
|
|
|
- "materials_value",
|
|
|
- "materials_installments",
|
|
|
"total_value",
|
|
|
"total_installments",
|
|
|
]) {
|
|
|
@@ -1046,9 +806,6 @@ const handleSave = async () => {
|
|
|
for (const key of [
|
|
|
"signature_date",
|
|
|
"end_date",
|
|
|
- "enrollment_due_date",
|
|
|
- "package_due_date",
|
|
|
- "materials_due_date",
|
|
|
"total_due_date",
|
|
|
]) {
|
|
|
if (key in changedFields) {
|
|
|
@@ -1238,45 +995,14 @@ watch(
|
|
|
: selectedPackage?.pavao;
|
|
|
|
|
|
if (!modality) {
|
|
|
- form.enrollment_fee = null;
|
|
|
- form.installments = null;
|
|
|
- form.package_value = null;
|
|
|
- form.package_installments = null;
|
|
|
- form.materials_value = null;
|
|
|
- form.materials_installments = null;
|
|
|
form.total_value = null;
|
|
|
form.total_installments = null;
|
|
|
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- // O valor aparece sempre (informativo); parcelas só existem pro que não
|
|
|
- // estiver incluso no curso (é o que vira cobrança separada).
|
|
|
- form.enrollment_fee = modality.registration_value;
|
|
|
-
|
|
|
- form.installments = modality.registration_included_in_course
|
|
|
- ? null
|
|
|
- : modality.registration_max_installments;
|
|
|
-
|
|
|
- form.package_value = modality.classes_value;
|
|
|
-
|
|
|
- form.package_installments = modality.classes_included_in_course
|
|
|
- ? null
|
|
|
- : modality.classes_max_installments;
|
|
|
-
|
|
|
- form.materials_value = modality.materials_total_value;
|
|
|
-
|
|
|
- form.materials_installments = modality.materials_included_in_course
|
|
|
- ? null
|
|
|
- : modality.materials_max_installments;
|
|
|
-
|
|
|
form.total_value = modality.total_value;
|
|
|
form.total_installments = modality.total_max_installments;
|
|
|
-
|
|
|
- // Vencimento só faz sentido pro que gera cobrança separada.
|
|
|
- if (modality.registration_included_in_course) form.enrollment_due_date = null;
|
|
|
- if (modality.classes_included_in_course) form.package_due_date = null;
|
|
|
- if (modality.materials_included_in_course) form.materials_due_date = null;
|
|
|
},
|
|
|
);
|
|
|
|