Se hacen correcciones solicitadas
This commit is contained in:
parent
27f9d5a7b2
commit
a06f9a279e
|
@ -3,6 +3,8 @@ import { onBeforeMount, reactive, ref } from 'vue';
|
|||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute } from 'vue-router';
|
||||
|
||||
import axios from 'axios';
|
||||
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import FormModel from 'components/FormModel.vue';
|
||||
import VnRow from 'components/ui/VnRow.vue';
|
||||
|
@ -42,6 +44,7 @@ const customsAgents = ref([]);
|
|||
|
||||
onBeforeMount(() => {
|
||||
urlCreate.value = `Clients/${route.params.id}/createAddress`;
|
||||
getCustomsAgents();
|
||||
});
|
||||
|
||||
const onPostcodeCreated = async ({ code, provinceFk, townFk }, formData) => {
|
||||
|
@ -51,6 +54,15 @@ const onPostcodeCreated = async ({ code, provinceFk, townFk }, formData) => {
|
|||
formData.provinceFk = provinceFk;
|
||||
formData.city = citiesLocationOptions.value.find((town) => town.id === townFk).name;
|
||||
};
|
||||
|
||||
const getCustomsAgents = async () => {
|
||||
const { data } = await axios.get('CustomsAgents');
|
||||
customsAgents.value = data;
|
||||
};
|
||||
|
||||
const refreshData = () => {
|
||||
getCustomsAgents();
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -77,11 +89,6 @@ const onPostcodeCreated = async ({ code, provinceFk, townFk }, formData) => {
|
|||
url="AgencyModes/isActive"
|
||||
/>
|
||||
<fetch-data @on-fetch="(data) => (incoterms = data)" auto-load url="Incoterms" />
|
||||
<fetch-data
|
||||
@on-fetch="(data) => (customsAgents = data)"
|
||||
auto-load
|
||||
url="CustomsAgents"
|
||||
/>
|
||||
|
||||
<FormModel
|
||||
:form-initial-data="formInitialData"
|
||||
|
@ -226,7 +233,7 @@ const onPostcodeCreated = async ({ code, provinceFk, townFk }, formData) => {
|
|||
v-model="data.customsAgentFk"
|
||||
>
|
||||
<template #form>
|
||||
<CustomsNewCustomsAgent />
|
||||
<CustomsNewCustomsAgent @on-data-saved="refreshData()" />
|
||||
</template>
|
||||
</VnSelectCreate>
|
||||
</div>
|
||||
|
|
|
@ -90,6 +90,14 @@ const addNote = () => {
|
|||
const deleteNote = (index) => {
|
||||
notes.value.splice(index, 1);
|
||||
};
|
||||
|
||||
const onDataSaved = () => {
|
||||
const payload = {
|
||||
creates: notes.value,
|
||||
};
|
||||
console.log(payload);
|
||||
axios.post('AddressObservations/crud', payload);
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -124,9 +132,10 @@ const deleteNote = (index) => {
|
|||
<fetch-data @on-fetch="getData" auto-load url="ObservationTypes" />
|
||||
|
||||
<FormModel
|
||||
:observe-form-changes="false"
|
||||
:url-update="urlUpdate"
|
||||
:url="`Addresses/${route.params.consigneeId}`"
|
||||
@on-fetch="onFetch()"
|
||||
@on-data-saved="onDataSaved()"
|
||||
auto-load
|
||||
model="client"
|
||||
>
|
||||
|
|
|
@ -18,6 +18,8 @@ const initialData = reactive({
|
|||
});
|
||||
|
||||
const onDataSaved = (dataSaved) => {
|
||||
console.log('onDataSaved()');
|
||||
console.log(dataSaved);
|
||||
emit('onDataSaved', dataSaved);
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
<script setup>
|
||||
import { onMounted, reactive } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
|
||||
import FormModel from 'components/FormModel.vue';
|
||||
import VnRow from 'components/ui/VnRow.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
|
||||
const initialData = reactive({
|
||||
text: null,
|
||||
|
@ -16,6 +17,16 @@ const initialData = reactive({
|
|||
onMounted(() => {
|
||||
initialData.clientFk = `${route.params.id}`;
|
||||
});
|
||||
|
||||
const toCustomerNotes = () => {
|
||||
console.log('toCustomerNotes()');
|
||||
router.push({
|
||||
name: 'CustomerNotes',
|
||||
params: {
|
||||
id: route.params.id,
|
||||
},
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -23,6 +34,7 @@ onMounted(() => {
|
|||
:form-initial-data="initialData"
|
||||
:observe-form-changes="false"
|
||||
url-create="ClientObservations"
|
||||
@on-data-saved="toCustomerNotes()"
|
||||
>
|
||||
<template #form="{ data }">
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
|
|
Loading…
Reference in New Issue