diff --git a/src/pages/Customer/Card/CustomerConsignees.vue b/src/pages/Customer/Card/CustomerConsignees.vue index 553ab641b..bf61ea302 100644 --- a/src/pages/Customer/Card/CustomerConsignees.vue +++ b/src/pages/Customer/Card/CustomerConsignees.vue @@ -5,7 +5,6 @@ import { useRoute, useRouter } from 'vue-router'; import FetchData from 'components/FetchData.vue'; import VnPaginate from 'src/components/ui/VnPaginate.vue'; -import VnLv from 'src/components/ui/VnLv.vue'; const { t } = useI18n(); const route = useRoute(); @@ -13,6 +12,38 @@ const router = useRouter(); const provincesLocation = ref([]); +const consigneeFilter = { + fields: [ + 'id', + 'isDefaultAddress', + 'isActive', + 'nickname', + 'street', + 'city', + 'provinceFk', + 'phone', + 'mobile', + 'isEqualizated', + 'isLogifloraAllowed', + 'postalCode', + ], + order: ['isDefaultAddress DESC', 'isActive DESC', 'nickname ASC'], + include: [ + { + relation: 'observations', + scope: { + include: 'observationType', + }, + }, + { + relation: 'province', + scope: { + fields: ['id', 'name'], + }, + }, + ], +}; + const setProvince = (provinceFk) => { const result = provincesLocation.value.filter( (province) => province.id === provinceFk @@ -24,8 +55,14 @@ const toCustomerConsigneeCreate = () => { router.push({ name: 'CustomerConsigneeCreate' }); }; -const toCustomerConsigneeEdit = () => { - router.push({ name: 'CustomerConsigneeEdit' }); +const toCustomerConsigneeEdit = (consigneeId) => { + router.push({ + name: 'CustomerConsigneeEdit', + params: { + id: route.params.id, + consigneeId, + }, + }); }; @@ -42,6 +79,7 @@ const toCustomerConsigneeEdit = () => { :url="`Clients/${route.params.id}/addresses`" order="id" auto-load + :filter="consigneeFilter" >