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