From 84845b795837895f72a98ad179062eae3baf19e9 Mon Sep 17 00:00:00 2001 From: wbuezas Date: Tue, 21 May 2024 09:50:36 -0300 Subject: [PATCH 01/24] WIP --- src/components/common/VnCard.vue | 4 + src/components/ui/VnSearchbar.vue | 14 +- src/pages/Zone/Card/ZoneCalendar.vue | 256 ++++++++++++++++++++++ src/pages/Zone/Card/ZoneCalendarPanel.vue | 149 +++++++++++++ src/pages/Zone/Card/ZoneCard.vue | 30 +-- src/pages/Zone/locale/en.yml | 1 + src/pages/Zone/locale/es.yml | 1 + src/router/modules/zone.js | 17 +- 8 files changed, 449 insertions(+), 23 deletions(-) create mode 100644 src/pages/Zone/Card/ZoneCalendarPanel.vue diff --git a/src/components/common/VnCard.vue b/src/components/common/VnCard.vue index 58cb12708..e836badec 100644 --- a/src/components/common/VnCard.vue +++ b/src/components/common/VnCard.vue @@ -20,6 +20,8 @@ const props = defineProps({ searchUrl: { type: String, default: undefined }, searchbarLabel: { type: String, default: '' }, searchbarInfo: { type: String, default: '' }, + searchCustomRouteRedirect: { type: String, default: undefined }, + searchRedirect: { type: Boolean, default: false }, }); const stateStore = useStateStore(); @@ -62,6 +64,8 @@ watchEffect(() => { :url="props.searchUrl" :label="props.searchbarLabel" :info="props.searchbarInfo" + :custom-route-redirect-name="searchCustomRouteRedirect" + :redirect="searchRedirect" /> diff --git a/src/components/ui/VnSearchbar.vue b/src/components/ui/VnSearchbar.vue index 38dcf97d1..e5b2f02d2 100644 --- a/src/components/ui/VnSearchbar.vue +++ b/src/components/ui/VnSearchbar.vue @@ -1,5 +1,5 @@ + + + + diff --git a/src/pages/Zone/Card/ZoneCalendarPanel.vue b/src/pages/Zone/Card/ZoneCalendarPanel.vue new file mode 100644 index 000000000..c754d484f --- /dev/null +++ b/src/pages/Zone/Card/ZoneCalendarPanel.vue @@ -0,0 +1,149 @@ + + + diff --git a/src/pages/Zone/Card/ZoneCard.vue b/src/pages/Zone/Card/ZoneCard.vue index 6451fe00c..4c0da8d87 100644 --- a/src/pages/Zone/Card/ZoneCard.vue +++ b/src/pages/Zone/Card/ZoneCard.vue @@ -5,38 +5,30 @@ import { computed } from 'vue'; import VnCard from 'components/common/VnCard.vue'; import ZoneDescriptor from './ZoneDescriptor.vue'; -import VnSearchbar from 'src/components/ui/VnSearchbar.vue'; - -import { useStateStore } from 'stores/useStateStore'; const { t } = useI18n(); -const stateStore = useStateStore(); const route = useRoute(); const routeName = computed(() => route.name); +const customRouteRedirectName = computed(() => { + if (routeName.value === 'ZoneLocations') return null; + return routeName.value; +}); const searchBarDataKeys = { ZoneWarehouses: 'ZoneWarehouses', ZoneSummary: 'ZoneSummary', + ZoneLocations: 'ZoneLocations', + ZoneCalendar: 'ZoneCalendar', }; diff --git a/src/pages/Zone/locale/en.yml b/src/pages/Zone/locale/en.yml index dd79f6ac4..363393996 100644 --- a/src/pages/Zone/locale/en.yml +++ b/src/pages/Zone/locale/en.yml @@ -7,6 +7,7 @@ zone: deliveryDays: Delivery days upcomingList: Upcoming deliveries warehouses: Warehouses + calendar: Calendar list: clone: Clone id: Id diff --git a/src/pages/Zone/locale/es.yml b/src/pages/Zone/locale/es.yml index 43b636d4f..4c8eb6116 100644 --- a/src/pages/Zone/locale/es.yml +++ b/src/pages/Zone/locale/es.yml @@ -7,6 +7,7 @@ zone: deliveryDays: Días de entrega upcomingList: Próximos repartos warehouses: Almacenes + calendar: Calendario list: clone: Clonar id: Id diff --git a/src/router/modules/zone.js b/src/router/modules/zone.js index b79c430e5..a32ba2c49 100644 --- a/src/router/modules/zone.js +++ b/src/router/modules/zone.js @@ -12,7 +12,13 @@ export default { redirect: { name: 'ZoneMain' }, menus: { main: ['ZoneList', 'ZoneDeliveryDays', 'ZoneUpcomingList'], - card: ['ZoneBasicData', 'ZoneWarehouses', 'ZoneHistory', 'ZoneLocations'], + card: [ + 'ZoneBasicData', + 'ZoneWarehouses', + 'ZoneHistory', + 'ZoneLocations', + 'ZoneCalendar', + ], }, children: [ { @@ -110,6 +116,15 @@ export default { }, component: () => import('src/pages/Zone/Card/ZoneLog.vue'), }, + { + name: 'ZoneCalendar', + path: 'events', + meta: { + title: 'calendar', + icon: 'vn:calendar', + }, + component: () => import('src/pages/Zone/Card/ZoneCalendar.vue'), + }, ], }, ], From 790e69f65959cb18e8c2453fdffff54c47bba82b Mon Sep 17 00:00:00 2001 From: wbuezas Date: Wed, 22 May 2024 08:08:43 -0300 Subject: [PATCH 02/24] WIP --- src/css/app.scss | 2 +- src/pages/Zone/Card/ZoneCalendarPanel.vue | 149 ------------- src/pages/Zone/Card/ZoneCard.vue | 2 +- .../Card/{ZoneCalendar.vue => ZoneEvents.vue} | 25 ++- src/pages/Zone/Card/ZoneEventsPanel.vue | 197 ++++++++++++++++++ src/pages/Zone/locale/en.yml | 14 ++ src/pages/Zone/locale/es.yml | 14 ++ src/router/modules/zone.js | 6 +- src/stores/useWeekdayStore.js | 17 ++ 9 files changed, 267 insertions(+), 159 deletions(-) delete mode 100644 src/pages/Zone/Card/ZoneCalendarPanel.vue rename src/pages/Zone/Card/{ZoneCalendar.vue => ZoneEvents.vue} (92%) create mode 100644 src/pages/Zone/Card/ZoneEventsPanel.vue diff --git a/src/css/app.scss b/src/css/app.scss index 2e524e693..0b66ee38d 100644 --- a/src/css/app.scss +++ b/src/css/app.scss @@ -76,7 +76,7 @@ select:-webkit-autofill { } .color-vn-label { - color: var(--vn-label); + color: var(--vn-label-color); } .color-vn-text { diff --git a/src/pages/Zone/Card/ZoneCalendarPanel.vue b/src/pages/Zone/Card/ZoneCalendarPanel.vue deleted file mode 100644 index c754d484f..000000000 --- a/src/pages/Zone/Card/ZoneCalendarPanel.vue +++ /dev/null @@ -1,149 +0,0 @@ - - - diff --git a/src/pages/Zone/Card/ZoneCard.vue b/src/pages/Zone/Card/ZoneCard.vue index 4c0da8d87..fc427c8cd 100644 --- a/src/pages/Zone/Card/ZoneCard.vue +++ b/src/pages/Zone/Card/ZoneCard.vue @@ -18,7 +18,7 @@ const searchBarDataKeys = { ZoneWarehouses: 'ZoneWarehouses', ZoneSummary: 'ZoneSummary', ZoneLocations: 'ZoneLocations', - ZoneCalendar: 'ZoneCalendar', + ZoneEvents: 'ZoneEvents', }; - + diff --git a/src/pages/Zone/Card/ZoneEventsPanel.vue b/src/pages/Zone/Card/ZoneEventsPanel.vue new file mode 100644 index 000000000..88bf6eaa7 --- /dev/null +++ b/src/pages/Zone/Card/ZoneEventsPanel.vue @@ -0,0 +1,197 @@ + + + + + diff --git a/src/pages/Zone/locale/en.yml b/src/pages/Zone/locale/en.yml index 363393996..ed07861f8 100644 --- a/src/pages/Zone/locale/en.yml +++ b/src/pages/Zone/locale/en.yml @@ -65,3 +65,17 @@ warehouses: deleteSubtitle: Are you sure you want to continue? warehouse: Warehouse add: Add +eventsPanel: + editMode: Edit mode + include: Include + exclude: Exclude + events: Events + closing: Closing + travelingDays: Traveling days + price: Price + bonus: Bonus + m3Max: Max m³ + everyday: Everyday + delete: Delete + deleteTitle: This item will be deleted + deleteSubtitle: Are you sure you want to continue? diff --git a/src/pages/Zone/locale/es.yml b/src/pages/Zone/locale/es.yml index 4c8eb6116..5c4addaf8 100644 --- a/src/pages/Zone/locale/es.yml +++ b/src/pages/Zone/locale/es.yml @@ -67,3 +67,17 @@ warehouses: deleteSubtitle: ¿Seguro que quieres continuar? warehouse: Almacén add: Añadir +eventsPanel: + editMode: Modo edición + include: Incluir + exclude: Excluir + events: Eventos + closing: Cierre + travelingDays: Días de viaje + price: Precio + bonus: Bonificación + m3Max: Meidida máxima + everyday: Todos los días + delete: Eliminar + deleteTitle: Este elemento será eliminado + deleteSubtitle: ¿Seguro que quieres continuar? diff --git a/src/router/modules/zone.js b/src/router/modules/zone.js index a32ba2c49..5979049a3 100644 --- a/src/router/modules/zone.js +++ b/src/router/modules/zone.js @@ -17,7 +17,7 @@ export default { 'ZoneWarehouses', 'ZoneHistory', 'ZoneLocations', - 'ZoneCalendar', + 'ZoneEvents', ], }, children: [ @@ -117,13 +117,13 @@ export default { component: () => import('src/pages/Zone/Card/ZoneLog.vue'), }, { - name: 'ZoneCalendar', + name: 'ZoneEvents', path: 'events', meta: { title: 'calendar', icon: 'vn:calendar', }, - component: () => import('src/pages/Zone/Card/ZoneCalendar.vue'), + component: () => import('src/pages/Zone/Card/ZoneEvents.vue'), }, ], }, diff --git a/src/stores/useWeekdayStore.js b/src/stores/useWeekdayStore.js index ac17356ae..33acaa09e 100644 --- a/src/stores/useWeekdayStore.js +++ b/src/stores/useWeekdayStore.js @@ -73,6 +73,22 @@ export const useWeekdayStore = defineStore('weekdayStore', () => { return locales; }); + const getLocalesMap = computed(() => { + const locales = {}; + for (let code of localeOrder.es) { + const weekDay = weekdaysMap[code]; + const locale = t(`weekdays.${weekdaysMap[code].code}`); + const obj = { + ...weekDay, + locale, + localeChar: locale.substr(0, 1), + localeAbr: locale.substr(0, 3), + }; + locales[weekDay.code] = obj; + } + return locales; + }); + const getLocaleMonths = computed(() => { const locales = []; for (let code of monthCodes) { @@ -115,5 +131,6 @@ export const useWeekdayStore = defineStore('weekdayStore', () => { monthCodes, getLocaleMonths, fromSet, + getLocalesMap, }; }); From 9b3135fd97909be06b6353d0d32ccb4f975d9d20 Mon Sep 17 00:00:00 2001 From: wbuezas Date: Fri, 24 May 2024 08:18:38 -0300 Subject: [PATCH 03/24] WIP --- src/components/common/VnWeekdayPicker.vue | 37 +++ .../Zone/Card/ZoneEventExclusionForm.vue | 1 + .../Zone/Card/ZoneEventInclusionForm.vue | 214 ++++++++++++++++++ src/pages/Zone/Card/ZoneEvents.vue | 50 +++- src/pages/Zone/Card/ZoneEventsPanel.vue | 64 ++++-- src/pages/Zone/ZoneDeliveryCalendar.vue | 35 ++- src/pages/Zone/ZoneDeliveryDays.vue | 1 + src/pages/Zone/locale/en.yml | 19 ++ src/pages/Zone/locale/es.yml | 19 ++ src/stores/useWeekdayStore.js | 23 ++ 10 files changed, 437 insertions(+), 26 deletions(-) create mode 100644 src/components/common/VnWeekdayPicker.vue create mode 100644 src/pages/Zone/Card/ZoneEventExclusionForm.vue create mode 100644 src/pages/Zone/Card/ZoneEventInclusionForm.vue diff --git a/src/components/common/VnWeekdayPicker.vue b/src/components/common/VnWeekdayPicker.vue new file mode 100644 index 000000000..bbeb3d9ba --- /dev/null +++ b/src/components/common/VnWeekdayPicker.vue @@ -0,0 +1,37 @@ + + + diff --git a/src/pages/Zone/Card/ZoneEventExclusionForm.vue b/src/pages/Zone/Card/ZoneEventExclusionForm.vue new file mode 100644 index 000000000..aee6ddb00 --- /dev/null +++ b/src/pages/Zone/Card/ZoneEventExclusionForm.vue @@ -0,0 +1 @@ + diff --git a/src/pages/Zone/Card/ZoneEventInclusionForm.vue b/src/pages/Zone/Card/ZoneEventInclusionForm.vue new file mode 100644 index 000000000..b8ad5b4fe --- /dev/null +++ b/src/pages/Zone/Card/ZoneEventInclusionForm.vue @@ -0,0 +1,214 @@ + + + + + +en: + title: New bank entity + subtitle: Please, ensure you put the correct data! + name: Name + swift: Swift + country: Country + id: Entity code +es: + title: Nueva entidad bancaria + subtitle: ¡Por favor, asegúrate de poner los datos correctos! + name: Nombre + swift: Swift + country: País + id: Código de la entidad + diff --git a/src/pages/Zone/Card/ZoneEvents.vue b/src/pages/Zone/Card/ZoneEvents.vue index 12b2387bb..4bd028981 100644 --- a/src/pages/Zone/Card/ZoneEvents.vue +++ b/src/pages/Zone/Card/ZoneEvents.vue @@ -4,11 +4,14 @@ import { useI18n } from 'vue-i18n'; import ZoneEventsPanel from './ZoneEventsPanel.vue'; import ZoneDeliveryCalendar from '../ZoneDeliveryCalendar.vue'; +import ZoneEventInclusionForm from './ZoneEventInclusionForm.vue'; +import ZoneEventExclusionForm from './ZoneEventExclusionForm.vue'; import { useStateStore } from 'stores/useStateStore'; import { useWeekdayStore } from 'src/stores/useWeekdayStore'; import { useArrayData } from 'src/composables/useArrayData'; import { nextTick } from 'vue'; +import { reactive } from 'vue'; const { t } = useI18n(); const stateStore = useStateStore(); @@ -24,11 +27,16 @@ const days = ref({}); const exclusions = ref({}); const geoExclusions = ref({}); const events = ref([]); +const formModeName = ref('include'); +const showZoneEventForm = ref(false); +const zoneEventsFormProps = reactive({ + isNewMode: true, + date: null, +}); + const arrayData = useArrayData('ZoneEvents'); const { store } = arrayData; -// const urlPath = computed(() => `Zones/${route.params.id}/events`); - const refreshEvents = () => { days.value = {}; if (!data.value) return; @@ -171,8 +179,29 @@ const step = (direction) => { date.value = _date; }; -const openEditMode = (mode) => { - console.log('openEditMode', mode); +const openEventIncludeForm = ({ date, isNewMode, event }) => { + zoneEventsFormProps.date = date; + zoneEventsFormProps.isNewMode = isNewMode; + zoneEventsFormProps.event = event; + showZoneEventForm.value = true; + console.log('zoneEventsFormProps: ', zoneEventsFormProps); +}; + +const handleEventModeOpen = ({ date, isNewMode, event }) => { + if (formModeName.value === 'include') + openEventIncludeForm({ date, isNewMode, event }); + else openEventExcludeForm({ date, isNewMode }); +}; + +const openEventExcludeForm = ({ date, isNewMode }) => { + // zoneEventsFormProps.date = date; + // zoneEventsFormProps.isNewMode = isNewMode; + showZoneEventForm.value = true; + // console.log('zoneEventsFormProps: ', zoneEventsFormProps); +}; + +const onZoneEventFormClose = () => { + zoneEventsFormProps.date = null; }; onMounted(async () => { @@ -212,7 +241,8 @@ onUnmounted(() => arrayData.destroy()); :first-day="firstDay" :last-day="lastDay" :events="events" - @open-edit-mode="openEditMode" + v-model:formModeName="formModeName" + @open-zone-form="openEventIncludeForm" /> @@ -245,9 +275,19 @@ onUnmounted(() => arrayData.destroy()); :geo-exclusions="geoExclusions" :exclusions="exclusions" :days-map="days" + :form-mode-name="formModeName" + @open-zone-form="handleEventModeOpen" /> + + + + diff --git a/src/pages/Zone/Card/ZoneEventsPanel.vue b/src/pages/Zone/Card/ZoneEventsPanel.vue index 88bf6eaa7..ba2b4c87f 100644 --- a/src/pages/Zone/Card/ZoneEventsPanel.vue +++ b/src/pages/Zone/Card/ZoneEventsPanel.vue @@ -1,12 +1,12 @@ - - From 7cd2bf231911dc22214d72cdc26380c9adf86c0d Mon Sep 17 00:00:00 2001 From: wbuezas Date: Mon, 27 May 2024 14:44:44 -0300 Subject: [PATCH 14/24] watch fix --- src/pages/Zone/Card/ZoneLocationsTree.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/Zone/Card/ZoneLocationsTree.vue b/src/pages/Zone/Card/ZoneLocationsTree.vue index 8b96bfae5..4f594cb03 100644 --- a/src/pages/Zone/Card/ZoneLocationsTree.vue +++ b/src/pages/Zone/Card/ZoneLocationsTree.vue @@ -134,7 +134,7 @@ watch(storeData, async (val) => { for (let n of state.get('Tree')) { await fetchNodeLeaves(n); } - expanded.value = [null]; + expanded.value = [null, ...fetchedNodeKeys]; } previousExpandedNodes.value = new Set(expanded.value); }); From b783adfc318afb7f578e858d213689851cda1850 Mon Sep 17 00:00:00 2001 From: wbuezas Date: Tue, 28 May 2024 09:30:13 -0300 Subject: [PATCH 15/24] several changes --- src/components/common/VnWeekdayPicker.vue | 12 ++++----- .../Zone/Card/ZoneEventExclusionForm.vue | 10 +++---- .../Zone/Card/ZoneEventInclusionForm.vue | 6 ++--- src/pages/Zone/Card/ZoneEventsPanel.vue | 7 ++--- src/pages/Zone/Card/ZoneLocationsTree.vue | 27 ++++++++++++++++--- src/pages/Zone/ZoneCalendarGrid.vue | 2 +- 6 files changed, 42 insertions(+), 22 deletions(-) diff --git a/src/components/common/VnWeekdayPicker.vue b/src/components/common/VnWeekdayPicker.vue index bbeb3d9ba..10e6b2c4d 100644 --- a/src/components/common/VnWeekdayPicker.vue +++ b/src/components/common/VnWeekdayPicker.vue @@ -1,5 +1,5 @@