diff --git a/src/pages/Zone/ZoneList.vue b/src/pages/Zone/ZoneList.vue index 2a5d290ef..e4a1774fe 100644 --- a/src/pages/Zone/ZoneList.vue +++ b/src/pages/Zone/ZoneList.vue @@ -17,6 +17,7 @@ import VnInputTime from 'src/components/common/VnInputTime.vue'; import RightMenu from 'src/components/common/RightMenu.vue'; import ZoneFilterPanel from './ZoneFilterPanel.vue'; import ZoneSearchbar from './Card/ZoneSearchbar.vue'; +import FetchData from 'src/components/FetchData.vue'; const { t } = useI18n(); const router = useRouter(); @@ -25,6 +26,7 @@ const { viewSummary } = useSummaryDialog(); const { openConfirmationModal } = useVnConfirm(); const tableRef = ref(); const warehouseOptions = ref([]); +const validAddresses = ref([]); const tableFilter = { include: [ @@ -34,6 +36,32 @@ const tableFilter = { fields: ['id', 'name'], }, }, + { + relation: 'address', + scope: { + fields: ['id', 'nickname', 'provinceFk', 'postalCode'], + include: [ + { + relation: 'province', + scope: { + fields: ['id', 'name'], + }, + }, + { + relation: 'postcode', + scope: { + fields: ['code', 'townFk'], + include: { + relation: 'town', + scope: { + fields: ['id', 'name'], + }, + }, + }, + }, + ], + }, + }, ], }; @@ -95,7 +123,14 @@ const columns = computed(() => [ label: t('list.close'), cardVisible: true, format: (row) => toTimeFormat(row.hour), - hidden: true, + columnFilter: false, + }, + { + align: 'left', + name: 'addressFk', + label: t('list.addressFk'), + cardVisible: true, + columnFilter: false, }, { align: 'right', @@ -129,9 +164,27 @@ const handleClone = (id) => { () => clone(id) ); }; + +function showValidAddresses(row) { + if (row.addressFk) { + const isValid = validAddresses.value.some( + (address) => address.addressFk === row.addressFk + ); + if (isValid) + return `${row.address?.nickname}, + ${row.address?.postcode?.town?.name} (${row.address?.province?.name})`; + else return '-'; + } + return '-'; +}