|
@@ -10,11 +10,12 @@
|
|
|
<DefaultForm ref="formRef" @submit="onOKClick">
|
|
<DefaultForm ref="formRef" @submit="onOKClick">
|
|
|
<q-scroll-area ref="scrollAreaRef" class="form-dialog-scroll-area">
|
|
<q-scroll-area ref="scrollAreaRef" class="form-dialog-scroll-area">
|
|
|
<q-card-section class="row q-col-gutter-md q-pt-none">
|
|
<q-card-section class="row q-col-gutter-md q-pt-none">
|
|
|
- <CustomTabComponent
|
|
|
|
|
- v-model:active-tab="currentTab"
|
|
|
|
|
- class="col-12 q-mb-md"
|
|
|
|
|
- :tabs="tabs"
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ <div class="col-12 q-mb-md">
|
|
|
|
|
+ <CustomTabComponent
|
|
|
|
|
+ v-model:active-tab="currentTab"
|
|
|
|
|
+ :tabs="tabs"
|
|
|
|
|
+ />
|
|
|
|
|
+ </div>
|
|
|
|
|
|
|
|
<div
|
|
<div
|
|
|
v-show="currentTab === 'dados'"
|
|
v-show="currentTab === 'dados'"
|
|
@@ -168,19 +169,10 @@ const scrollAreaRef = ref(null);
|
|
|
|
|
|
|
|
const defaultPricingBlock = (withCondition = false) => ({
|
|
const defaultPricingBlock = (withCondition = false) => ({
|
|
|
classes_discount_percentage: null,
|
|
classes_discount_percentage: null,
|
|
|
- classes_included_in_course: false,
|
|
|
|
|
- classes_installments_allowed: false,
|
|
|
|
|
- classes_max_installments: 13,
|
|
|
|
|
classes_value: null,
|
|
classes_value: null,
|
|
|
|
|
|
|
|
materials: [{ price: null, product_id: null, quantity: 1 }],
|
|
materials: [{ price: null, product_id: null, quantity: 1 }],
|
|
|
- materials_included_in_course: false,
|
|
|
|
|
- materials_installments_allowed: false,
|
|
|
|
|
- materials_max_installments: 13,
|
|
|
|
|
|
|
|
|
|
- registration_included_in_course: false,
|
|
|
|
|
- registration_installments_allowed: false,
|
|
|
|
|
- registration_max_installments: 13,
|
|
|
|
|
registration_value: null,
|
|
registration_value: null,
|
|
|
|
|
|
|
|
total_max_installments: 13,
|
|
total_max_installments: 13,
|
|
@@ -232,9 +224,6 @@ const tabs = [
|
|
|
|
|
|
|
|
const mapPricingBlockFromApi = (data, existingMaterials) => ({
|
|
const mapPricingBlockFromApi = (data, existingMaterials) => ({
|
|
|
classes_discount_percentage: data.classes_discount_percentage,
|
|
classes_discount_percentage: data.classes_discount_percentage,
|
|
|
- classes_included_in_course: data.classes_included_in_course,
|
|
|
|
|
- classes_installments_allowed: data.classes_installments_allowed,
|
|
|
|
|
- classes_max_installments: data.classes_max_installments,
|
|
|
|
|
classes_value: data.classes_value,
|
|
classes_value: data.classes_value,
|
|
|
|
|
|
|
|
materials: data.materials?.length
|
|
materials: data.materials?.length
|
|
@@ -244,13 +233,7 @@ const mapPricingBlockFromApi = (data, existingMaterials) => ({
|
|
|
quantity: material.quantity,
|
|
quantity: material.quantity,
|
|
|
}))
|
|
}))
|
|
|
: existingMaterials,
|
|
: existingMaterials,
|
|
|
- materials_included_in_course: data.materials_included_in_course,
|
|
|
|
|
- materials_installments_allowed: data.materials_installments_allowed,
|
|
|
|
|
- materials_max_installments: data.materials_max_installments,
|
|
|
|
|
|
|
|
|
|
- registration_included_in_course: data.registration_included_in_course,
|
|
|
|
|
- registration_installments_allowed: data.registration_installments_allowed,
|
|
|
|
|
- registration_max_installments: data.registration_max_installments,
|
|
|
|
|
registration_value: data.registration_value,
|
|
registration_value: data.registration_value,
|
|
|
|
|
|
|
|
total_max_installments: data.total_max_installments,
|
|
total_max_installments: data.total_max_installments,
|
|
@@ -265,9 +248,6 @@ const numOrNull = (value) =>
|
|
|
const toPricingPayload = (block, { withCondition = false } = {}) => {
|
|
const toPricingPayload = (block, { withCondition = false } = {}) => {
|
|
|
const payload = {
|
|
const payload = {
|
|
|
classes_discount_percentage: numOrNull(block.classes_discount_percentage),
|
|
classes_discount_percentage: numOrNull(block.classes_discount_percentage),
|
|
|
- classes_included_in_course: block.classes_included_in_course,
|
|
|
|
|
- classes_installments_allowed: block.classes_installments_allowed,
|
|
|
|
|
- classes_max_installments: Number(block.classes_max_installments) || 13,
|
|
|
|
|
classes_value: numOrNull(block.classes_value),
|
|
classes_value: numOrNull(block.classes_value),
|
|
|
|
|
|
|
|
materials: block.materials
|
|
materials: block.materials
|
|
@@ -277,13 +257,7 @@ const toPricingPayload = (block, { withCondition = false } = {}) => {
|
|
|
product_id: material.product_id,
|
|
product_id: material.product_id,
|
|
|
quantity: Number(material.quantity),
|
|
quantity: Number(material.quantity),
|
|
|
})),
|
|
})),
|
|
|
- materials_included_in_course: block.materials_included_in_course,
|
|
|
|
|
- materials_installments_allowed: block.materials_installments_allowed,
|
|
|
|
|
- materials_max_installments: Number(block.materials_max_installments) || 13,
|
|
|
|
|
|
|
|
|
|
- registration_included_in_course: block.registration_included_in_course,
|
|
|
|
|
- registration_installments_allowed: block.registration_installments_allowed,
|
|
|
|
|
- registration_max_installments: Number(block.registration_max_installments) || 13,
|
|
|
|
|
registration_value: numOrNull(block.registration_value),
|
|
registration_value: numOrNull(block.registration_value),
|
|
|
|
|
|
|
|
total_max_installments: Number(block.total_max_installments) || 13,
|
|
total_max_installments: Number(block.total_max_installments) || 13,
|
|
@@ -346,9 +320,6 @@ const onOKClick = async () => {
|
|
|
delete updated.class_duration_hours;
|
|
delete updated.class_duration_hours;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // Pavão/Irrecusável têm validação cruzada entre campos (par exclusivo
|
|
|
|
|
- // de checkbox) e um sinal explícito de "removido" (null) — não é
|
|
|
|
|
- // seguro fatiar isso num diff parcial, vão sempre inteiros.
|
|
|
|
|
updated.pavao = payload.pavao;
|
|
updated.pavao = payload.pavao;
|
|
|
updated.irrecusavel = payload.irrecusavel;
|
|
updated.irrecusavel = payload.irrecusavel;
|
|
|
|
|
|
|
@@ -361,8 +332,6 @@ const onOKClick = async () => {
|
|
|
return createPackage(payload);
|
|
return createPackage(payload);
|
|
|
});
|
|
});
|
|
|
} finally {
|
|
} finally {
|
|
|
- // Se o erro veio de dentro de Pavão/Irrecusável, troca pra aba certa —
|
|
|
|
|
- // senão a mensagem fica escondida numa tab que não está visível.
|
|
|
|
|
const errorKeys = Object.keys(validationErrors);
|
|
const errorKeys = Object.keys(validationErrors);
|
|
|
|
|
|
|
|
if (errorKeys.some((key) => key.startsWith("pavao."))) {
|
|
if (errorKeys.some((key) => key.startsWith("pavao."))) {
|