From 9956561e4c907a39d7199646c05dc4e34555bf58 Mon Sep 17 00:00:00 2001 From: jorgep Date: Mon, 24 Jun 2024 16:17:21 +0200 Subject: [PATCH 01/20] chore: refs #7300 wip: create reset function --- src/composables/useArrayData.js | 5 ++++ src/stores/useArrayDataStore.js | 41 +++++++++++++++++++++------------ 2 files changed, 31 insertions(+), 15 deletions(-) diff --git a/src/composables/useArrayData.js b/src/composables/useArrayData.js index f97ade7bf..385cb6045 100644 --- a/src/composables/useArrayData.js +++ b/src/composables/useArrayData.js @@ -130,6 +130,10 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) { delete store[option]; } + function reset(opts = []) { + if (arrayDataStore.get(key)) arrayDataStore.reset(key, opts); + } + function cancelRequest() { if (canceller) { canceller.abort(); @@ -245,5 +249,6 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) { updateStateParams, isLoading, deleteOption, + reset, }; } diff --git a/src/stores/useArrayDataStore.js b/src/stores/useArrayDataStore.js index ebe32f8d0..0fe16d075 100644 --- a/src/stores/useArrayDataStore.js +++ b/src/stores/useArrayDataStore.js @@ -3,36 +3,47 @@ import { defineStore } from 'pinia'; export const useArrayDataStore = defineStore('arrayDataStore', () => { const state = ref({}); + const defaultOpts = { + filter: {}, + userFilter: {}, + userParams: {}, + url: '', + limit: 10, + skip: 0, + order: '', + data: ref(), + isLoading: false, + userParamsChanged: false, + exprBuilder: null, + searchUrl: 'params', + navigate: null, + }; function get(key) { return state.value[key]; } function set(key) { - state.value[key] = { - filter: {}, - userFilter: {}, - userParams: {}, - url: '', - limit: 10, - skip: 0, - order: '', - data: ref(), - isLoading: false, - userParamsChanged: false, - exprBuilder: null, - searchUrl: 'params', - navigate: null, - }; + state.value[key] = defaultOpts; } function clear(key) { delete state.value[key]; } + function reset(key, opts = []) { + let obj = state.value[key]; + if (!opts.length) obj = defaultOpts; + else + for (const opt in opts) { + if (Object.hasOwn(obj, opt)) obj[opt] = defaultOpts[opt]; + } + } + return { get, set, clear, + reset, }; }); From ad950f33c68fb6e18c65a974e482e80c771f3089 Mon Sep 17 00:00:00 2001 From: wbuezas Date: Wed, 26 Jun 2024 08:27:36 -0300 Subject: [PATCH 02/20] WIP --- src/i18n/locale/en.yml | 1 + src/i18n/locale/es.yml | 1 + src/pages/Ticket/Card/TicketExpedition.vue | 244 +++++++++++++++++++++ src/pages/Ticket/locale/en.yml | 10 + src/pages/Ticket/locale/es.yml | 10 + src/router/modules/ticket.js | 25 ++- 6 files changed, 286 insertions(+), 5 deletions(-) create mode 100644 src/pages/Ticket/Card/TicketExpedition.vue diff --git a/src/i18n/locale/en.yml b/src/i18n/locale/en.yml index d121dfb66..849f00c88 100644 --- a/src/i18n/locale/en.yml +++ b/src/i18n/locale/en.yml @@ -446,6 +446,7 @@ ticket: sale: Sale ticketAdvance: Advance tickets futureTickets: Future tickets + expedition: Expedition list: nickname: Nickname state: State diff --git a/src/i18n/locale/es.yml b/src/i18n/locale/es.yml index 3654f4a72..6c722e43d 100644 --- a/src/i18n/locale/es.yml +++ b/src/i18n/locale/es.yml @@ -445,6 +445,7 @@ ticket: sale: Lineas del pedido ticketAdvance: Adelantar tickets futureTickets: Tickets a futuro + expedition: Expedición list: nickname: Alias state: Estado diff --git a/src/pages/Ticket/Card/TicketExpedition.vue b/src/pages/Ticket/Card/TicketExpedition.vue new file mode 100644 index 000000000..280e82b8a --- /dev/null +++ b/src/pages/Ticket/Card/TicketExpedition.vue @@ -0,0 +1,244 @@ + + + diff --git a/src/pages/Ticket/locale/en.yml b/src/pages/Ticket/locale/en.yml index a89671a0c..04822df3e 100644 --- a/src/pages/Ticket/locale/en.yml +++ b/src/pages/Ticket/locale/en.yml @@ -80,3 +80,13 @@ futureTickets: moveTicketSuccess: Tickets moved successfully! searchInfo: Search future tickets by date futureTicket: Future tickets +expedition: + id: Expedition + item: Item + name: Name + packageType: Package type + counter: Counter + externalId: externalId + created: Created + state: State + historyAction: Status log diff --git a/src/pages/Ticket/locale/es.yml b/src/pages/Ticket/locale/es.yml index ce52e18ba..7cbbd02bd 100644 --- a/src/pages/Ticket/locale/es.yml +++ b/src/pages/Ticket/locale/es.yml @@ -79,6 +79,16 @@ ticketSale: shipped: F. Envío agency: Agencia address: Consignatario +expedition: + id: Expedición + item: Artículo + name: Nombre + packageType: Package type + counter: Contador + externalId: externalId + created: Fecha creación + state: Estado + historyAction: Historial de estados card: search: Buscar tickets searchInfo: Buscar tickets por identificador o alias diff --git a/src/router/modules/ticket.js b/src/router/modules/ticket.js index 9c105be32..878396604 100644 --- a/src/router/modules/ticket.js +++ b/src/router/modules/ticket.js @@ -12,7 +12,13 @@ export default { redirect: { name: 'TicketMain' }, menus: { main: ['TicketList', 'TicketAdvance', 'TicketFuture'], - card: ['TicketBoxing', 'TicketSms', 'TicketSale', 'TicketLog'], + card: [ + 'TicketBoxing', + 'TicketSms', + 'TicketSale', + 'TicketLog', + 'TicketExpedition', + ], }, children: [ { @@ -94,13 +100,13 @@ export default { component: () => import('src/pages/Ticket/Card/TicketSale.vue'), }, { - path: 'boxing', - name: 'TicketBoxing', + path: 'expedition', + name: 'TicketExpedition', meta: { - title: 'boxing', + title: 'expedition', icon: 'vn:package', }, - component: () => import('src/pages/Ticket/Card/TicketBoxing.vue'), + component: () => import('src/pages/Ticket/Card/TicketExpedition.vue'), }, { path: 'sms', @@ -120,6 +126,15 @@ export default { }, component: () => import('src/pages/Ticket/Card/TicketLog.vue'), }, + { + path: 'boxing', + name: 'TicketBoxing', + meta: { + title: 'boxing', + icon: 'vn:science', + }, + component: () => import('src/pages/Ticket/Card/TicketBoxing.vue'), + }, ], }, ], From 053059997adb9ab687d9c55dc523fea5ae5912b8 Mon Sep 17 00:00:00 2001 From: wbuezas Date: Thu, 27 Jun 2024 08:37:48 -0300 Subject: [PATCH 03/20] WIP --- src/pages/Ticket/Card/ExpeditionNewTicket.vue | 78 +++++ src/pages/Ticket/Card/TicketExpedition.vue | 284 +++++++++++++++--- src/pages/Ticket/locale/en.yml | 8 + src/pages/Ticket/locale/es.yml | 8 + 4 files changed, 344 insertions(+), 34 deletions(-) create mode 100644 src/pages/Ticket/Card/ExpeditionNewTicket.vue diff --git a/src/pages/Ticket/Card/ExpeditionNewTicket.vue b/src/pages/Ticket/Card/ExpeditionNewTicket.vue new file mode 100644 index 000000000..da775a368 --- /dev/null +++ b/src/pages/Ticket/Card/ExpeditionNewTicket.vue @@ -0,0 +1,78 @@ + + + diff --git a/src/pages/Ticket/Card/TicketExpedition.vue b/src/pages/Ticket/Card/TicketExpedition.vue index 280e82b8a..002dc9b22 100644 --- a/src/pages/Ticket/Card/TicketExpedition.vue +++ b/src/pages/Ticket/Card/TicketExpedition.vue @@ -1,16 +1,17 @@ + + + + + + +es: + by: por + diff --git a/src/router/modules/ticket.js b/src/router/modules/ticket.js index 1e635470b..db61cd405 100644 --- a/src/router/modules/ticket.js +++ b/src/router/modules/ticket.js @@ -23,6 +23,7 @@ export default { 'TicketTracking', 'TicketVolume', 'TicketNotes', + 'TicketPicture', ], }, children: [ @@ -142,6 +143,15 @@ export default { }, component: () => import('src/pages/Ticket/Card/TicketLog.vue'), }, + { + path: 'picture', + name: 'TicketPicture', + meta: { + title: 'pictures', + icon: 'vn:photo', + }, + component: () => import('src/pages/Ticket/Card/TicketPicture.vue'), + }, { path: 'boxing', name: 'TicketBoxing', From aec43cb1c5ab555d623300bbb072d4917b733384 Mon Sep 17 00:00:00 2001 From: Jon Date: Thu, 4 Jul 2024 12:51:46 +0200 Subject: [PATCH 11/20] refactor: arrayData & VnCard refactor --- src/components/common/VnCard.vue | 2 +- src/composables/useArrayData.js | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/components/common/VnCard.vue b/src/components/common/VnCard.vue index c81bcd8e2..17fa74317 100644 --- a/src/components/common/VnCard.vue +++ b/src/components/common/VnCard.vue @@ -39,7 +39,7 @@ const arrayData = useArrayData(props.dataKey, { onBeforeMount(async () => { if (!props.baseUrl) arrayData.store.filter.where = { id: route.params.id }; - await arrayData.fetch({ append: false }); + await arrayData.fetch({ append: false, updateRouter: false }); }); if (props.baseUrl) { diff --git a/src/composables/useArrayData.js b/src/composables/useArrayData.js index db59b7d78..8fda4b15d 100644 --- a/src/composables/useArrayData.js +++ b/src/composables/useArrayData.js @@ -84,8 +84,10 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) { } Object.assign(filter, store.userFilter, exprFilter); - Object.assign(store.filter, filter); - const params = { filter: store.filter }; + const where = Object.assign(filter?.where ?? {}, store.filter?.where ?? {}); + Object.assign(filter, store.filter); + filter.where = where; + const params = { filter }; Object.assign(params, userParams); params.filter.skip = store.skip; @@ -143,7 +145,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) { } async function addFilter({ filter, params }) { - if (filter) store.userFilter = Object.assign(store.userFilter, filter); + if (filter) store.filter = filter; let userParams = { ...store.userParams, ...params }; userParams = sanitizerParams(userParams, store?.exprBuilder); @@ -157,7 +159,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) { } async function addFilterWhere(where) { - const storedFilter = { ...store.userFilter }; + const storedFilter = { ...store.filter }; if (!storedFilter?.where) storedFilter.where = {}; where = { ...storedFilter.where, ...where }; await addFilter({ filter: { where } }); @@ -187,7 +189,6 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) { store.page += 1; await fetch({ append: true }); - updateStateParams(); } async function refresh() { From 699f09cfcff954e047b7f2a59be5851a8b2a50d9 Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 4 Jul 2024 13:17:58 +0200 Subject: [PATCH 12/20] fix: where empty --- src/composables/useArrayData.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/composables/useArrayData.js b/src/composables/useArrayData.js index 8fda4b15d..e5461c872 100644 --- a/src/composables/useArrayData.js +++ b/src/composables/useArrayData.js @@ -84,7 +84,9 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) { } Object.assign(filter, store.userFilter, exprFilter); - const where = Object.assign(filter?.where ?? {}, store.filter?.where ?? {}); + let where; + if (filter?.where || store.filter?.where) + where = Object.assign(filter?.where ?? {}, store.filter?.where ?? {}); Object.assign(filter, store.filter); filter.where = where; const params = { filter }; From c6ae1aec36877095e899926503942dd64c8555e1 Mon Sep 17 00:00:00 2001 From: carlossa Date: Thu, 4 Jul 2024 13:41:43 +0200 Subject: [PATCH 13/20] refs #7366 fix travel --- src/pages/Travel/Card/TravelDescriptor.vue | 3 --- src/pages/Travel/TravelList.vue | 6 +++++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/pages/Travel/Card/TravelDescriptor.vue b/src/pages/Travel/Card/TravelDescriptor.vue index b74761b37..60929031d 100644 --- a/src/pages/Travel/Card/TravelDescriptor.vue +++ b/src/pages/Travel/Card/TravelDescriptor.vue @@ -54,7 +54,6 @@ const entityId = computed(() => { }); const data = ref(useCardDescription()); -const setData = (entity) => (data.value = useCardDescription(entity.ref, entity.id));