corretto filtro Provincia
This commit is contained in:
@@ -27,7 +27,7 @@ export default defineComponent({
|
||||
},
|
||||
setup(props, { attrs, slots, emit }) {
|
||||
const mytable = 'users'
|
||||
const { t } = useI18n();
|
||||
const { t } = useI18n()
|
||||
const globalStore = useGlobalStore()
|
||||
const userStore = useUserStore()
|
||||
|
||||
@@ -36,6 +36,7 @@ export default defineComponent({
|
||||
const searchList = ref(<ISearchList[]>[])
|
||||
|
||||
const search = ref('')
|
||||
const myrecfiltertoggle = ref(tools.FILTER_ALL)
|
||||
|
||||
const idSector = computed(() => {
|
||||
let myval: any = null
|
||||
@@ -49,6 +50,16 @@ export default defineComponent({
|
||||
}
|
||||
})
|
||||
|
||||
watch(() => myrecfiltertoggle.value, (value: any, oldval: any) => {
|
||||
if (value === tools.FILTER_MYREC) {
|
||||
filtercustom.value = [{ userId: userStore.my._id }]
|
||||
} else {
|
||||
filtercustom.value = []
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
function mounted() {
|
||||
/*arrfilterand.value = [
|
||||
{
|
||||
@@ -59,7 +70,7 @@ export default defineComponent({
|
||||
]*/
|
||||
|
||||
function getFilterSkills(recSkill: any, index: number, arr: any) {
|
||||
const recsectors:any = searchList.value.find((rec) => rec.table === 'sectors')
|
||||
const recsectors: any = searchList.value.find((rec) => rec.table === 'sectors')
|
||||
// console.log('getFilterSkills', recSkill.idSector, recsectors.value)
|
||||
if (recsectors) {
|
||||
return recSkill.idSector.includes(recsectors.value)
|
||||
@@ -69,7 +80,7 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
function getFilterSubSkills(recSubSkill: any, index: number, arr: any) {
|
||||
const recskills:any = searchList.value.find((rec) => rec.table === 'skills')
|
||||
const recskills: any = searchList.value.find((rec) => rec.table === 'skills')
|
||||
// console.log('recSubSkill', recSubSkill, 'recskills', recskills)
|
||||
if (recskills) {
|
||||
return recSubSkill.idSkill === recskills.value
|
||||
@@ -79,7 +90,7 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
function getFilterCitiesByProvince(recSubSkill: any, index: number, arr: any) {
|
||||
const recprov:any = searchList.value.find((rec) => rec.table === 'provinces')
|
||||
const recprov: any = searchList.value.find((rec) => rec.table === 'provinces')
|
||||
// console.log('recSubSkill', recSubSkill, 'recskills', recskills)
|
||||
if (recprov) {
|
||||
return recSubSkill.idSkill === recprov.value
|
||||
@@ -164,20 +175,6 @@ export default defineComponent({
|
||||
useinput: false,
|
||||
icon: 'far fa-id-card',
|
||||
},
|
||||
{
|
||||
label: '',
|
||||
table: '',
|
||||
key: '',
|
||||
value: 0,
|
||||
type: costanti.FieldType.separator,
|
||||
arrvalue: [],
|
||||
addall: true,
|
||||
filter: null,
|
||||
showcount: true,
|
||||
useinput: false,
|
||||
notinsearch: true,
|
||||
icon: '',
|
||||
},
|
||||
/*{
|
||||
label: 'Regione',
|
||||
table: 'regions',
|
||||
@@ -225,6 +222,20 @@ export default defineComponent({
|
||||
filteradv: true,
|
||||
//icon: 'swap_horizontal_circle',
|
||||
},
|
||||
{
|
||||
label: '',
|
||||
table: '',
|
||||
key: '',
|
||||
value: 0,
|
||||
type: costanti.FieldType.separator,
|
||||
arrvalue: [],
|
||||
addall: true,
|
||||
filter: null,
|
||||
showcount: true,
|
||||
useinput: false,
|
||||
notinsearch: true,
|
||||
icon: '',
|
||||
},
|
||||
|
||||
]
|
||||
|
||||
@@ -335,6 +346,7 @@ export default defineComponent({
|
||||
idSector,
|
||||
search,
|
||||
doSearch,
|
||||
myrecfiltertoggle,
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
@@ -2,6 +2,18 @@
|
||||
<div class="bi-border-all">
|
||||
<div class="q-ma-xs q-gutter-xs q-pa-xs">
|
||||
|
||||
<div class="text-center">
|
||||
<q-btn-toggle
|
||||
v-model="myrecfiltertoggle"
|
||||
push
|
||||
glossy
|
||||
toggle-color="primary"
|
||||
:options="[
|
||||
{label: 'Tutti', value: tools.FILTER_ALL},
|
||||
{label: 'Personali', value: tools.FILTER_MYREC},
|
||||
]"
|
||||
/>
|
||||
</div>
|
||||
<div v-if="false" class="q-mr-sm">
|
||||
<q-input
|
||||
v-model="search" filled dense type="search" debounce="500" :hint="t('finder.search_skill')"
|
||||
@@ -26,7 +38,7 @@
|
||||
:nodataLabel="idSector > 0 ? 'Nessuna Competenza trovata': 'Selezionare un Settore'"
|
||||
:prop_search="true"
|
||||
:finder="true"
|
||||
:choose_visutype="true"
|
||||
:choose_visutype="$q.screen.gt.xs"
|
||||
:butt_modif_new="false"
|
||||
noresultLabel="Il filtro selezionato non ha trovato nessun risultato"
|
||||
:arrfilters="arrfilterand"
|
||||
|
||||
@@ -431,13 +431,23 @@ export default defineComponent({
|
||||
|
||||
if (searchList.value) {
|
||||
for (const item of searchList.value) {
|
||||
|
||||
//searchList.value.forEach((item: ISearchList) => {
|
||||
if (!item.notinsearch) {
|
||||
let objitem: any = {}
|
||||
// console.log(' item ', item)
|
||||
if (item.value > 0) {
|
||||
|
||||
if (item.table === 'provinces') {
|
||||
let obj: any = {}
|
||||
|
||||
obj['mycities.prov'] = item.value
|
||||
if (item.value !== '') {
|
||||
filtersearch3or.push(obj)
|
||||
}
|
||||
} else if (item.value > 0) {
|
||||
objitem[item.key] = item.value
|
||||
filtersearch.push(objitem)
|
||||
filtersearch.push(objitem)
|
||||
|
||||
} else if (item.arrvalue.length > 0) {
|
||||
const myarr = item.arrvalue.filter((value: any) => {
|
||||
if (typeof value === 'number') {
|
||||
@@ -448,20 +458,7 @@ export default defineComponent({
|
||||
|
||||
let arr2: any = []
|
||||
|
||||
if (item.table === 'provinces') {
|
||||
arr2 = []
|
||||
myarr.forEach((myval: any) => {
|
||||
let objitem3: any = {}
|
||||
objitem3['mycities.prov'] = myval
|
||||
arr2.push(objitem3)
|
||||
})
|
||||
let obj2: any = {
|
||||
$or: arr2
|
||||
}
|
||||
if (arr2.length > 0) {
|
||||
filtersearch3or = arr2
|
||||
}
|
||||
} else {
|
||||
if (item.table !== 'provinces') {
|
||||
myarr.forEach((myval: any) => {
|
||||
let objitem2: any = {}
|
||||
objitem2[item.key] = myval
|
||||
|
||||
@@ -106,9 +106,8 @@
|
||||
<div v-if="searchList"
|
||||
:class="$q.screen.lt.sm ? `` : `row` + ` text-blue `">
|
||||
<span v-for="(item, index) in searchList" :key="index">
|
||||
<div class="text-center" v-if="(item.type === costanti.FieldType.separator)">
|
||||
<q-btn rounded size="md" dense :icon="!showfilteradv ? 'fas fa-arrow-down' : 'fas fa-arrow-up'" label="Filtri Avanzati" @click="showfilteradv = !showfilteradv"></q-btn>
|
||||
<q-separator class="q-my-sm"></q-separator>
|
||||
<div class="text-center q-my-xs" v-if="(item.type === costanti.FieldType.separator)">
|
||||
<q-btn rounded flat size="sm" dense :icon="!showfilteradv ? 'fas fa-arrow-down' : 'fas fa-arrow-up'" label="Filtri Avanzati" @click="showfilteradv = !showfilteradv"></q-btn>
|
||||
</div>
|
||||
|
||||
<CMySelect
|
||||
@@ -235,7 +234,7 @@
|
||||
|
||||
<q-space></q-space>
|
||||
<q-select
|
||||
v-if="mytable && pagination.rowsNumber > 0 && (prop_search || canEdit) && showCol"
|
||||
v-if="mytable && pagination.rowsNumber > 0 && (prop_search || canEdit) && showCol && myvertical === 0"
|
||||
v-model="colVisib"
|
||||
rounded
|
||||
outlined
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
:input-class="myclass"
|
||||
:options="valori"
|
||||
:option-value="optval"
|
||||
options-selected-class="text-deep-blue"
|
||||
class="combowidth"
|
||||
style="min-width: 250px"
|
||||
>
|
||||
@@ -131,6 +132,7 @@
|
||||
emit-value
|
||||
stack-label
|
||||
:options="valori"
|
||||
options-selected-class="text-deep-blue"
|
||||
:option-value="optval"
|
||||
:option-label="optlab"
|
||||
:dense="dense">
|
||||
@@ -189,7 +191,7 @@
|
||||
@new-value="newvaluefuncfirst"
|
||||
emit-value
|
||||
input-debounce="0"
|
||||
options-selected-class="text-deep-orange"
|
||||
options-selected-class="text-deep-blue"
|
||||
map-options
|
||||
v-bind="$attrs"
|
||||
class="combowidth">
|
||||
|
||||
@@ -53,6 +53,9 @@ export const tools = {
|
||||
TABBED_HOME: 't-home',
|
||||
TABBED_NAVE: 't-nave',
|
||||
|
||||
FILTER_ALL: 0,
|
||||
FILTER_MYREC: 1,
|
||||
|
||||
COOK_SEARCH: 'SEARCH_',
|
||||
|
||||
FRIENDS_SEARCH: 'FR_SE',
|
||||
|
||||
Reference in New Issue
Block a user