diff --git a/src/components/common/VnLocation.vue b/src/components/common/VnLocation.vue index d650211ad..6720e3920 100644 --- a/src/components/common/VnLocation.vue +++ b/src/components/common/VnLocation.vue @@ -129,5 +129,5 @@ async function onPostcodeCreated(){ es: Location: Ubicación - Search by postalCode, town, province or country: Buscar por código postal, ciudad o país + Search by postalcode, town, province or country: Buscar por código postal, ciudad o país diff --git a/src/pages/Worker/WorkerCreate.vue b/src/pages/Worker/WorkerCreate.vue index accac7cf2..667111c6a 100644 --- a/src/pages/Worker/WorkerCreate.vue +++ b/src/pages/Worker/WorkerCreate.vue @@ -9,7 +9,7 @@ import VnInputDate from 'components/common/VnInputDate.vue'; import VnSelectFilter from 'src/components/common/VnSelectFilter.vue'; import VnSelectCreate from 'src/components/common/VnSelectCreate.vue'; import CreateBankEntityForm from 'src/components/CreateBankEntityForm.vue'; -import CustomerCreateNewPostcode from 'src/components/CreateNewPostcodeForm.vue'; +import VnLocation from 'src/components/common/VnLocation.vue'; import VnInput from 'src/components/common/VnInput.vue'; import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue'; @@ -21,14 +21,6 @@ const workerConfigFilter = { field: ['payMethodFk'], }; -const provincesFilter = { - fields: ['id', 'name', 'countryFk'], -}; - -const townsFilter = { - fields: ['id', 'name', 'provinceFk'], -}; - const newWorkerForm = ref({ companyFk: null, payMethodFk: null, @@ -49,9 +41,6 @@ const newWorkerForm = ref({ bankEntityFk: null, }); -const postcodeFetchDataRef = ref(null); -const provincesOptions = ref([]); -const townsOptions = ref([]); const companiesOptions = ref([]); const workersOptions = ref([]); const payMethodsOptions = ref([]); @@ -66,9 +55,13 @@ const onBankEntityCreated = (data) => { bankEntitiesOptions.value.push(data); }; -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; +} onMounted(async () => { const userInfo = await useUserConfig().fetch(); @@ -83,24 +76,7 @@ onMounted(async () => { :filter="workerConfigFilter" auto-load /> - - - + {
- - - - -
-
- + v-model="data.location" + @update:model-value=" + (location) => handleLocation(data, location) + " + > +
-
- - - -