0
0
Fork 0

fix: #6943 CustomerAddressCreate

This commit is contained in:
Javier Segarra 2024-11-29 13:21:19 +01:00
parent 514d54b222
commit 940fe5c2b9
1 changed files with 10 additions and 7 deletions

View File

@ -18,8 +18,6 @@ const router = useRouter();
const formInitialData = reactive({ isDefaultAddress: false });
const urlCreate = ref('');
const agencyModes = ref([]);
const incoterms = ref([]);
const customsAgents = ref([]);
@ -40,13 +38,18 @@ function handleLocation(data, location) {
data.countryFk = countryFk;
}
function onAgentCreated(requestResponse, data) {
customsAgents.value.push(requestResponse);
data.customsAgentFk = requestResponse.id;
function onAgentCreated({ id, fiscalName }, data) {
customsAgents.value.push({ id, fiscalName });
data.customsAgentFk = id;
}
</script>
<template>
<FetchData
@on-fetch="(data) => (customsAgents = data)"
auto-load
url="CustomsAgents"
/>
<FetchData
@on-fetch="(data) => (agencyModes = data)"
auto-load
@ -57,7 +60,7 @@ function onAgentCreated(requestResponse, data) {
<FormModel
:form-initial-data="formInitialData"
:observe-form-changes="false"
:url-create="urlCreate"
:url-create="`Clients/${route.params.id}/createAddress`"
@on-data-saved="toCustomerAddress()"
model="client"
>
@ -141,7 +144,7 @@ function onAgentCreated(requestResponse, data) {
<template #form>
<CustomerNewCustomsAgent
@on-data-saved="
(_, requestResponse) =>
(requestResponse, _) =>
onAgentCreated(requestResponse, data)
"
/>