diff --git a/src/pages/Customer/components/CustomerConsigneeCreate.vue b/src/pages/Customer/components/CustomerConsigneeCreate.vue index ef01879c2..d9765d50d 100644 --- a/src/pages/Customer/components/CustomerConsigneeCreate.vue +++ b/src/pages/Customer/components/CustomerConsigneeCreate.vue @@ -4,7 +4,7 @@ import { useI18n } from 'vue-i18n'; import { useRoute, useRouter } from 'vue-router'; import axios from 'axios'; - +import VnLocation from 'src/components/common/VnLocation.vue'; import FetchData from 'components/FetchData.vue'; import FormModel from 'components/FormModel.vue'; import VnRow from 'components/ui/VnRow.vue'; @@ -20,13 +20,9 @@ const router = useRouter(); const formInitialData = reactive({ isDefaultAddress: false }); -const townsFetchDataRef = ref(null); -const postcodeFetchDataRef = ref(null); const urlCreate = ref(''); const postcodesOptions = ref([]); -const citiesLocationOptions = ref([]); -const provincesLocationOptions = ref([]); const agencyModes = ref([]); const incoterms = ref([]); const customsAgents = ref([]); @@ -36,14 +32,6 @@ onBeforeMount(() => { getCustomsAgents(); }); -const onPostcodeCreated = async ({ code, provinceFk, townFk }, formData) => { - await postcodeFetchDataRef.value.fetch(); - await townsFetchDataRef.value.fetch(); - formData.postalCode = code; - 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; @@ -61,26 +49,18 @@ const toCustomerConsignees = () => { }, }); }; +function handleLocation(data, location) { + const { town, code, provinceFk, countryFk } = location ?? {}; + data.postcode = code; + data.city = town; + data.provinceFk = provinceFk; + data.countryFk = countryFk; + console.log('data', data); +} +console.log('handleLocation: ', handleLocation);