From a1fde3f6452a32868b8a0498e4d8bb855c07570f Mon Sep 17 00:00:00 2001 From: wbuezas Date: Fri, 24 May 2024 15:25:00 -0300 Subject: [PATCH] WIP --- .../Zone/Card/ZoneEventExclusionForm.vue | 172 +++++++++++++- .../Zone/Card/ZoneEventInclusionForm.vue | 29 +-- src/pages/Zone/Card/ZoneEvents.vue | 29 +-- src/pages/Zone/Card/ZoneLocationsTree.vue | 215 ++++++++++++++++++ src/pages/Zone/ZoneDeliveryCalendar.vue | 7 + src/pages/Zone/locale/en.yml | 1 + src/pages/Zone/locale/es.yml | 1 + 7 files changed, 411 insertions(+), 43 deletions(-) create mode 100644 src/pages/Zone/Card/ZoneLocationsTree.vue diff --git a/src/pages/Zone/Card/ZoneEventExclusionForm.vue b/src/pages/Zone/Card/ZoneEventExclusionForm.vue index aee6ddb00..f75745c7a 100644 --- a/src/pages/Zone/Card/ZoneEventExclusionForm.vue +++ b/src/pages/Zone/Card/ZoneEventExclusionForm.vue @@ -1 +1,171 @@ - + + + diff --git a/src/pages/Zone/Card/ZoneEventInclusionForm.vue b/src/pages/Zone/Card/ZoneEventInclusionForm.vue index a8b35267e..daecac6ef 100644 --- a/src/pages/Zone/Card/ZoneEventInclusionForm.vue +++ b/src/pages/Zone/Card/ZoneEventInclusionForm.vue @@ -9,6 +9,7 @@ import FormPopup from 'components/FormPopup.vue'; import VnInputDate from 'src/components/common/VnInputDate.vue'; import VnWeekdayPicker from 'src/components/common/VnWeekdayPicker.vue'; import VnInputTime from 'components/common/VnInputTime.vue'; + import { useArrayData } from 'src/composables/useArrayData'; import { useWeekdayStore } from 'src/stores/useWeekdayStore'; import { useVnConfirm } from 'composables/useVnConfirm'; @@ -28,6 +29,10 @@ const props = defineProps({ type: Boolean, default: true, }, + isExclusion: { + type: Boolean, + default: true, + }, }); const emit = defineEmits(['onSubmit', 'closeForm']); @@ -103,13 +108,10 @@ const refetchEvents = async () => { }; onMounted(() => { - console.log('props.event', props.event); if (props.event) { eventInclusionFormData.value = { ...props.event }; eventType.value = props.event?.type || 'day'; } else if (props.date) eventInclusionFormData.value.dated = props.date; - - console.log('eventInclusionFormData', eventInclusionFormData.value); }); @@ -124,8 +126,6 @@ onMounted(() => { > - - -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 1dcfc516a..bc02e7ab5 100644 --- a/src/pages/Zone/Card/ZoneEvents.vue +++ b/src/pages/Zone/Card/ZoneEvents.vue @@ -179,30 +179,17 @@ const step = (direction) => { date.value = _date; }; -const openEventIncludeForm = ({ date, isNewMode, event }) => { +const openForm = ({ date, isNewMode, event, isExclusion }) => { zoneEventsFormProps.date = date; zoneEventsFormProps.isNewMode = isNewMode; zoneEventsFormProps.event = event; + zoneEventsFormProps.isExclusion = isExclusion; 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 = () => { showZoneEventForm.value = false; - zoneEventsFormProps.date = null; + zoneEventsFormProps.value = {}; }; onMounted(async () => { @@ -243,7 +230,7 @@ onUnmounted(() => arrayData.destroy()); :last-day="lastDay" :events="events" v-model:formModeName="formModeName" - @open-zone-form="openEventIncludeForm" + @open-zone-form="openForm" /> @@ -277,7 +264,7 @@ onUnmounted(() => arrayData.destroy()); :exclusions="exclusions" :days-map="days" :form-mode-name="formModeName" - @open-zone-form="handleEventModeOpen" + @open-zone-form="openForm" /> @@ -287,7 +274,11 @@ onUnmounted(() => arrayData.destroy()); v-bind="zoneEventsFormProps" @close-form="onZoneEventFormClose()" /> - + diff --git a/src/pages/Zone/Card/ZoneLocationsTree.vue b/src/pages/Zone/Card/ZoneLocationsTree.vue new file mode 100644 index 000000000..3057c5dff --- /dev/null +++ b/src/pages/Zone/Card/ZoneLocationsTree.vue @@ -0,0 +1,215 @@ + + + + + diff --git a/src/pages/Zone/ZoneDeliveryCalendar.vue b/src/pages/Zone/ZoneDeliveryCalendar.vue index ffddd0e66..64651743a 100644 --- a/src/pages/Zone/ZoneDeliveryCalendar.vue +++ b/src/pages/Zone/ZoneDeliveryCalendar.vue @@ -93,6 +93,12 @@ const getEventByTimestamp = ({ year, month, day }) => { ); }; +const eventIsAnyExclusion = ({ year, month, day }) => { + if (!event) return false; + const stamp = new Date(year, month - 1, day).getTime(); + return !!props.exclusions[stamp] || !!props.geoExclusions[stamp]; +}; + const getEventAttrs = ({ year, month, day }) => { const stamp = new Date(year, month - 1, day).getTime(); @@ -128,6 +134,7 @@ const handleDateClick = (timestamp) => { date, isNewMode: !event, event: event && event.length > 0 ? event[0] : null, + isExclusion: eventIsAnyExclusion(timestamp), }); }; diff --git a/src/pages/Zone/locale/en.yml b/src/pages/Zone/locale/en.yml index 7f2b12680..6113dde08 100644 --- a/src/pages/Zone/locale/en.yml +++ b/src/pages/Zone/locale/en.yml @@ -81,6 +81,7 @@ eventsPanel: deleteSubtitle: Are you sure you want to continue? eventsExclusionForm: addExclusion: Add exclusion + editExclusion: Edit exclusion day: Day all: All specificLocations: Specific locations diff --git a/src/pages/Zone/locale/es.yml b/src/pages/Zone/locale/es.yml index ad33705b6..a9fd45704 100644 --- a/src/pages/Zone/locale/es.yml +++ b/src/pages/Zone/locale/es.yml @@ -83,6 +83,7 @@ eventsPanel: deleteSubtitle: ¿Seguro que quieres continuar? eventsExclusionForm: addExclusion: Añadir exclusión + editExclusion: Editar exclusión day: Día all: Todo specificLocations: Localizaciones concretas