diff --git a/src/pages/Order/OrderList.vue b/src/pages/Order/OrderList.vue
index fe97c3fc4..017817b93 100644
--- a/src/pages/Order/OrderList.vue
+++ b/src/pages/Order/OrderList.vue
@@ -141,11 +141,16 @@ const columns = computed(() => [
],
},
]);
+const formInitialData = {
+ active: true,
+ addressId: null,
+ clientFk: null,
+};
onMounted(() => {
if (!route.query.createForm) return;
const clientId = route.query.createForm;
const id = JSON.parse(clientId);
- fetchClientAddress(id.clientFk, id);
+ fetchClientAddress(id.clientFk, formInitialData);
});
async function fetchClientAddress(id, formData) {
const { data } = await axios.get(`Clients/${id}`, {
@@ -154,6 +159,7 @@ async function fetchClientAddress(id, formData) {
addressesList.value = data.addresses;
formData.addressId = data.defaultAddressFk;
fetchAgencies(formData);
+ return formData.addressId;
}
async function fetchAgencies({ landed, addressId }) {
@@ -174,13 +180,6 @@ const getDateColor = (date) => {
if (comparation == 0) return 'bg-warning';
if (comparation < 0) return 'bg-success';
};
-
-onMounted(() => {
- if (!route.query.createForm) return;
- const clientId = route.query.createForm;
- const id = JSON.parse(clientId);
- fetchClientAddress(id.clientFk, id);
-});
@@ -189,6 +188,7 @@ onMounted(() => {
+
{
onDataSaved: (url) => {
tableRef.redirect(url);
},
- formInitialData: {
- active: true,
- addressId: null,
- clientFk: null,
- },
+ formInitialData,
}"
:user-params="{ showEmpty: false }"
:right-search="false"
@@ -231,12 +227,20 @@ onMounted(() => {
+ {{ formInitialData }}
+ {{ data }}
fetchClientAddress(id, data)"
+ @update:model-value="
+ (id) => {
+ const addressId = fetchClientAddress(id, data);
+ console.error('addressId', addressId);
+ data.addressId = addressId;
+ }
+ "
/>