From 9304b511bce405a1c9036401e87fb47ddec1347d Mon Sep 17 00:00:00 2001 From: wbuezas Date: Mon, 13 May 2024 10:14:36 -0300 Subject: [PATCH 1/6] Zone delivery --- src/pages/Zone/Card/ZoneSummary.vue | 2 +- src/pages/Zone/ZoneClosingTable.vue | 111 +++++++++++ src/pages/Zone/ZoneDeliveryCalendar.vue | 197 +++++++++++++++++++ src/pages/Zone/ZoneDeliveryDays.vue | 243 +++++++++++++++++++++++- src/pages/Zone/ZoneDeliveryPanel.vue | 158 +++++++++++++++ src/pages/Zone/locale/en.yml | 18 +- src/pages/Zone/locale/es.yml | 19 +- src/router/modules/zone.js | 11 +- src/stores/useWeekdayStore.js | 22 +++ 9 files changed, 774 insertions(+), 7 deletions(-) create mode 100644 src/pages/Zone/ZoneClosingTable.vue create mode 100644 src/pages/Zone/ZoneDeliveryCalendar.vue create mode 100644 src/pages/Zone/ZoneDeliveryPanel.vue diff --git a/src/pages/Zone/Card/ZoneSummary.vue b/src/pages/Zone/Card/ZoneSummary.vue index b39d2aaab..d46282c10 100644 --- a/src/pages/Zone/Card/ZoneSummary.vue +++ b/src/pages/Zone/Card/ZoneSummary.vue @@ -32,7 +32,7 @@ const filter = computed(() => { fields: ['name'], }, where: { - id: route.params.id, + id: entityId, }, }; return filter; diff --git a/src/pages/Zone/ZoneClosingTable.vue b/src/pages/Zone/ZoneClosingTable.vue new file mode 100644 index 000000000..ec8ad48c6 --- /dev/null +++ b/src/pages/Zone/ZoneClosingTable.vue @@ -0,0 +1,111 @@ + + + + + diff --git a/src/pages/Zone/ZoneDeliveryCalendar.vue b/src/pages/Zone/ZoneDeliveryCalendar.vue new file mode 100644 index 000000000..7403d86a3 --- /dev/null +++ b/src/pages/Zone/ZoneDeliveryCalendar.vue @@ -0,0 +1,197 @@ + + + + + diff --git a/src/pages/Zone/ZoneDeliveryDays.vue b/src/pages/Zone/ZoneDeliveryDays.vue index 485500dba..3535eefec 100644 --- a/src/pages/Zone/ZoneDeliveryDays.vue +++ b/src/pages/Zone/ZoneDeliveryDays.vue @@ -1 +1,242 @@ - + + + + + diff --git a/src/pages/Zone/ZoneDeliveryPanel.vue b/src/pages/Zone/ZoneDeliveryPanel.vue new file mode 100644 index 000000000..ff2a4c5d5 --- /dev/null +++ b/src/pages/Zone/ZoneDeliveryPanel.vue @@ -0,0 +1,158 @@ + + + diff --git a/src/pages/Zone/locale/en.yml b/src/pages/Zone/locale/en.yml index d0a22ebcd..61eff5cb2 100644 --- a/src/pages/Zone/locale/en.yml +++ b/src/pages/Zone/locale/en.yml @@ -2,7 +2,7 @@ zone: pageTitles: zones: Zone zonesList: Zones - deliveryList: Delivery days + deliveryDays: Delivery days upcomingList: Upcoming deliveries list: clone: Clone @@ -38,3 +38,19 @@ summary: filterPanel: name: Name agencyModeFk: Agency +deliveryPanel: + pickup: Pick up + delivery: Delivery + postcode: Postcode + agency: Agency + warehouse: Warehouse + query: Query + noEventsWarning: No service for the specified zone +zoneClosingTable: + id: Id + name: Name + agency: Agency + closing: Closing + price: Precio + preview: Preview + zones: Zones diff --git a/src/pages/Zone/locale/es.yml b/src/pages/Zone/locale/es.yml index ad740d5f7..7f5df416c 100644 --- a/src/pages/Zone/locale/es.yml +++ b/src/pages/Zone/locale/es.yml @@ -2,7 +2,7 @@ zone: pageTitles: zones: Zonas zonesList: Zonas - deliveryList: Días de entrega + deliveryDays: Días de entrega upcomingList: Próximos repartos list: clone: Clonar @@ -38,5 +38,18 @@ summary: filterPanel: name: Nombre agencyModeFk: Agencia -Search zones: Buscar zonas -You can search by zone reference: Puedes buscar por referencia de la zona +deliveryPanel: + pickup: Recogida + delivery: Entrega + postcode: Código postal + agency: Agencia + warehouse: Almacén + query: Consultar + noEventsWarning: No hay servicio para la zona especificada +ZoneClosingTable: + id: Id + name: Nombre + agency: Agencia + closing: Cierre + price: Precio + zones: Zonas diff --git a/src/router/modules/zone.js b/src/router/modules/zone.js index d39ed82d0..b6e2822fb 100644 --- a/src/router/modules/zone.js +++ b/src/router/modules/zone.js @@ -11,7 +11,7 @@ export default { component: RouterView, redirect: { name: 'ZoneMain' }, menus: { - main: ['ZoneList', 'ZoneDeliveryList', 'ZoneUpcomingList'], + main: ['ZoneList', 'ZoneDeliveryDays', 'ZoneUpcomingList'], card: ['ZoneBasicData'], }, children: [ @@ -30,6 +30,15 @@ export default { }, component: () => import('src/pages/Zone/ZoneList.vue'), }, + { + path: 'delivery-days', + name: 'ZoneDeliveryDays', + meta: { + title: 'deliveryDays', + icon: 'vn:calendar', + }, + component: () => import('src/pages/Zone/ZoneDeliveryDays.vue'), + }, { path: 'create', name: 'ZoneCreate', diff --git a/src/stores/useWeekdayStore.js b/src/stores/useWeekdayStore.js index a7b0496c6..ac17356ae 100644 --- a/src/stores/useWeekdayStore.js +++ b/src/stores/useWeekdayStore.js @@ -85,6 +85,27 @@ export const useWeekdayStore = defineStore('weekdayStore', () => { return locales; }); + /** + * Transforms weekday set into an array whose indexes are weekday index + * with selected days set to %true. + * + * @param {String} weekDays Weekday codes separated by commas + * @return {Array} Array with selected days set to %true + */ + const fromSet = (_weekDays) => { + let wdays = []; + + if (_weekDays) { + let codes = _weekDays.split(','); + for (let code of codes) { + let data = weekdaysMap[code]; + if (data) wdays[data.index] = true; + } + } + + return wdays; + }; + return { initStore, weekdaysMap, @@ -93,5 +114,6 @@ export const useWeekdayStore = defineStore('weekdayStore', () => { weekdays, monthCodes, getLocaleMonths, + fromSet, }; }); From cd8095d3b892a4bc01b187076396917e03e3456b Mon Sep 17 00:00:00 2001 From: wbuezas Date: Wed, 15 May 2024 09:39:15 -0300 Subject: [PATCH 2/6] Last changes --- src/composables/useArrayData.js | 3 ++- src/pages/Zone/Card/ZoneDescriptor.vue | 1 - src/pages/Zone/ZoneClosingTable.vue | 3 ++- src/pages/Zone/ZoneDeliveryCalendar.vue | 4 ---- src/pages/Zone/ZoneDeliveryDays.vue | 16 +++++++++++-- src/pages/Zone/ZoneDeliveryPanel.vue | 32 ++++++++++++++++++------- src/pages/Zone/locale/en.yml | 2 +- src/pages/Zone/locale/es.yml | 3 ++- 8 files changed, 44 insertions(+), 20 deletions(-) diff --git a/src/composables/useArrayData.js b/src/composables/useArrayData.js index 525cf6e6b..fcaa40ebf 100644 --- a/src/composables/useArrayData.js +++ b/src/composables/useArrayData.js @@ -127,7 +127,8 @@ export function useArrayData(key, userOptions) { store.filter = {}; if (params) store.userParams = Object.assign({}, params); - await fetch({ append: false }); + const response = await fetch({ append: false }); + return response; } async function addFilter({ filter, params }) { diff --git a/src/pages/Zone/Card/ZoneDescriptor.vue b/src/pages/Zone/Card/ZoneDescriptor.vue index 8f0aa9e07..aee6174a3 100644 --- a/src/pages/Zone/Card/ZoneDescriptor.vue +++ b/src/pages/Zone/Card/ZoneDescriptor.vue @@ -73,7 +73,6 @@ const setData = (entity) => { -->