From 9b3135fd97909be06b6353d0d32ccb4f975d9d20 Mon Sep 17 00:00:00 2001 From: wbuezas Date: Fri, 24 May 2024 08:18:38 -0300 Subject: [PATCH] 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 @@