From 9b9e482fa76e1b75af4c0c677ac801e7c947f8bf Mon Sep 17 00:00:00 2001 From: wbuezas Date: Thu, 9 May 2024 08:21:30 -0300 Subject: [PATCH] Zone list and Zone summary --- src/pages/Zone/Card/ZoneSummary.vue | 119 ++++++++++--------- src/pages/Zone/Delivery/ZoneDeliveryList.vue | 2 +- src/pages/Zone/Upcoming/ZoneUpcomingList.vue | 2 +- src/pages/Zone/ZoneCreate.vue | 12 +- src/pages/Zone/ZoneFilterPanel.vue | 34 +++--- src/pages/Zone/ZoneList.vue | 88 +++++++++++--- src/pages/Zone/locale/en.yml | 55 +++++---- src/pages/Zone/locale/es.yml | 55 +++++---- src/router/modules/zone.js | 11 +- 9 files changed, 243 insertions(+), 135 deletions(-) diff --git a/src/pages/Zone/Card/ZoneSummary.vue b/src/pages/Zone/Card/ZoneSummary.vue index 90241c9a3..b39d2aaab 100644 --- a/src/pages/Zone/Card/ZoneSummary.vue +++ b/src/pages/Zone/Card/ZoneSummary.vue @@ -2,14 +2,16 @@ import { ref, onMounted, computed } from 'vue'; import { useRoute } from 'vue-router'; import { useI18n } from 'vue-i18n'; -import { dashIfEmpty } from 'src/filters'; -import { getUrl } from 'src/composables/getUrl'; + import VnLv from 'src/components/ui/VnLv.vue'; -import VnLinkPhone from 'src/components/ui/VnLinkPhone.vue'; import CardSummary from 'components/ui/CardSummary.vue'; -import VnUserLink from 'src/components/ui/VnUserLink.vue'; import VnTitle from 'src/components/common/VnTitle.vue'; +import { getUrl } from 'src/composables/getUrl'; +import { toCurrency } from 'filters/index'; +import { toTimeFormat } from 'src/filters/date'; +import axios from 'axios'; + const route = useRoute(); const { t } = useI18n(); @@ -23,77 +25,84 @@ const $props = defineProps({ const entityId = computed(() => $props.id || route.params.id); const zoneUrl = ref(); -onMounted(async () => { - zoneUrl.value = (await getUrl('')) + `zone/${entityId.value}/`; +const filter = computed(() => { + const filter = { + include: { + relation: 'agencyMode', + fields: ['name'], + }, + where: { + id: route.params.id, + }, + }; + return filter; }); -const filter = computed(() => { +const columns = computed(() => [ + { + label: t('summary.name'), + name: 'name', + field: 'warehouse', + align: 'left', + format: (val) => val.name, + }, +]); +const warehouses = ref([]); + +const getWarehouses = async () => { const params = { filter: { include: { - relation: 'agencyMode', + relation: 'warehouse', fields: ['name'], }, - where: { - id: entityId.value, - }, }, }; - return params; + + const { data } = await axios.get(`Zones/${entityId.value}/warehouses`, { params }); + warehouses.value = data; +}; + +onMounted(async () => { + zoneUrl.value = (await getUrl('')) + `zone/${entityId.value}/`; + await getWarehouses(); });