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 @@ + + + + (ticketUpdateActions = data)" + auto-load + /> + + + + + + {{ t('basicData.total') }} + + + + + {{ t('basicData.price') }}: + {{ toCurrency(totalPrice) }} + + + + + {{ t('basicData.newPrice') }}: {{ toCurrency(totalNewPrice) }} + + + + + {{ t('basicData.difference') }}: {{ toCurrency(totalDifference) }} + + + + + + + {{ t('basicData.chargeDifference') }} + + + + + + + + + + + + {{ t('basicData.withoutNegativesInfo') }} + + + + + + + + + + + {{ row.itemFk }} + + + + + + + + {{ row.item.name }} + {{ row.item.subName }} + + + + + + + + + + + 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(); + } + } +}; { animated keep-alive > - + { - - An ad group contains one or more ads which target a shared set of keywords. + + diff --git a/src/pages/Ticket/locale/en.yml b/src/pages/Ticket/locale/en.yml index 643421ad4..6fe813a2a 100644 --- a/src/pages/Ticket/locale/en.yml +++ b/src/pages/Ticket/locale/en.yml @@ -15,3 +15,20 @@ basicData: shipped: Shipped landed: Landed shippedHour: Shipped hour + priceDifference: Price difference + someFieldsAreInvalid: Some fields are invalid + item: Item + description: Description + movable: Movable + quantity: Quantity + pricePPU: Price (PPU) + newPricePPU: New (PPU) + difference: Difference + total: Total + price: Price + newPrice: New price + chargeDifference: Charge difference to + withoutNegatives: Create without negatives + withoutNegativesInfo: Clone this ticket with the changes and only sales availables + negativesConfirmTitle: Edit basic data + negativesConfirmMessage: Negatives are going to be generated, are you sure you want to advance all the lines? diff --git a/src/pages/Ticket/locale/es.yml b/src/pages/Ticket/locale/es.yml index 913d1935d..8f9394a2e 100644 --- a/src/pages/Ticket/locale/es.yml +++ b/src/pages/Ticket/locale/es.yml @@ -15,5 +15,22 @@ basicData: shipped: F. Envío landed: F. Entrega shippedHour: Hora de envío + priceDifference: Diferencia de precio + someFieldsAreInvalid: Algunos campos no son válidos + item: Artículo + description: Descripción + movable: Movible + quantity: Cantidad + pricePPU: Precio (Ud.) + newPricePPU: Nuevo (Ud.) + difference: Diferencia + total: Total + price: Precio + newPrice: Nuevo precio + chargeDifference: Cargar diferencia a + withoutNegatives: Crear sin negativos + withoutNegativesInfo: Clonar este ticket con los cambios y solo ventas disponibles + negativesConfirmTitle: Editar datos básicos + negativesConfirmMessage: Se van a generar negativos, ¿seguro que quieres adelantar todas las líneas? Search ticket: Buscar ticket You can search by ticket id or alias: Puedes buscar por id o alias del ticket diff --git a/src/router/modules/ticket.js b/src/router/modules/ticket.js index 3c60f40ab..351ca5baa 100644 --- a/src/router/modules/ticket.js +++ b/src/router/modules/ticket.js @@ -64,7 +64,8 @@ export default { title: 'basicData', icon: 'vn:settings', }, - component: () => import('src/pages/Ticket/Card/TicketBasicData.vue'), + component: () => + import('src/pages/Ticket/Card/BasicData/TicketBasicDataView.vue'), }, { name: 'TicketSale',