From ddf42d9659d2fc0678885921ec58d38293e4dc3c Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Fri, 20 Sep 2024 13:46:07 +0200 Subject: [PATCH] feat: update VnLocation instances --- .../Customer/Card/CustomerFiscalData.vue | 5 +- src/pages/Customer/CustomerCreate.vue | 2 +- src/pages/Customer/CustomerList.vue | 52 ++++++++++++++++--- .../components/CustomerAddressCreate.vue | 6 +-- .../components/CustomerAddressEdit.vue | 26 ++++++---- .../Supplier/Card/SupplierAddressesCreate.vue | 13 ++++- .../Supplier/Card/SupplierFiscalData.vue | 25 ++++++++- src/pages/Worker/WorkerList.vue | 4 +- 8 files changed, 106 insertions(+), 27 deletions(-) diff --git a/src/pages/Customer/Card/CustomerFiscalData.vue b/src/pages/Customer/Card/CustomerFiscalData.vue index 5cc656bb3..a66fd8712 100644 --- a/src/pages/Customer/Card/CustomerFiscalData.vue +++ b/src/pages/Customer/Card/CustomerFiscalData.vue @@ -93,8 +93,9 @@ function handleLocation(data, location) { diff --git a/src/pages/Customer/CustomerCreate.vue b/src/pages/Customer/CustomerCreate.vue index 041c92d17..79da63283 100644 --- a/src/pages/Customer/CustomerCreate.vue +++ b/src/pages/Customer/CustomerCreate.vue @@ -86,7 +86,7 @@ function handleLocation(data, location) { diff --git a/src/pages/Customer/CustomerList.vue b/src/pages/Customer/CustomerList.vue index 0dc7f09be..f6758bf4e 100644 --- a/src/pages/Customer/CustomerList.vue +++ b/src/pages/Customer/CustomerList.vue @@ -2,6 +2,7 @@ import { ref, computed, markRaw } from 'vue'; import { useI18n } from 'vue-i18n'; import { useRouter } from 'vue-router'; +import VnSelect from 'src/components/common/VnSelect.vue'; import VnTable from 'components/VnTable/VnTable.vue'; import VnLocation from 'src/components/common/VnLocation.vue'; import VnSearchbar from 'components/ui/VnSearchbar.vue'; @@ -69,7 +70,7 @@ const columns = computed(() => [ optionFilter: 'firstName', useLike: false, }, - create: true, + create: false, columnField: { component: null, }, @@ -195,6 +196,8 @@ const columns = computed(() => [ component: 'select', attrs: { url: 'BusinessTypes', + fields: ['code', 'description'], + sortBy: 'description ASC ', optionLabel: 'description', optionValue: 'code', }, @@ -353,12 +356,13 @@ const columns = computed(() => [ { title: t('Client ticket list'), icon: 'vn:ticket', - action: redirectToCreateView, + action: redirectToTicketsList, isPrimary: true, }, { title: t('components.smartCard.viewSummary'), icon: 'preview', + isPrimary: true, action: (row) => viewSummary(row.id, CustomerSummary), }, ], @@ -366,11 +370,12 @@ const columns = computed(() => [ ]); const { viewSummary } = useSummaryDialog(); -const redirectToCreateView = (row) => { +const redirectToTicketsList = (row) => { router.push({ name: 'TicketList', + query: { - params: JSON.stringify({ + table: JSON.stringify({ clientFk: row.id, }), }, @@ -395,10 +400,10 @@ function handleLocation(data, location) { + + + + + diff --git a/src/pages/Customer/components/CustomerAddressCreate.vue b/src/pages/Customer/components/CustomerAddressCreate.vue index 30e4b21d0..7826c3579 100644 --- a/src/pages/Customer/components/CustomerAddressCreate.vue +++ b/src/pages/Customer/components/CustomerAddressCreate.vue @@ -57,12 +57,12 @@ function handleLocation(data, location) { diff --git a/src/pages/Supplier/Card/SupplierAddressesCreate.vue b/src/pages/Supplier/Card/SupplierAddressesCreate.vue index da6549a24..0feceb74a 100644 --- a/src/pages/Supplier/Card/SupplierAddressesCreate.vue +++ b/src/pages/Supplier/Card/SupplierAddressesCreate.vue @@ -21,6 +21,7 @@ const newAddressForm = reactive({ provinceFk: null, phone: null, mobile: null, + province: null, }); const onDataSaved = () => { @@ -84,7 +85,17 @@ function handleLocation(data, location) { diff --git a/src/pages/Supplier/Card/SupplierFiscalData.vue b/src/pages/Supplier/Card/SupplierFiscalData.vue index bcce93e53..396cf15a2 100644 --- a/src/pages/Supplier/Card/SupplierFiscalData.vue +++ b/src/pages/Supplier/Card/SupplierFiscalData.vue @@ -51,6 +51,23 @@ function handleLocation(data, location) { :url="`Suppliers/${route.params.id}`" :url-update="`Suppliers/${route.params.id}/updateFiscalData`" model="supplier" + :filter="{ + fields: ['id', 'name', 'city', 'postCode', 'countryFk', 'provinceFk'], + include: [ + { + relation: 'province', + scope: { + fields: ['id', 'name'], + }, + }, + { + relation: 'country', + scope: { + fields: ['id', 'name'], + }, + }, + ], + }" auto-load :clear-store-on-unmount="false" > @@ -130,7 +147,13 @@ function handleLocation(data, location) { diff --git a/src/pages/Worker/WorkerList.vue b/src/pages/Worker/WorkerList.vue index 91d96a162..6b3b117b6 100644 --- a/src/pages/Worker/WorkerList.vue +++ b/src/pages/Worker/WorkerList.vue @@ -263,8 +263,8 @@ async function autofillBic(worker) { @@ -311,7 +311,7 @@ async function autofillBic(worker) { option-label="name" option-value="id" hide-selected - :roles-allowed-to-create="['salesAssistant', 'hr']" + :acls="[{ model: 'BankEntity', props: '*', accessType: 'WRITE' }]" :disable="data.isFreelance" @update:model-value="autofillBic(data)" :filter-options="['bic', 'name']"