diff --git a/src/components/common/VnSelect.vue b/src/components/common/VnSelect.vue index e8083dec2..493f094ce 100644 --- a/src/components/common/VnSelect.vue +++ b/src/components/common/VnSelect.vue @@ -22,6 +22,10 @@ const $props = defineProps({ type: String, default: '', }, + optionFilter: { + type: String, + default: null, + }, url: { type: String, default: '', @@ -59,7 +63,7 @@ const $props = defineProps({ const { t } = useI18n(); const requiredFieldRule = (val) => val ?? t('globals.fieldRequired'); -const { optionLabel, optionValue, options, modelValue } = toRefs($props); +const { optionLabel, optionValue, optionFilter, options, modelValue } = toRefs($props); const myOptions = ref([]); const myOptionsOriginal = ref([]); const vnSelectRef = ref(); @@ -109,9 +113,9 @@ async function fetchFilter(val) { const { fields, sortBy, limit } = $props; let key = optionLabel.value; - if (new RegExp(/\d/g).test(val)) key = optionValue.value; + if (new RegExp(/\d/g).test(val)) key = optionFilter.value ?? optionValue.value; - const where = { [key]: { like: `%${val}%` } }; + const where = { ...{ [key]: { like: `%${val}%` } }, ...$props.where }; return dataRef.value.fetch({ fields, where, order: sortBy, limit }); } diff --git a/src/components/ui/QCalendarMonthWrapper.vue b/src/components/ui/QCalendarMonthWrapper.vue index 24255ea1a..3ecea89c2 100644 --- a/src/components/ui/QCalendarMonthWrapper.vue +++ b/src/components/ui/QCalendarMonthWrapper.vue @@ -108,7 +108,7 @@ const containerClasses = computed(() => { font-size: 13px; &:hover { - background-color: var(--vn-accent-color); + background-color: var(--vn-label-color); cursor: pointer; } } diff --git a/src/composables/useArrayData.js b/src/composables/useArrayData.js index 326ddff5d..e2465f5ba 100644 --- a/src/composables/useArrayData.js +++ b/src/composables/useArrayData.js @@ -130,7 +130,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/ZoneClosingTable.vue b/src/pages/Zone/ZoneClosingTable.vue new file mode 100644 index 000000000..ce0c91af7 --- /dev/null +++ b/src/pages/Zone/ZoneClosingTable.vue @@ -0,0 +1,112 @@ + + + + + diff --git a/src/pages/Zone/ZoneDeliveryCalendar.vue b/src/pages/Zone/ZoneDeliveryCalendar.vue new file mode 100644 index 000000000..96a62086e --- /dev/null +++ b/src/pages/Zone/ZoneDeliveryCalendar.vue @@ -0,0 +1,192 @@ + + + + + diff --git a/src/pages/Zone/ZoneDeliveryDays.vue b/src/pages/Zone/ZoneDeliveryDays.vue index 485500dba..d6ce70f6d 100644 --- a/src/pages/Zone/ZoneDeliveryDays.vue +++ b/src/pages/Zone/ZoneDeliveryDays.vue @@ -1 +1,257 @@ - + + + + + diff --git a/src/pages/Zone/ZoneDeliveryPanel.vue b/src/pages/Zone/ZoneDeliveryPanel.vue new file mode 100644 index 000000000..c754d484f --- /dev/null +++ b/src/pages/Zone/ZoneDeliveryPanel.vue @@ -0,0 +1,149 @@ + + + diff --git a/src/pages/Zone/locale/en.yml b/src/pages/Zone/locale/en.yml index 746d3f2e7..cda2daca7 100644 --- a/src/pages/Zone/locale/en.yml +++ b/src/pages/Zone/locale/en.yml @@ -3,7 +3,7 @@ zone: zones: Zone zonesList: Zones zoneCreate: Create zone - deliveryList: Delivery days + deliveryDays: Delivery days upcomingList: Upcoming deliveries list: clone: Clone @@ -40,3 +40,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: Price + preview: Preview + zones: Zones diff --git a/src/pages/Zone/locale/es.yml b/src/pages/Zone/locale/es.yml index d9266b150..3b658ab02 100644 --- a/src/pages/Zone/locale/es.yml +++ b/src/pages/Zone/locale/es.yml @@ -3,7 +3,7 @@ zone: zones: Zonas zonesList: Zonas zoneCreate: Nueva zona - deliveryList: Días de entrega + deliveryDays: Días de entrega upcomingList: Próximos repartos list: clone: Clonar @@ -40,3 +40,21 @@ summary: filterPanel: name: Nombre agencyModeFk: Agencia +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 + preview: Vista previa + price: Precio + zones: Zonas +Search zones: Buscar zonas +You can search by zone reference: Puedes buscar por referencia de la zona diff --git a/src/router/modules/zone.js b/src/router/modules/zone.js index 9c917c301..a7dd1dbb5 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', 'ZoneHistory', 'ZoneLocations'], }, 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, }; });