HOTFIX: #6943 CustomerList form salesPersons options #790
|
@ -203,7 +203,10 @@ const setData = (entity) => (data.value = useCardDescription(entity?.name, entit
|
||||||
table: JSON.stringify({
|
table: JSON.stringify({
|
||||||
clientFk: entity.id,
|
clientFk: entity.id,
|
||||||
}),
|
}),
|
||||||
createForm: JSON.stringify({ clientFk: entity.id }),
|
createForm: JSON.stringify({
|
||||||
|
clientFk: entity.id,
|
||||||
|
addressId: entity.defaultAddressFk,
|
||||||
|
}),
|
||||||
},
|
},
|
||||||
}"
|
}"
|
||||||
size="md"
|
size="md"
|
||||||
|
|
|
@ -141,25 +141,19 @@ const columns = computed(() => [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
const formInitialData = {
|
|
||||||
active: true,
|
|
||||||
addressId: null,
|
|
||||||
clientFk: null,
|
|
||||||
};
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
if (!route.query.createForm) return;
|
if (!route.query.createForm) return;
|
||||||
const clientId = route.query.createForm;
|
const clientId = route.query.createForm;
|
||||||
const id = JSON.parse(clientId);
|
const id = JSON.parse(clientId);
|
||||||
fetchClientAddress(id.clientFk, formInitialData);
|
fetchClientAddress(id.clientFk);
|
||||||
});
|
});
|
||||||
async function fetchClientAddress(id, formData) {
|
async function fetchClientAddress(id, formData = {}) {
|
||||||
const { data } = await axios.get(`Clients/${id}`, {
|
const { data } = await axios.get(`Clients/${id}`, {
|
||||||
params: { filter: { include: { relation: 'addresses' } } },
|
params: { filter: { include: { relation: 'addresses' } } },
|
||||||
});
|
});
|
||||||
addressesList.value = data.addresses;
|
addressesList.value = data.addresses;
|
||||||
formData.addressId = data.defaultAddressFk;
|
formData.addressId = data.defaultAddressFk;
|
||||||
fetchAgencies(formData);
|
fetchAgencies(formData);
|
||||||
return formData.addressId;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function fetchAgencies({ landed, addressId }) {
|
async function fetchAgencies({ landed, addressId }) {
|
||||||
|
@ -188,7 +182,6 @@ const getDateColor = (date) => {
|
||||||
<OrderFilter data-key="OrderList" />
|
<OrderFilter data-key="OrderList" />
|
||||||
</template>
|
</template>
|
||||||
</RightMenu>
|
</RightMenu>
|
||||||
|
|
||||||
<VnTable
|
<VnTable
|
||||||
ref="tableRef"
|
ref="tableRef"
|
||||||
data-key="OrderList"
|
data-key="OrderList"
|
||||||
|
@ -200,7 +193,11 @@ const getDateColor = (date) => {
|
||||||
onDataSaved: (url) => {
|
onDataSaved: (url) => {
|
||||||
tableRef.redirect(url);
|
tableRef.redirect(url);
|
||||||
},
|
},
|
||||||
formInitialData,
|
formInitialData: {
|
||||||
|
active: true,
|
||||||
|
addressId: null,
|
||||||
|
clientFk: null,
|
||||||
|
},
|
||||||
}"
|
}"
|
||||||
:user-params="{ showEmpty: false }"
|
:user-params="{ showEmpty: false }"
|
||||||
:right-search="false"
|
:right-search="false"
|
||||||
|
@ -227,20 +224,12 @@ const getDateColor = (date) => {
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
<template #more-create-dialog="{ data }">
|
<template #more-create-dialog="{ data }">
|
||||||
{{ formInitialData }}
|
|
||||||
{{ data }}
|
|
||||||
<VnSelect
|
<VnSelect
|
||||||
url="Clients"
|
url="Clients"
|
||||||
:include="{ relation: 'addresses' }"
|
:include="{ relation: 'addresses' }"
|
||||||
v-model="data.clientFk"
|
v-model="data.clientFk"
|
||||||
:label="t('module.customer')"
|
:label="t('module.customer')"
|
||||||
@update:model-value="
|
@update:model-value="(id) => fetchClientAddress(id, data)"
|
||||||
(id) => {
|
|
||||||
const addressId = fetchClientAddress(id, data);
|
|
||||||
console.error('addressId', addressId);
|
|
||||||
data.addressId = addressId;
|
|
||||||
}
|
|
||||||
"
|
|
||||||
/>
|
/>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
v-model="data.addressId"
|
v-model="data.addressId"
|
||||||
|
|
Loading…
Reference in New Issue