Prechádzať zdrojové kódy

fix: add Qtd. Aulas and Visível para Franqueado fields

Qtd. Aulas (quantity_classes) was missing from the Proposta Comercial
"Dados" tab entirely, causing a not-null violation on save. Visível
para o Franqueado (visible_franchisee) had no UI control, so every
product defaulted to invisible on the franchisee side.
alvesantos 2 dní pred
rodič
commit
893c1bd63d

+ 13 - 0
src/pages/packages/components/AddEditPackageDialog.vue

@@ -32,6 +32,17 @@
                   />
 
 
+                  <DefaultInput
+                    v-model="form.quantity_classes"
+                    v-model:error="validationErrors.quantity_classes"
+                    class="col-12"
+                    label="Qtd. Aulas"
+                    type="number"
+                    :error-message="validationErrors.quantity_classes"
+                    :min="1"
+                    :rules="[inputRules.requiredNumber, inputRules.integerRange(1)]"
+                  />
+
                   <DefaultInput
                     v-model="form.class_duration_hours"
                     v-model:error="validationErrors.class_duration_minutes"
@@ -175,6 +186,7 @@ const { form, getUpdatedFields, setUpdateFormAsOriginal } = useForm(
     name: props.package?.name ?? null,
     pavao: defaultPricingBlock(),
     pavao_enabled: false,
+    quantity_classes: props.package?.quantity_classes ?? null,
   },
   { containerRef: scrollAreaRef },
 );
@@ -289,6 +301,7 @@ const onOKClick = async () => {
 
     name: form.name,
     pavao: form.pavao_enabled ? toPricingPayload(form.pavao) : null,
+    quantity_classes: Number(form.quantity_classes) || null,
   };
 
   try {

+ 10 - 0
src/pages/products/components/AddEditProductDialog.vue

@@ -60,6 +60,14 @@
                 readonly
                 :model-value="totalValueFormatted"
               />
+
+              <q-toggle
+                v-model="form.visible_franchisee"
+                class="col-12"
+                color="primary"
+                label="Visível para o Franqueado"
+                left-label
+              />
             </q-card-section>
           </q-scroll-area>
 
@@ -140,6 +148,7 @@ const { form, getUpdatedFields } = useForm(
     name: props.product?.name ?? "",
     quantity: props.product?.quantity ?? 0,
     unitPrice: props.product?.price_sale ?? 0,
+    visible_franchisee: props.product?.visible_franchisee ?? false,
   },
   { containerRef: scrollAreaRef },
 );
@@ -177,6 +186,7 @@ const onOKClick = async () => {
     name: form.name,
     price_sale: form.unitPrice,
     quantity: Number(form.quantity),
+    visible_franchisee: form.visible_franchisee,
   };
 
   await execute(() => {