diff --git a/src/components/common/VnLocation.vue b/src/components/common/VnLocation.vue
index 8256ec5b0..c1b921915 100644
--- a/src/components/common/VnLocation.vue
+++ b/src/components/common/VnLocation.vue
@@ -2,21 +2,68 @@
import CreateNewPostcode from 'src/components/CreateNewPostcodeForm.vue';
import VnSelectDialog from 'components/common/VnSelectDialog.vue';
import { useI18n } from 'vue-i18n';
-
+import { ref } from 'vue';
const { t } = useI18n();
-const value = defineModel({ type: [String, Number, Object] });
+const emit = defineEmits(['update:model-value', 'update:options']);
+
+const props = defineProps({
+ location: {
+ type: Object,
+ default: null,
+ },
+});
+const formatLocation = (obj, properties) => {
+ const parts = properties.map((prop) => {
+ if (typeof prop === 'string') {
+ return obj[prop];
+ } else if (typeof prop === 'function') {
+ return prop(obj);
+ }
+ return null;
+ });
+
+ const filteredParts = parts.filter(
+ (part) => part !== null && part !== undefined && part !== ''
+ );
+
+ return filteredParts.join(', ');
+};
+
+const locationProperties = [
+ 'postcode',
+ (obj) =>
+ obj.city
+ ? `${obj.city}${obj.province?.name ? `(${obj.province.name})` : ''}`
+ : null,
+ (obj) => obj.country?.name,
+];
+
+const modelValue = ref(
+ props.location ? formatLocation(props.location, locationProperties) : null
+);
+
+const handleModelValue = (data) => {
+ emit('update:model-value', data);
+};
function showLabel(data) {
- return `${data.code} - ${data.town}(${data.province}), ${data.country}`;
+ const dataProperties = [
+ 'code',
+ (obj) => (obj.town ? `${obj.town}(${obj.province})` : null),
+ 'country',
+ ];
+ return formatLocation(data, dataProperties);
}
- (value = newValue)" />
+ {
+ modelValue = newValue;
+ emit('update:model-value', newValue);
+ }
+ "
+ />
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) {
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) {
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) {
+
+
+
+
+
+
+
+ {{ scope.opt?.name }}
+ {{ scope.opt?.nickname }},
+ {{ scope.opt?.code }}
+
+
+
+
+
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) {
- (agencyModes = data)"
auto-load
url="AgencyModes/isActive"
/>
- (incoterms = data)" auto-load url="Incoterms" />
+ (incoterms = data)" auto-load url="Incoterms" />
handleLocation(data, location)"
/>
diff --git a/src/pages/Customer/components/CustomerAddressEdit.vue b/src/pages/Customer/components/CustomerAddressEdit.vue
index 7a4c44014..82a190ae1 100644
--- a/src/pages/Customer/components/CustomerAddressEdit.vue
+++ b/src/pages/Customer/components/CustomerAddressEdit.vue
@@ -113,18 +113,18 @@ function handleLocation(data, location) {
- (agencyModes = data)"
auto-load
url="AgencyModes/isActive"
/>
- (incoterms = data)" auto-load url="Incoterms" />
- (incoterms = data)" auto-load url="Incoterms" />
+ (customsAgents = data)"
auto-load
url="CustomsAgents"
/>
-
+
handleLocation(data, location)"
>
@@ -267,16 +272,17 @@ function handleLocation(data, location) {
-
{{ t('Add note') }}
-
+
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) {
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) {
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) {
handleLocation(data, location)"
:disable="data.isFreelance"
>
@@ -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']"