diff --git a/src/pages/Ticket/Card/BasicData/BasicDataTable.vue b/src/pages/Ticket/Card/BasicData/BasicDataTable.vue new file mode 100644 index 000000000..37c51fadf --- /dev/null +++ b/src/pages/Ticket/Card/BasicData/BasicDataTable.vue @@ -0,0 +1,245 @@ + + + diff --git a/src/pages/Ticket/Card/BasicData/TicketBasicDataForm.vue b/src/pages/Ticket/Card/BasicData/TicketBasicDataForm.vue new file mode 100644 index 000000000..e69de29bb diff --git a/src/pages/Ticket/Card/TicketBasicData.vue b/src/pages/Ticket/Card/BasicData/TicketBasicDataView.vue similarity index 93% rename from src/pages/Ticket/Card/TicketBasicData.vue rename to src/pages/Ticket/Card/BasicData/TicketBasicDataView.vue index e4bf52a94..bba90a35a 100644 --- a/src/pages/Ticket/Card/TicketBasicData.vue +++ b/src/pages/Ticket/Card/BasicData/TicketBasicDataView.vue @@ -10,6 +10,7 @@ import VnSelect from 'src/components/common/VnSelect.vue'; import VnInput from 'src/components/common/VnInput.vue'; import VnInputDate from 'src/components/common/VnInputDate.vue'; import VnInputTime from 'components/common/VnInputTime.vue'; +import BasicDataTable from './BasicDataTable.vue'; import axios from 'axios'; import useNotify from 'src/composables/useNotify.js'; @@ -289,6 +290,43 @@ const redirectToCustomerAddress = () => { params: { id: clientId.value, addressId: addressId.value }, }); }; + +const isFormInvalid = (formData) => { + return ( + !formData.clientFk || + !formData.addressFk || + !formData.agencyModeFk || + !formData.companyFk || + !formData.shipped || + !formData.landed || + !formData.zoneFk + ); +}; + +const onNextStep = async () => { + if (step.value === 1) { + const formData = formModelRef.value.formData; + if (isFormInvalid(formData)) + return notify(t('basicData.someFieldsAreInvalid'), 'negative'); + + if (!formData.sale || formModelRef.value.hasChanges) { + const params = { + landed: formData.landed, + addressId: formData.addressFk, + agencyModeId: formData.agencyModeFk, + zoneId: formData.zoneFk, + warehouseId: formData.warehouseFk, + shipped: formData.shipped, + }; + const { data } = await axios.post( + `tickets/${formData.id}/priceDifference`, + params + ); + formData.sale = data; + stepperRef.value.next(); + } + } +}; - - An ad group contains one or more ads which target a shared set of keywords. + +