From 8c744fac5abae73d8edf2543f87a4e465afb8d5d Mon Sep 17 00:00:00 2001 From: Jon Date: Tue, 9 Jul 2024 12:51:01 +0200 Subject: [PATCH] refactor: refs #7354 Zone migration changes --- src/pages/Zone/Card/ZoneDescriptor.vue | 1 - .../Zone/Card/ZoneDescriptorMenuItems.vue | 2 +- .../Zone/Card/ZoneEventExclusionForm.vue | 1 + src/pages/Zone/Card/ZoneEvents.vue | 4 +- src/pages/Zone/ZoneDeliveryPanel.vue | 8 +- src/pages/Zone/ZoneList.vue | 191 +++++++----------- src/pages/Zone/ZoneMain.vue | 2 +- src/pages/Zone/ZoneUpcoming.vue | 8 +- src/pages/Zone/locale/en.yml | 2 + src/pages/Zone/locale/es.yml | 2 + 10 files changed, 91 insertions(+), 130 deletions(-) diff --git a/src/pages/Zone/Card/ZoneDescriptor.vue b/src/pages/Zone/Card/ZoneDescriptor.vue index 602fefde35..04fb22ba5a 100644 --- a/src/pages/Zone/Card/ZoneDescriptor.vue +++ b/src/pages/Zone/Card/ZoneDescriptor.vue @@ -52,7 +52,6 @@ const setData = (entity) => { :filter="filter" @on-fetch="setData" data-key="zoneData" - :summary="$attrs" > import { useI18n } from 'vue-i18n'; import { useRouter } from 'vue-router'; -import { onMounted, computed } from 'vue'; +import { computed, ref } from 'vue'; +import axios from 'axios'; + import { toCurrency } from 'src/filters'; - -import VnPaginate from 'src/components/ui/VnPaginate.vue'; -import ZoneSummary from 'src/pages/Zone/Card/ZoneSummary.vue'; - -import { useSummaryDialog } from 'src/composables/useSummaryDialog'; import { toTimeFormat } from 'src/filters/date'; import { useVnConfirm } from 'composables/useVnConfirm'; import useNotify from 'src/composables/useNotify.js'; -import { useStateStore } from 'stores/useStateStore'; -import axios from 'axios'; -import RightMenu from 'src/components/common/RightMenu.vue'; -import ZoneFilterPanel from './ZoneFilterPanel.vue'; +import { useSummaryDialog } from 'src/composables/useSummaryDialog'; +import ZoneSummary from 'src/pages/Zone/Card/ZoneSummary.vue'; +import VnTable from 'src/components/VnTable/VnTable.vue'; -const stateStore = useStateStore(); const { t } = useI18n(); const router = useRouter(); const { notify } = useNotify(); const { viewSummary } = useSummaryDialog(); const { openConfirmationModal } = useVnConfirm(); - -const redirectToZoneSummary = (event, { id }) => { - router.push({ name: 'ZoneSummary', params: { id } }); -}; +const tableRef = ref(); +const tableFilter = ref({ + include: [ + { + relation: 'agencyMode', + scope: { + fields: ['id', 'name'], + }, + }, + ], +}); const columns = computed(() => [ { - name: 'ID', - label: t('list.id'), - field: (row) => row.id, - sortable: true, align: 'left', + name: 'id', + label: t('list.id'), + chip: { + condition: () => true, + }, + isId: true, }, { + align: 'left', name: 'name', label: t('list.name'), - field: (row) => row.name, - sortable: true, - align: 'left', + isTitle: true, }, { - name: 'agency', + align: 'left', + name: 'agencyModeFk', label: t('list.agency'), - field: (row) => row?.agencyMode?.name, - sortable: true, - align: 'left', + cardVisible: true, + component: 'select', + attrs: { + url: 'agencyModes', + fields: ['id', 'name'], + }, + columnField: { + component: null, + }, + format: (row) => row?.agencyMode?.name, }, { - name: 'close', + align: 'left', + name: 'hour', label: t('list.close'), - field: (row) => (row?.hour ? toTimeFormat(row?.hour) : '-'), - sortable: true, - align: 'left', + cardVisible: true, + format: (row) => toTimeFormat(row.hour), }, { + align: 'left', name: 'price', label: t('list.price'), - field: (row) => (row?.price ? toCurrency(row.price) : '-'), - sortable: true, - align: 'left', + cardVisible: true, + format: (row) => toCurrency(row.price), }, { - name: 'actions', - label: '', - sortable: false, align: 'right', + name: 'tableActions', + actions: [ + { + title: t('ZoneSummary'), + icon: 'preview', + action: (row) => viewSummary(row.id, ZoneSummary), + }, + { + title: t('globals.clone'), + icon: 'vn:clone', + action: (row) => handleClone(row.id), + isPrimary: true, + }, + ], }, ]); @@ -83,88 +105,23 @@ const handleClone = (id) => { () => clone(id) ); }; -onMounted(() => (stateStore.rightDrawer = true)); diff --git a/src/pages/Zone/ZoneMain.vue b/src/pages/Zone/ZoneMain.vue index 68ff9a5d18..4bfda15576 100644 --- a/src/pages/Zone/ZoneMain.vue +++ b/src/pages/Zone/ZoneMain.vue @@ -39,7 +39,7 @@ const exprBuilder = (param, value) => {