0
0
Fork 0

fix: refs #8114 orderList

This commit is contained in:
Carlos Satorres 2024-11-27 06:18:41 +01:00
parent 8688f2a3aa
commit 59648d14f0
2 changed files with 11 additions and 18 deletions

View File

@ -59,17 +59,17 @@ const initialFormState = reactive({
clientFk: $props.clientFk,
});
const onClientChange = async (clientId = $props.clientFk) => {
const { data } = await axios.get(`Clients/${clientId}`);
await fetchAddressList(data.defaultAddressFk);
};
// const onClientChange = async (clientId = $props.clientFk) => {
// const { data } = await axios.get(`Clients/${clientId}`);
// await fetchAddressList(data.defaultAddressFk);
// };
async function onDataSaved(_, id) {
await router.push({ path: `/order/${id}/catalog` });
}
onMounted(async () => {
await onClientChange();
});
// onMounted(async () => {
// await onClientChange();
// });
</script>
<template>
@ -90,10 +90,9 @@ onMounted(async () => {
option-value="id"
option-label="name"
:filter="{
fields: ['id', 'name', 'defaultAddressFk'],
fields: ['id', 'name'],
}"
hide-selected
@update:model-value="onClientChange"
>
<template #option="scope">
<QItem v-bind="scope.itemProps">
@ -110,7 +109,7 @@ onMounted(async () => {
:label="t('order.form.addressFk')"
v-model="data.addressId"
url="addresses"
:fields="['id', 'nickname', 'defaultAddressFk', 'street', 'city']"
:fields="['id', 'nickname', 'street', 'city']"
sort-by="id"
option-value="id"
option-label="street"

View File

@ -141,12 +141,6 @@ const columns = computed(() => [
],
},
]);
onMounted(() => {
if (!route.query.createForm) return;
const clientId = route.query.createForm;
const id = JSON.parse(clientId);
fetchClientAddress(id.clientFk);
});
async function fetchClientAddress(id, formData = {}) {
const { data } = await axios.get(`Clients/${id}`, {
params: { filter: { include: { relation: 'addresses' } } },
@ -191,7 +185,7 @@ const getDateColor = (date) => {
urlCreate: 'Orders/new',
title: t('module.cerateOrder'),
onDataSaved: (url) => {
tableRef.redirect(`${url}/catalog`);
tableRef.redirect(`${url}/catalog`);
},
formInitialData: {
active: true,
@ -250,7 +244,7 @@ const getDateColor = (date) => {
:label="t('module.address')"
option-value="id"
option-label="nickname"
@update:model-value="() => fetchAgencies(data)"
@update:model-value="() => fetchClientAddress(data)"
>
<template #option="scope">
<QItem v-bind="scope.itemProps">