forked from verdnatura/salix-front
refs #6280 feat: handle option selected from VnLocation
This commit is contained in:
parent
b6a03e6a9f
commit
20835471a3
|
@ -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){
|
|||
<i18n>
|
||||
es:
|
||||
Location: Ubicación
|
||||
Search by postalCode or town (at least 3 characters): Buscar por código postal o nombre ( al menos 3 letras)
|
||||
</i18n>
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -133,10 +137,14 @@ const onPostcodeCreated = async () => {
|
|||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
<div class="col">
|
||||
<VnLocation
|
||||
:rules="validate('Worker.postcode')"
|
||||
:roles-allowed-to-create="['deliveryAssistant']"
|
||||
:options="postcodesOptions"
|
||||
v-model="data.location"
|
||||
@update:model-value="(data)=> console.log(data)"
|
||||
>
|
||||
@update:model-value="
|
||||
(location) => handleLocation(data, location)
|
||||
"
|
||||
>
|
||||
</VnLocation>
|
||||
</div>
|
||||
</VnRow>
|
||||
|
|
Loading…
Reference in New Issue