From 768b619904b2a5d2f68d4a5e1f7da5799a3ff473 Mon Sep 17 00:00:00 2001 From: wbuezas Date: Sun, 30 Jun 2024 17:43:21 -0300 Subject: [PATCH 01/11] Sale tracking --- src/i18n/locale/en.yml | 1 + src/i18n/locale/es.yml | 1 + src/pages/Ticket/Card/TicketSaleTracking.vue | 539 +++++++++++++++++++ src/pages/Ticket/locale/en.yml | 18 + src/pages/Ticket/locale/es.yml | 18 + src/router/modules/ticket.js | 11 + 6 files changed, 588 insertions(+) create mode 100644 src/pages/Ticket/Card/TicketSaleTracking.vue diff --git a/src/i18n/locale/en.yml b/src/i18n/locale/en.yml index fbab06966..2b8639ef7 100644 --- a/src/i18n/locale/en.yml +++ b/src/i18n/locale/en.yml @@ -448,6 +448,7 @@ ticket: futureTickets: Future tickets purchaseRequest: Purchase request weeklyTickets: Weekly tickets + saleTracking: Sale tracking list: nickname: Nickname state: State diff --git a/src/i18n/locale/es.yml b/src/i18n/locale/es.yml index fec78d5e6..218976e76 100644 --- a/src/i18n/locale/es.yml +++ b/src/i18n/locale/es.yml @@ -447,6 +447,7 @@ ticket: futureTickets: Tickets a futuro purchaseRequest: Petición de compra weeklyTickets: Tickets programados + saleTracking: Líneas preparadas list: nickname: Alias state: Estado diff --git a/src/pages/Ticket/Card/TicketSaleTracking.vue b/src/pages/Ticket/Card/TicketSaleTracking.vue new file mode 100644 index 000000000..a03f75387 --- /dev/null +++ b/src/pages/Ticket/Card/TicketSaleTracking.vue @@ -0,0 +1,539 @@ + + + diff --git a/src/pages/Ticket/locale/en.yml b/src/pages/Ticket/locale/en.yml index 2c648e7f2..2b173eae9 100644 --- a/src/pages/Ticket/locale/en.yml +++ b/src/pages/Ticket/locale/en.yml @@ -136,3 +136,21 @@ weeklyTickets: salesperson: Salesperson search: Search weekly tickets searchInfo: Search weekly tickets by id or client id +ticketSaleTracking: + isChecked: Is checked + item: Item + description: Description + quantity: Quantity + parking: Parking + historyAction: Log states + shelvingAction: Shelvings sale + original: Original + worker: Worker + state: State + created: Created + shelving: Shelving + saleGroupDetail: sale group detail + previousSelected: previous selected + previous: previous + prepared: prepared + checked: checked diff --git a/src/pages/Ticket/locale/es.yml b/src/pages/Ticket/locale/es.yml index 3ce4c0545..f5f4d89f5 100644 --- a/src/pages/Ticket/locale/es.yml +++ b/src/pages/Ticket/locale/es.yml @@ -138,3 +138,21 @@ ticketSale: shipped: F. Envío agency: Agencia address: Consignatario +ticketSaleTracking: + isChecked: Comprobado + item: Artículo + description: Descripción + quantity: Cantidad + parking: Parking + historyAction: Historial estados + shelvingAction: Carros línea + original: Original + worker: Trabajador + state: Estado + created: Fecha creación + shelving: Matrícula + saleGroupDetail: detalle grupo líneas + previousSelected: previa seleccionado + previous: previa + prepared: preparado + checked: revisado diff --git a/src/router/modules/ticket.js b/src/router/modules/ticket.js index 81ca405ee..5850458bb 100644 --- a/src/router/modules/ticket.js +++ b/src/router/modules/ticket.js @@ -19,6 +19,7 @@ export default { 'TicketSale', 'TicketLog', 'TicketPurchaseRequest', + 'TicketSaleTracking', ], }, children: [ @@ -147,6 +148,16 @@ export default { }, component: () => import('src/pages/Ticket/Card/TicketSms.vue'), }, + { + path: 'sale-tracking', + name: 'TicketSaleTracking', + meta: { + title: 'saleTracking', + icon: 'vn:buyrequest', + }, + component: () => + import('src/pages/Ticket/Card/TicketSaleTracking.vue'), + }, ], }, ], From 34ee92ac2464c6af177a70fbb2d83e341c88df19 Mon Sep 17 00:00:00 2001 From: wbuezas Date: Tue, 2 Jul 2024 21:46:45 -0300 Subject: [PATCH 02/11] Small change --- src/pages/Ticket/Card/TicketSaleTracking.vue | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/pages/Ticket/Card/TicketSaleTracking.vue b/src/pages/Ticket/Card/TicketSaleTracking.vue index a03f75387..86f391a1d 100644 --- a/src/pages/Ticket/Card/TicketSaleTracking.vue +++ b/src/pages/Ticket/Card/TicketSaleTracking.vue @@ -29,6 +29,7 @@ const itemShelvignsSales = ref([]); const shelvingsOptions = ref([]); const parkingsOptions = ref([]); const saleTrackingUrl = computed(() => `SaleTrackings/${route.params.id}/filter`); +const oldQuantity = ref(null); watch( () => route.params.id, @@ -191,10 +192,12 @@ const showShelving = async (sale) => { const updateQuantity = async (sale) => { try { + if (oldQuantity.value === sale.quantity) return; const params = { quantity: sale.quantity, }; await axios.patch(`ItemShelvingSales/${sale.id}`, params); + oldQuantity.value = null; } catch (error) { console.error(error); } @@ -431,7 +434,7 @@ const clickControled = (sale) => { {{ row.subName }} - + @@ -498,7 +501,7 @@ const clickControled = (sale) => { v-model.number="row.quantity" @keyup.enter="updateQuantity(row)" @blur="updateQuantity(row)" - @focus="edit.oldQuantity = row.quantity" + @focus="oldQuantity = row.quantity" /> From c25b04e07553df5be5c5aa262233347f326d3701 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Wed, 3 Jul 2024 11:48:51 +0200 Subject: [PATCH 03/11] improve QChebox --- src/pages/Ticket/Card/TicketSaleTracking.vue | 27 ++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/pages/Ticket/Card/TicketSaleTracking.vue b/src/pages/Ticket/Card/TicketSaleTracking.vue index 86f391a1d..823fe762f 100644 --- a/src/pages/Ticket/Card/TicketSaleTracking.vue +++ b/src/pages/Ticket/Card/TicketSaleTracking.vue @@ -368,6 +368,7 @@ const clickControled = (sale) => { @@ -378,6 +379,7 @@ const clickControled = (sale) => { @@ -388,6 +390,7 @@ const clickControled = (sale) => { @@ -398,6 +401,7 @@ const clickControled = (sale) => { @@ -408,6 +412,8 @@ const clickControled = (sale) => { @@ -540,3 +546,24 @@ const clickControled = (sale) => { + + From 4a01f1d930b750c82b7ed6979b28a3aa2ad589c4 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Thu, 4 Jul 2024 10:40:11 +0200 Subject: [PATCH 04/11] perf: cleancode --- src/pages/Ticket/Card/TicketSaleTracking.vue | 66 +++++++------------- 1 file changed, 23 insertions(+), 43 deletions(-) diff --git a/src/pages/Ticket/Card/TicketSaleTracking.vue b/src/pages/Ticket/Card/TicketSaleTracking.vue index 823fe762f..858a35e61 100644 --- a/src/pages/Ticket/Card/TicketSaleTracking.vue +++ b/src/pages/Ticket/Card/TicketSaleTracking.vue @@ -246,9 +246,9 @@ const saleTrackingNew = async (sale, stateCode, isChecked) => { try { const params = { saleFk: sale.saleFk, - isChecked: isChecked, + isChecked, quantity: sale.quantity, - stateCode: stateCode, + stateCode, }; await axios.post(`SaleTrackings/new`, params); notify(t('globals.dataSaved'), 'positive'); @@ -257,10 +257,10 @@ const saleTrackingNew = async (sale, stateCode, isChecked) => { } }; -const saleTrackingDel = async (sale, stateCode) => { +const saleTrackingDel = async ({ saleFk }, stateCode) => { try { const params = { - saleFk: sale.saleFk, + saleFk, stateCodes: [stateCode], }; await axios.post(`SaleTrackings/delete`, params); @@ -284,14 +284,8 @@ const clickSaleGroupDetail = async (sale) => { const clickPreviousSelected = (sale) => { try { - if (!sale.isPreviousSelected) { - saleTrackingNew(sale, 'PREVIOUS_PREPARATION', false); - sale.isPreviousSelected = true; - } else { - saleTrackingDel(sale, 'PREVIOUS_PREPARATION'); - sale.isPreviousSelected = false; - sale.isPrevious = false; - } + qCheckBoxController(sale, 'isPreviousSelected'); + if (!sale.isPreviousSelected) sale.isPrevious = false; } catch (error) { console.error(error); } @@ -299,41 +293,28 @@ const clickPreviousSelected = (sale) => { const clickPrevious = (sale) => { try { - if (!sale.isPrevious) { - saleTrackingNew(sale, 'PREVIOUS_PREPARATION', true); - sale.isPrevious = true; - sale.isPreviousSelected = true; - } else { - saleTrackingNew(sale, 'PREVIOUS_PREPARATION', false); - sale.isPrevious = false; - } + qCheckBoxController(sale, 'isPrevious'); + if (sale.isPrevious) sale.isPreviousSelected = true; } catch (error) { console.error(error); } }; -const clickPrepared = (sale) => { +const qCheckBoxController = (sale, action) => { + const STATE_CODES = { + isControled: 'CHECKED', + isPrepared: 'PREPARED', + isPrevious: 'PREVIOUS_PREPARATION', + isPreviousSelected: 'PREVIOUS_PREPARATION', + }; + const stateCode = STATE_CODES[action]; try { - if (!sale.isPrepared) { - saleTrackingNew(sale, 'PREPARED', true); - sale.isPrepared = true; + if (!sale[action]) { + saleTrackingNew(sale, stateCode, true); + sale[action] = true; } else { - saleTrackingDel(sale, 'PREPARED'); - sale.isPrepared = false; - } - } catch (error) { - console.error(error); - } -}; - -const clickControled = (sale) => { - try { - if (!sale.isControled) { - saleTrackingNew(sale, 'CHECKED', true); - sale.isControled = true; - } else { - saleTrackingDel(sale, 'CHECKED'); - sale.isControled = false; + saleTrackingDel(sale, stateCode); + sale[action] = false; } } catch (error) { console.error(error); @@ -403,7 +384,7 @@ const clickControled = (sale) => { color="warning" class="warning" :toggle-indeterminate="false" - @update:model-value="clickPrepared(row)" + @update:model-value="qCheckBoxController(row, 'isPrepared')" > {{ t('ticketSaleTracking.prepared') }} @@ -413,9 +394,8 @@ const clickControled = (sale) => { :model-value="!!row.isControled" color="yellow" class="yellow" - style="stroke: red" :toggle-indeterminate="false" - @update:model-value="clickControled(row)" + @update:model-value="qCheckBoxController(row, 'isControled')" > {{ t('ticketSaleTracking.checked') }} From a9e19309eefa37a48a762e7489059195c3fa187a Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Tue, 9 Jul 2024 09:59:39 +0200 Subject: [PATCH 05/11] fix warning --- src/pages/Ticket/Card/TicketSaleTracking.vue | 6 +++--- src/pages/Ticket/TicketList.vue | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/pages/Ticket/Card/TicketSaleTracking.vue b/src/pages/Ticket/Card/TicketSaleTracking.vue index 858a35e61..367b73952 100644 --- a/src/pages/Ticket/Card/TicketSaleTracking.vue +++ b/src/pages/Ticket/Card/TicketSaleTracking.vue @@ -348,8 +348,8 @@ const qCheckBoxController = (sale, action) => { @@ -532,7 +532,7 @@ $estados: ( info: var(--q-info), warning: var(--q-warning), cyan: #00bcd4, - pink: pink, + transparent: transparent, yellow: #ffeb3b, ); diff --git a/src/pages/Ticket/TicketList.vue b/src/pages/Ticket/TicketList.vue index ae635fb4e..6783065fd 100644 --- a/src/pages/Ticket/TicketList.vue +++ b/src/pages/Ticket/TicketList.vue @@ -11,6 +11,7 @@ import VnLv from 'src/components/ui/VnLv.vue'; import CardList from 'src/components/ui/CardList.vue'; import { useSummaryDialog } from 'src/composables/useSummaryDialog'; import RightMenu from 'src/components/common/RightMenu.vue'; +import { toDate, toCurrency } from 'src/filters'; const router = useRouter(); const { t } = useI18n(); From 4eaab6f4ae8817b63ea6b111900c028db886917f Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Tue, 9 Jul 2024 10:07:22 +0200 Subject: [PATCH 06/11] fix warning when quasar build --- src/pages/Ticket/Card/TicketSaleTracking.vue | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/pages/Ticket/Card/TicketSaleTracking.vue b/src/pages/Ticket/Card/TicketSaleTracking.vue index 367b73952..d519bc2c6 100644 --- a/src/pages/Ticket/Card/TicketSaleTracking.vue +++ b/src/pages/Ticket/Card/TicketSaleTracking.vue @@ -348,8 +348,8 @@ const qCheckBoxController = (sale, action) => { @@ -529,11 +529,11 @@ const qCheckBoxController = (sale, action) => {