From 817a4e9e3f8ccb58a07e6f00d6e432e49c3a1592 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Wed, 17 Jan 2024 08:30:23 +0100 Subject: [PATCH] refs #6694 feat call new method for filter --- src/components/common/VnLocation.vue | 88 ++++++++++++++++++++-------- 1 file changed, 63 insertions(+), 25 deletions(-) diff --git a/src/components/common/VnLocation.vue b/src/components/common/VnLocation.vue index e91c78430..db6f49469 100644 --- a/src/components/common/VnLocation.vue +++ b/src/components/common/VnLocation.vue @@ -7,11 +7,12 @@ const emit = defineEmits(['update:modelValue', 'update:options']); import { useI18n } from 'vue-i18n'; const { t } = useI18n(); -const citiesLocationOptions = ref([]); -const provincesLocationOptions = ref([]); -const countriesOptions = ref([]); +// const citiesLocationOptions = ref([]); +// const provincesLocationOptions = ref([]); +// const countriesOptions = ref([]); +// const townsRef = ref([]); const postcodesOptions = ref([]); -const postcodeFetchDataRef = ref(null); +const postcodesRef = ref(null); const $props = defineProps({ modelValue: { @@ -66,25 +67,61 @@ watch(options, (newValue) => { setOptions(newValue); }); -function showLabel(data){ - return `${data.code} - ${data.town.name}(${data.town.province.name}), ${data.town.province.country.country}`; +function showLabel(data) { + return `${data.code} - ${data.town}(${data.province}), ${data.country}`; } - +function locationFilter(value) { + // if(value==='') return []; + let where = { limit: 30 }; + const params = { value }; + postcodesRef.value.fetch({ where: Object.assign(where, params) }); +// postcodesRef.value.fetch({ +// where: { +// or: [ +// { code: { like: '%4660%' } }, +// { 'town.name': { like: '%Alz%' } } +// ] +// }}); + // const townParams = { name: { like: `%${val}%` } }; -