|
@@ -6,7 +6,7 @@
|
|
|
style="width: 100%"
|
|
style="width: 100%"
|
|
|
>
|
|
>
|
|
|
<DefaultDialogHeader
|
|
<DefaultDialogHeader
|
|
|
- :title="props.package ? 'Editar Pacote' : 'Novo Pacote'"
|
|
|
|
|
|
|
+ :title="props.package ? 'Editar Proposta Comercial' : 'Nova Proposta Comercial'"
|
|
|
@close="onDialogCancel"
|
|
@close="onDialogCancel"
|
|
|
/>
|
|
/>
|
|
|
|
|
|
|
@@ -20,141 +20,175 @@
|
|
|
>
|
|
>
|
|
|
<q-card-section class="q-pt-sm">
|
|
<q-card-section class="q-pt-sm">
|
|
|
<div class="row q-col-gutter-sm">
|
|
<div class="row q-col-gutter-sm">
|
|
|
- <DefaultInput
|
|
|
|
|
- v-model="form.name"
|
|
|
|
|
- v-model:error="validationErrors.name"
|
|
|
|
|
- class="col-12"
|
|
|
|
|
- label="Nome do Pacote"
|
|
|
|
|
- :rules="[inputRules.required]"
|
|
|
|
|
|
|
+ <CustomTabComponent
|
|
|
|
|
+ v-model:active-tab="currentTab"
|
|
|
|
|
+ class="col-12 q-mb-md"
|
|
|
|
|
+ :tabs="tabs"
|
|
|
/>
|
|
/>
|
|
|
|
|
|
|
|
- <DefaultInput
|
|
|
|
|
- v-model="form.quantity_classes"
|
|
|
|
|
- v-model:error="validationErrors.quantity_classes"
|
|
|
|
|
- class="col-12"
|
|
|
|
|
- label="Quantidade de Aulas"
|
|
|
|
|
- type="number"
|
|
|
|
|
- :rules="[inputRules.required, inputRules.minValue(1)]"
|
|
|
|
|
- />
|
|
|
|
|
-
|
|
|
|
|
- <DefaultInput
|
|
|
|
|
- v-model="form.class_duration_hours"
|
|
|
|
|
- v-model:error="validationErrors.class_duration_minutes"
|
|
|
|
|
|
|
+ <div
|
|
|
|
|
+ v-show="currentTab === 'dados'"
|
|
|
class="col-12"
|
|
class="col-12"
|
|
|
- label="Duração da Aula (horas)"
|
|
|
|
|
- max="24"
|
|
|
|
|
- min="0.5"
|
|
|
|
|
- step="0.5"
|
|
|
|
|
- type="number"
|
|
|
|
|
- :rules="[
|
|
|
|
|
- inputRules.required,
|
|
|
|
|
- inputRules.minValue(0.5),
|
|
|
|
|
- inputRules.maxValue(24),
|
|
|
|
|
- ]"
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ >
|
|
|
|
|
+ <div class="row q-col-gutter-sm">
|
|
|
|
|
+ <DefaultInput
|
|
|
|
|
+ v-model="form.name"
|
|
|
|
|
+ v-model:error="validationErrors.name"
|
|
|
|
|
+ class="col-12"
|
|
|
|
|
+ label="Nome do Pacote"
|
|
|
|
|
+ :rules="[inputRules.required]"
|
|
|
|
|
+ />
|
|
|
|
|
|
|
|
- <div class="col-12 package-duration-hint">
|
|
|
|
|
- A duração padrão das aulas é de 2 horas e pode ser alterada se
|
|
|
|
|
- necessário. É possível configurar no máximo dois dias.
|
|
|
|
|
- </div>
|
|
|
|
|
|
|
+ <DefaultInput
|
|
|
|
|
+ v-model="form.quantity_classes"
|
|
|
|
|
+ v-model:error="validationErrors.quantity_classes"
|
|
|
|
|
+ class="col-12"
|
|
|
|
|
+ label="Quantidade de Aulas"
|
|
|
|
|
+ type="number"
|
|
|
|
|
+ :rules="[inputRules.required, inputRules.minValue(1)]"
|
|
|
|
|
+ />
|
|
|
|
|
|
|
|
- <DefaultCurrencyInput
|
|
|
|
|
- v-model="form.contract_register_value"
|
|
|
|
|
- v-model:error="validationErrors.contract_register_value"
|
|
|
|
|
- class="col-4"
|
|
|
|
|
- label="R$ Matrícula"
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ <DefaultInput
|
|
|
|
|
+ v-model="form.class_duration_hours"
|
|
|
|
|
+ v-model:error="validationErrors.class_duration_minutes"
|
|
|
|
|
+ class="col-12"
|
|
|
|
|
+ label="Duração da Aula (horas)"
|
|
|
|
|
+ max="24"
|
|
|
|
|
+ min="0.5"
|
|
|
|
|
+ step="0.5"
|
|
|
|
|
+ type="number"
|
|
|
|
|
+ :rules="[
|
|
|
|
|
+ inputRules.required,
|
|
|
|
|
+ inputRules.minValue(0.5),
|
|
|
|
|
+ inputRules.maxValue(24),
|
|
|
|
|
+ ]"
|
|
|
|
|
+ />
|
|
|
|
|
|
|
|
- <DefaultCurrencyInput
|
|
|
|
|
- v-model="form.contract_value"
|
|
|
|
|
- v-model:error="validationErrors.contract_value"
|
|
|
|
|
- class="col-4"
|
|
|
|
|
- label="R$ Total do Contrato"
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ <div class="col-12 package-duration-hint">
|
|
|
|
|
+ A duração padrão das aulas é de 2 horas e pode ser alterada se
|
|
|
|
|
+ necessário. É possível configurar no máximo dois dias.
|
|
|
|
|
+ </div>
|
|
|
|
|
|
|
|
- <DefaultInput
|
|
|
|
|
- v-model="form.contrat_discount_value"
|
|
|
|
|
- class="col-4"
|
|
|
|
|
- label="Desconto em %"
|
|
|
|
|
- max="100"
|
|
|
|
|
- min="0"
|
|
|
|
|
- type="number"
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ <DefaultCurrencyInput
|
|
|
|
|
+ v-model="form.contract_register_value"
|
|
|
|
|
+ v-model:error="validationErrors.contract_register_value"
|
|
|
|
|
+ class="col-4"
|
|
|
|
|
+ label="R$ Matrícula"
|
|
|
|
|
+ />
|
|
|
|
|
|
|
|
- <div
|
|
|
|
|
- v-for="(material, index) in form.materials"
|
|
|
|
|
- :key="index"
|
|
|
|
|
- class="col-12"
|
|
|
|
|
- >
|
|
|
|
|
- <div class="row q-col-gutter-sm items-center">
|
|
|
|
|
- <DefaultSelect
|
|
|
|
|
- v-model="material.product_id"
|
|
|
|
|
|
|
+ <DefaultCurrencyInput
|
|
|
|
|
+ v-model="form.contract_value"
|
|
|
|
|
+ v-model:error="validationErrors.contract_value"
|
|
|
class="col-4"
|
|
class="col-4"
|
|
|
- emit-value
|
|
|
|
|
- label="Material"
|
|
|
|
|
- map-options
|
|
|
|
|
- :options="productOptions"
|
|
|
|
|
- :rules="
|
|
|
|
|
- material.product_id
|
|
|
|
|
- ? [inputRules.required]
|
|
|
|
|
- : []
|
|
|
|
|
- "
|
|
|
|
|
- @update:model-value="onProductSelected(material)"
|
|
|
|
|
|
|
+ label="R$ Total do Contrato"
|
|
|
/>
|
|
/>
|
|
|
|
|
|
|
|
<DefaultInput
|
|
<DefaultInput
|
|
|
- v-model="material.quantity"
|
|
|
|
|
|
|
+ v-model="form.contrat_discount_value"
|
|
|
class="col-4"
|
|
class="col-4"
|
|
|
- label="Qtd"
|
|
|
|
|
- min="1"
|
|
|
|
|
|
|
+ label="Desconto em %"
|
|
|
|
|
+ max="100"
|
|
|
|
|
+ min="0"
|
|
|
type="number"
|
|
type="number"
|
|
|
- :rules="
|
|
|
|
|
- material.product_id
|
|
|
|
|
- ? [
|
|
|
|
|
- inputRules.required,
|
|
|
|
|
- inputRules.minValue(1),
|
|
|
|
|
- ]
|
|
|
|
|
- : []
|
|
|
|
|
- "
|
|
|
|
|
- />
|
|
|
|
|
-
|
|
|
|
|
- <DefaultCurrencyInput
|
|
|
|
|
- v-model="material.price"
|
|
|
|
|
- class="col"
|
|
|
|
|
- label="R$ Unitário"
|
|
|
|
|
- :rules="
|
|
|
|
|
- material.product_id
|
|
|
|
|
- ? [inputRules.required]
|
|
|
|
|
- : []
|
|
|
|
|
- "
|
|
|
|
|
/>
|
|
/>
|
|
|
|
|
|
|
|
- <div class="col-auto">
|
|
|
|
|
- <q-btn
|
|
|
|
|
- v-if="index === form.materials.length - 1"
|
|
|
|
|
- color="primary"
|
|
|
|
|
- icon="mdi-plus"
|
|
|
|
|
- style="
|
|
|
|
|
- border-radius: 8px;
|
|
|
|
|
- height: 40px;
|
|
|
|
|
- width: 40px;
|
|
|
|
|
- "
|
|
|
|
|
- unelevated
|
|
|
|
|
- @click="addMaterial"
|
|
|
|
|
- />
|
|
|
|
|
-
|
|
|
|
|
- <q-btn
|
|
|
|
|
- v-else
|
|
|
|
|
- color="negative"
|
|
|
|
|
- dense
|
|
|
|
|
- flat
|
|
|
|
|
- icon="mdi-delete-outline"
|
|
|
|
|
- round
|
|
|
|
|
- @click="removeMaterial(index)"
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ <div
|
|
|
|
|
+ v-for="(material, index) in form.materials"
|
|
|
|
|
+ :key="index"
|
|
|
|
|
+ class="col-12"
|
|
|
|
|
+ >
|
|
|
|
|
+ <div class="row q-col-gutter-sm items-center">
|
|
|
|
|
+ <DefaultSelect
|
|
|
|
|
+ v-model="material.product_id"
|
|
|
|
|
+ class="col-4"
|
|
|
|
|
+ emit-value
|
|
|
|
|
+ label="Material"
|
|
|
|
|
+ map-options
|
|
|
|
|
+ :options="productOptions"
|
|
|
|
|
+ :rules="
|
|
|
|
|
+ material.product_id
|
|
|
|
|
+ ? [inputRules.required]
|
|
|
|
|
+ : []
|
|
|
|
|
+ "
|
|
|
|
|
+ @update:model-value="onProductSelected(material)"
|
|
|
|
|
+ />
|
|
|
|
|
+
|
|
|
|
|
+ <DefaultInput
|
|
|
|
|
+ v-model="material.quantity"
|
|
|
|
|
+ class="col-4"
|
|
|
|
|
+ label="Qtd"
|
|
|
|
|
+ min="1"
|
|
|
|
|
+ type="number"
|
|
|
|
|
+ :rules="
|
|
|
|
|
+ material.product_id
|
|
|
|
|
+ ? [
|
|
|
|
|
+ inputRules.required,
|
|
|
|
|
+ inputRules.minValue(1),
|
|
|
|
|
+ ]
|
|
|
|
|
+ : []
|
|
|
|
|
+ "
|
|
|
|
|
+ />
|
|
|
|
|
+
|
|
|
|
|
+ <DefaultCurrencyInput
|
|
|
|
|
+ v-model="material.price"
|
|
|
|
|
+ class="col"
|
|
|
|
|
+ label="R$ Unitário"
|
|
|
|
|
+ :rules="
|
|
|
|
|
+ material.product_id
|
|
|
|
|
+ ? [inputRules.required]
|
|
|
|
|
+ : []
|
|
|
|
|
+ "
|
|
|
|
|
+ />
|
|
|
|
|
+
|
|
|
|
|
+ <div class="col-auto">
|
|
|
|
|
+ <q-btn
|
|
|
|
|
+ v-if="index === form.materials.length - 1"
|
|
|
|
|
+ color="primary"
|
|
|
|
|
+ icon="mdi-plus"
|
|
|
|
|
+ style="
|
|
|
|
|
+ border-radius: 8px;
|
|
|
|
|
+ height: 40px;
|
|
|
|
|
+ width: 40px;
|
|
|
|
|
+ "
|
|
|
|
|
+ unelevated
|
|
|
|
|
+ @click="addMaterial"
|
|
|
|
|
+ />
|
|
|
|
|
+
|
|
|
|
|
+ <q-btn
|
|
|
|
|
+ v-else
|
|
|
|
|
+ color="negative"
|
|
|
|
|
+ dense
|
|
|
|
|
+ flat
|
|
|
|
|
+ icon="mdi-delete-outline"
|
|
|
|
|
+ round
|
|
|
|
|
+ @click="removeMaterial(index)"
|
|
|
|
|
+ />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
+
|
|
|
|
|
+ <div
|
|
|
|
|
+ v-show="currentTab === 'pavao'"
|
|
|
|
|
+ class="col-12"
|
|
|
|
|
+ >
|
|
|
|
|
+ <ProposalPricingTab
|
|
|
|
|
+ v-model="form.pavao"
|
|
|
|
|
+ :product-options="productOptions"
|
|
|
|
|
+ />
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ <div
|
|
|
|
|
+ v-show="currentTab === 'irrecusavel'"
|
|
|
|
|
+ class="col-12"
|
|
|
|
|
+ >
|
|
|
|
|
+ <ProposalPricingTab
|
|
|
|
|
+ v-model="form.irrecusavel"
|
|
|
|
|
+ :product-options="productOptions"
|
|
|
|
|
+ show-condition
|
|
|
|
|
+ />
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
</q-card-section>
|
|
</q-card-section>
|
|
|
</q-scroll-area>
|
|
</q-scroll-area>
|
|
@@ -206,11 +240,13 @@ import { useInputRules } from "src/composables/useInputRules";
|
|
|
import { useScroll } from "src/composables/useScroll";
|
|
import { useScroll } from "src/composables/useScroll";
|
|
|
import { useSubmitHandler } from "src/composables/useSubmitHandler";
|
|
import { useSubmitHandler } from "src/composables/useSubmitHandler";
|
|
|
|
|
|
|
|
|
|
+import CustomTabComponent from "src/components/shared/CustomTabComponent.vue";
|
|
|
import DefaultCurrencyInput from "src/components/defaults/DefaultCurrencyInput.vue";
|
|
import DefaultCurrencyInput from "src/components/defaults/DefaultCurrencyInput.vue";
|
|
|
import DefaultDialogHeader from "src/components/defaults/DefaultDialogHeader.vue";
|
|
import DefaultDialogHeader from "src/components/defaults/DefaultDialogHeader.vue";
|
|
|
import DefaultForm from "src/components/defaults/DefaultForm.vue";
|
|
import DefaultForm from "src/components/defaults/DefaultForm.vue";
|
|
|
import DefaultInput from "src/components/defaults/DefaultInput.vue";
|
|
import DefaultInput from "src/components/defaults/DefaultInput.vue";
|
|
|
import DefaultSelect from "src/components/defaults/DefaultSelect.vue";
|
|
import DefaultSelect from "src/components/defaults/DefaultSelect.vue";
|
|
|
|
|
+import ProposalPricingTab from "./ProposalPricingTab.vue";
|
|
|
|
|
|
|
|
defineEmits([...useDialogPluginComponent.emits]);
|
|
defineEmits([...useDialogPluginComponent.emits]);
|
|
|
|
|
|
|
@@ -240,6 +276,37 @@ const productOptions = computed(() =>
|
|
|
})),
|
|
})),
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
|
|
+const currentTab = ref("dados");
|
|
|
|
|
+
|
|
|
|
|
+const tabs = [
|
|
|
|
|
+ { label: "Dados", name: "dados" },
|
|
|
|
|
+ { label: "Pavão", name: "pavao" },
|
|
|
|
|
+ { label: "Irrecusável", name: "irrecusavel" },
|
|
|
|
|
+];
|
|
|
|
|
+
|
|
|
|
|
+const defaultPricingBlock = (withCondition = false) => ({
|
|
|
|
|
+ classes_discount_percentage: null,
|
|
|
|
|
+ classes_included_in_course: false,
|
|
|
|
|
+ classes_installments_allowed: false,
|
|
|
|
|
+ classes_max_installments: 13,
|
|
|
|
|
+ classes_value: null,
|
|
|
|
|
+
|
|
|
|
|
+ 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,
|
|
|
|
|
+
|
|
|
|
|
+ total_max_installments: 13,
|
|
|
|
|
+ total_value: null,
|
|
|
|
|
+
|
|
|
|
|
+ ...(withCondition ? { condition: null } : {}),
|
|
|
|
|
+});
|
|
|
|
|
+
|
|
|
const { form, getUpdatedFields } = useForm({
|
|
const { form, getUpdatedFields } = useForm({
|
|
|
class_duration_hours:
|
|
class_duration_hours:
|
|
|
(props.package?.class_duration_minutes ?? 120) / 60,
|
|
(props.package?.class_duration_minutes ?? 120) / 60,
|
|
@@ -252,6 +319,8 @@ const { form, getUpdatedFields } = useForm({
|
|
|
contrat_discount_value:
|
|
contrat_discount_value:
|
|
|
props.package?.contrat_discount_value ?? null,
|
|
props.package?.contrat_discount_value ?? null,
|
|
|
|
|
|
|
|
|
|
+ irrecusavel: defaultPricingBlock(true),
|
|
|
|
|
+
|
|
|
materials: [
|
|
materials: [
|
|
|
{
|
|
{
|
|
|
price: null,
|
|
price: null,
|
|
@@ -261,6 +330,7 @@ const { form, getUpdatedFields } = useForm({
|
|
|
],
|
|
],
|
|
|
|
|
|
|
|
name: props.package?.name ?? null,
|
|
name: props.package?.name ?? null,
|
|
|
|
|
+ pavao: defaultPricingBlock(),
|
|
|
quantity_classes: props.package?.quantity_classes ?? null,
|
|
quantity_classes: props.package?.quantity_classes ?? null,
|
|
|
});
|
|
});
|
|
|
|
|
|
|
@@ -285,6 +355,73 @@ const addMaterial = () => {
|
|
|
});
|
|
});
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+const mapPricingBlockFromApi = (data, existingMaterials) => ({
|
|
|
|
|
+ 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,
|
|
|
|
|
+
|
|
|
|
|
+ materials: data.materials?.length
|
|
|
|
|
+ ? data.materials.map((material) => ({
|
|
|
|
|
+ price: material.price,
|
|
|
|
|
+ product_id: material.product_id,
|
|
|
|
|
+ quantity: material.quantity,
|
|
|
|
|
+ }))
|
|
|
|
|
+ : 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,
|
|
|
|
|
+
|
|
|
|
|
+ total_max_installments: data.total_max_installments,
|
|
|
|
|
+ total_value: data.total_value,
|
|
|
|
|
+
|
|
|
|
|
+ ...(data.condition !== undefined ? { condition: data.condition } : {}),
|
|
|
|
|
+});
|
|
|
|
|
+
|
|
|
|
|
+const numOrNull = (value) =>
|
|
|
|
|
+ value === null || value === "" || value === undefined ? null : Number(value);
|
|
|
|
|
+
|
|
|
|
|
+const toPricingPayload = (block, { withCondition = false } = {}) => {
|
|
|
|
|
+ const payload = {
|
|
|
|
|
+ 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),
|
|
|
|
|
+
|
|
|
|
|
+ materials: block.materials
|
|
|
|
|
+ .filter((material) => material.product_id)
|
|
|
|
|
+ .map((material) => ({
|
|
|
|
|
+ price: Number(material.price),
|
|
|
|
|
+ product_id: material.product_id,
|
|
|
|
|
+ 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),
|
|
|
|
|
+
|
|
|
|
|
+ total_max_installments: Number(block.total_max_installments) || 13,
|
|
|
|
|
+ total_value: numOrNull(block.total_value),
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ if (withCondition) {
|
|
|
|
|
+ payload.condition = block.condition ?? null;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return payload;
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
const onOKClick = async () => {
|
|
const onOKClick = async () => {
|
|
|
const validMaterials = form.materials.filter(
|
|
const validMaterials = form.materials.filter(
|
|
|
(material) => material.product_id,
|
|
(material) => material.product_id,
|
|
@@ -303,6 +440,8 @@ const onOKClick = async () => {
|
|
|
contrat_discount_value:
|
|
contrat_discount_value:
|
|
|
form.contrat_discount_value,
|
|
form.contrat_discount_value,
|
|
|
|
|
|
|
|
|
|
+ irrecusavel: toPricingPayload(form.irrecusavel, { withCondition: true }),
|
|
|
|
|
+
|
|
|
materials: validMaterials.map((material) => ({
|
|
materials: validMaterials.map((material) => ({
|
|
|
price: Number(material.price),
|
|
price: Number(material.price),
|
|
|
product_id: material.product_id,
|
|
product_id: material.product_id,
|
|
@@ -310,6 +449,7 @@ const onOKClick = async () => {
|
|
|
})),
|
|
})),
|
|
|
|
|
|
|
|
name: form.name,
|
|
name: form.name,
|
|
|
|
|
+ pavao: toPricingPayload(form.pavao),
|
|
|
quantity_classes: form.quantity_classes,
|
|
quantity_classes: form.quantity_classes,
|
|
|
};
|
|
};
|
|
|
|
|
|
|
@@ -344,6 +484,11 @@ const onOKClick = async () => {
|
|
|
updatePayload.materials = payload.materials;
|
|
updatePayload.materials = payload.materials;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // Pavão/Irrecusável têm validação cruzada entre campos (par exclusivo de
|
|
|
|
|
+ // checkbox) que não é seguro fatiar num diff parcial — vão inteiros.
|
|
|
|
|
+ updatePayload.pavao = payload.pavao;
|
|
|
|
|
+ updatePayload.irrecusavel = payload.irrecusavel;
|
|
|
|
|
+
|
|
|
return updateUnitPackage(
|
|
return updateUnitPackage(
|
|
|
props.package.id,
|
|
props.package.id,
|
|
|
updatePayload,
|
|
updatePayload,
|
|
@@ -388,6 +533,14 @@ onMounted(async () => {
|
|
|
}),
|
|
}),
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ if (packageData.pavao) {
|
|
|
|
|
+ form.pavao = mapPricingBlockFromApi(packageData.pavao, form.pavao.materials);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (packageData.irrecusavel) {
|
|
|
|
|
+ form.irrecusavel = mapPricingBlockFromApi(packageData.irrecusavel, form.irrecusavel.materials);
|
|
|
|
|
+ }
|
|
|
});
|
|
});
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|