From 20835471a3a1c392b080f51295e0bf49c92a71cf Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Mon, 15 Jan 2024 09:14:42 +0100 Subject: [PATCH] refs #6280 feat: handle option selected from VnLocation --- src/components/common/VnLocation.vue | 4 ++-- src/pages/Customer/CustomerCreate.vue | 18 +++++++++++++----- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/components/common/VnLocation.vue b/src/components/common/VnLocation.vue index 5c41144ac..e91c78430 100644 --- a/src/components/common/VnLocation.vue +++ b/src/components/common/VnLocation.vue @@ -98,9 +98,8 @@ function showLabel(data){ v-model="value" :options="postcodesOptions" :label="t('Location')" - option-value="geoFk" :option-label="showLabel" - :placeholder="t('Min. 3 char')" + :placeholder="t('Search by postalCode or town (at least 3 characters')" v-bind="$attrs" emit-value map-options @@ -138,4 +137,5 @@ function showLabel(data){ es: Location: Ubicación + Search by postalCode or town (at least 3 characters): Buscar por código postal o nombre ( al menos 3 letras) diff --git a/src/pages/Customer/CustomerCreate.vue b/src/pages/Customer/CustomerCreate.vue index f6ac6a165..3afda7fac 100644 --- a/src/pages/Customer/CustomerCreate.vue +++ b/src/pages/Customer/CustomerCreate.vue @@ -36,9 +36,13 @@ const provincesLocationOptions = ref([]); const countriesOptions = ref([]); const postcodesOptions = ref([]); -const onPostcodeCreated = async () => { - postcodeFetchDataRef.value.fetch(); -}; + +function handleLocation(data, { city, postcode, provinceFk, countryFk }) { + data.postcode = postcode; + data.city = city; + data.provinceFk = provinceFk; + data.countryFk = countryFk; +}