Filtri avanzati a scomparsa

This commit is contained in:
paoloar77
2022-02-14 11:30:53 +01:00
parent 86cf158e27
commit cac35f9243
15 changed files with 99 additions and 50 deletions

View File

@@ -382,10 +382,10 @@ const baseroutes: IListRoutes[] = [
{ {
active: true, active: true,
order: 10, order: 10,
path: '/work', path: '/bacheca',
materialIcon: 'fas fa-bullhorn', materialIcon: 'fas fa-bullhorn',
name: 'mypages.work', name: 'mypages.work',
component: () => import('@/root/work/work.vue'), component: () => import('@/root/bacheca/bacheca.vue'),
meta: { requiresAuth: true }, meta: { requiresAuth: true },
inmenu: true, inmenu: true,
infooter: true, infooter: true,

View File

@@ -382,10 +382,10 @@ const baseroutes: IListRoutes[] = [
{ {
active: true, active: true,
order: 100, order: 100,
path: '/work', path: '/bacheca',
materialIcon: 'fas fa-bullhorn', materialIcon: 'fas fa-bullhorn',
name: 'mypages.work', name: 'mypages.work',
component: () => import('@/root/work/work.vue'), component: () => import('@/root/bacheca/bacheca.vue'),
meta: { requiresAuth: true }, meta: { requiresAuth: true },
inmenu: true, inmenu: true,
infooter: true, infooter: true,

View File

@@ -382,10 +382,10 @@ const baseroutes: IListRoutes[] = [
{ {
active: true, active: true,
order: 10, order: 10,
path: '/work', path: '/bacheca',
materialIcon: 'fas fa-bullhorn', materialIcon: 'fas fa-bullhorn',
name: 'mypages.work', name: 'mypages.work',
component: () => import('@/root/work/work.vue'), component: () => import('@/root/bacheca/bacheca.vue'),
meta: { requiresAuth: true }, meta: { requiresAuth: true },
inmenu: true, inmenu: true,
infooter: true, infooter: true,

View File

@@ -90,6 +90,32 @@ export default defineComponent({
searchList.value = [ searchList.value = [
{
label: 'Provincia',
table: 'provinces',
key: 'idProvince',
type: costanti.FieldType.select,
value: tools.getCookie(tools.COOK_SEARCH + 'provinces', costanti.FILTER_TUTTI),
addall: true,
arrvalue: [],
filter: null,
useinput: true,
icon: 'flag',
},
{
label: 'Città',
table: 'cities',
key: 'idCity',
type: costanti.FieldType.select_by_server,
value: tools.getCookie(tools.COOK_SEARCH + 'cities', costanti.FILTER_TUTTI),
addall: true,
arrvalue: [],
useinput: true,
filter: null,
// filter: getFilterCitiesByProvince,
// param1: shared_consts.PARAM_SHOW_PROVINCE,
tablesel: 'cities',
},
{ {
label: 'Offro/Cerco', label: 'Offro/Cerco',
table: 'adtypes', table: 'adtypes',
@@ -138,6 +164,20 @@ export default defineComponent({
useinput: false, useinput: false,
icon: 'far fa-id-card', 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', label: 'Regione',
table: 'regions', table: 'regions',
@@ -148,32 +188,6 @@ export default defineComponent({
filter: null, filter: null,
useinput: true, useinput: true,
},*/ },*/
{
label: 'Provincia',
table: 'provinces',
key: 'idProvince',
type: costanti.FieldType.multiselect,
value: 0,
addall: true,
arrvalue: tools.getCookie(tools.COOK_SEARCH + 'provinces', [costanti.FILTER_TUTTI]),
filter: null,
useinput: true,
icon: 'flag',
},
{
label: 'Città',
table: 'cities',
key: 'idCity',
type: costanti.FieldType.multiselect_by_server,
value: 0,
addall: true,
arrvalue: tools.getCookie(tools.COOK_SEARCH + 'cities', [costanti.FILTER_TUTTI]),
useinput: true,
filter: null,
// filter: getFilterCitiesByProvince,
// param1: shared_consts.PARAM_SHOW_PROVINCE,
tablesel: 'cities',
},
{ {
label: 'Livello', label: 'Livello',
table: 'levels', table: 'levels',
@@ -184,6 +198,7 @@ export default defineComponent({
type: costanti.FieldType.select, type: costanti.FieldType.select,
filter: null, filter: null,
useinput: false, useinput: false,
filteradv: true,
}, },
{ {
label: 'Stato', label: 'Stato',
@@ -195,6 +210,7 @@ export default defineComponent({
filter: null, filter: null,
useinput: false, useinput: false,
icon: 'mood', icon: 'mood',
filteradv: true,
}, },
{ {
label: 'Contributo', label: 'Contributo',
@@ -206,6 +222,7 @@ export default defineComponent({
filter: null, filter: null,
useinput: false, useinput: false,
icon: 'currency_exchange', icon: 'currency_exchange',
filteradv: true,
//icon: 'swap_horizontal_circle', //icon: 'swap_horizontal_circle',
}, },

View File

@@ -259,6 +259,7 @@ export default defineComponent({
const colclicksel = ref(null) const colclicksel = ref(null)
const selected: any = ref([]) const selected: any = ref([])
const showfilteradv = ref(false) // filtri avanzati
const filter = ref(0) const filter = ref(0)
const filtergrp = ref(costanti.MY_GROUPS) const filtergrp = ref(costanti.MY_GROUPS)
@@ -284,6 +285,10 @@ export default defineComponent({
refresh() refresh()
}) })
watch(() => showfilteradv.value, (newval: any, from: any) => {
tools.setCookie('s_adv', newval)
})
watch(() => props.filtercustom, (to: any, from: any) => { watch(() => props.filtercustom, (to: any, from: any) => {
console.log('filtercustom', to) console.log('filtercustom', to)
refresh() refresh()
@@ -896,6 +901,8 @@ export default defineComponent({
myvertical.value = props.vertical myvertical.value = props.vertical
myvertical.value = tools.getCookie('myv_' + props.prop_mytable, props.vertical) myvertical.value = tools.getCookie('myv_' + props.prop_mytable, props.vertical)
showfilteradv.value = tools.getCookie('s_adv', false)
} }
function mounted() { function mounted() {
@@ -1485,6 +1492,7 @@ export default defineComponent({
getValueExtra, getValueExtra,
shared_consts, shared_consts,
getLabelFooterByRow, getLabelFooterByRow,
showfilteradv,
} }
} }
}) })

View File

@@ -105,9 +105,15 @@
<div v-if="searchList" <div v-if="searchList"
:class="$q.screen.lt.sm ? `` : `row` + ` text-blue `"> :class="$q.screen.lt.sm ? `` : `row` + ` text-blue `">
<span v-for="(item, index) in searchList" :key="index"> <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>
<CMySelect <CMySelect
:col="fieldsTable.getColByTable(mytable, item.key)" :col="fieldsTable.getColByTable(mytable, item.key)"
v-if="(item.type === costanti.FieldType.select) || (item.type === costanti.FieldType.select_by_server)" v-if="(item.type === costanti.FieldType.select) || (item.type === costanti.FieldType.select_by_server)"
v-show="(item.filteradv && showfilteradv) || !item.filteradv"
:label="labelcombo(item)" :label="labelcombo(item)"
v-model:value="item.value" v-model:value="item.value"
@update:value="searchval(item.value, item.table)" @update:value="searchval(item.value, item.table)"
@@ -131,6 +137,7 @@
<CMySelect <CMySelect
v-if="item.type === costanti.FieldType.multiselect_by_server" v-if="item.type === costanti.FieldType.multiselect_by_server"
v-show="(item.filteradv && showfilteradv) || !item.filteradv"
:col="fieldsTable.getColByTable(mytable, item.key)" :col="fieldsTable.getColByTable(mytable, item.key)"
:multiselect_by_server="true" :multiselect_by_server="true"
:label="labelcombo(item)" :label="labelcombo(item)"
@@ -153,6 +160,7 @@
<q-select <q-select
v-if="(item.type === costanti.FieldType.multiselect)" v-if="(item.type === costanti.FieldType.multiselect)"
v-show="(item.filteradv && showfilteradv) || !item.filteradv"
v-model="item.arrvalue" v-model="item.arrvalue"
label-color="primary" label-color="primary"
:label="labelcombo(item)" :label="labelcombo(item)"
@@ -212,10 +220,12 @@
<div v-if="(prop_search || canEdit)" <div v-if="(prop_search || canEdit)"
class="row justify-center vertical-middle"> class="row justify-center vertical-middle">
<div v-if="prop_search" class="q-mr-sm"> <div v-if="prop_search" class="q-mr-sm full-width">
<q-input <q-input
v-model="search" filled dense type="search" debounce="500" :hint="hint" v-model="search" filled dense type="search" debounce="500" :hint="hint"
v-on:keyup.enter="doSearch">
v-on:keyup.enter="doSearch"
>
<template v-slot:after> <template v-slot:after>
<q-btn v-if="mytable" dense label="" color="primary" @click="refresh" icon="search"></q-btn> <q-btn v-if="mytable" dense label="" color="primary" @click="refresh" icon="search"></q-btn>
</template> </template>

View File

@@ -2,7 +2,7 @@
<div> <div>
<div class="row q-ma-sm shadow" style="border-radius: 4px;border: 1px solid rgba(0, 0, 0, 0.12);"> <div class="row q-ma-sm shadow" style="border-radius: 4px;border: 1px solid rgba(0, 0, 0, 0.12);">
<CBigBtn <CBigBtn
label="Lavoro" to="/work" icon="fas fa-bullhorn" color="blue"> label="Bacheca" to="/bacheca" icon="fas fa-bullhorn" color="blue">
</CBigBtn> </CBigBtn>
<CBigBtn <CBigBtn
label="Scuola" to="/school" icon="fas fa-book-reader" color="orange" disable> label="Scuola" to="/school" icon="fas fa-book-reader" color="orange" disable>

View File

@@ -426,6 +426,8 @@ export default defineComponent({
let myarr: any = [] let myarr: any = []
let mystr = val.toLocaleLowerCase()
myarr = updateArrOptions() myarr = updateArrOptions()
if (!fieldsTable.tableRemotePickup.includes(props.tablesel)) { if (!fieldsTable.tableRemotePickup.includes(props.tablesel)) {
if (myarr && myarr.length > 0) { if (myarr && myarr.length > 0) {
@@ -435,6 +437,16 @@ export default defineComponent({
valori.value = [] valori.value = []
} }
} }
if (!props.multiple && !props.multiselect_by_server) {
if (val === '') {
valori.value = myarr
} else {
valori.value = myarr.filter((v: any) => v[`${props.optlab}`].toLowerCase().indexOf(mystr) > -1)
}
}
return return
} }
@@ -444,8 +456,6 @@ export default defineComponent({
return return
} }
let mystr = val.toLocaleLowerCase()
// console.log('props.tablesel', props.tablesel) // console.log('props.tablesel', props.tablesel)
if (fieldsTable.tableRemotePickup.includes(props.tablesel)) { if (fieldsTable.tableRemotePickup.includes(props.tablesel)) {

View File

@@ -2,13 +2,13 @@
<div class="text-center"> <div class="text-center">
<div v-if="multiselect_by_server"> <div v-if="multiselect_by_server">
<q-select <q-select
v-bind="$attrs"
:model-value="myarrvalue" :model-value="myarrvalue"
@update:model-value="changeval"
v-bind="$attrs"
label-color="primary" label-color="primary"
:label="label" :label="label"
@filter="filterFn" @filter="filterFn"
@filter-abort="abortFilterFn" @filter-abort="abortFilterFn"
@update:model-value="changeval"
input-debounce="600" input-debounce="600"
rounded rounded
outlined outlined
@@ -24,6 +24,7 @@
:options="valori" :options="valori"
:option-value="optval" :option-value="optval"
class="combowidth" class="combowidth"
style="min-width: 250px"
> >
<template v-if="getIcon() && !sola_lettura" v-slot:prepend> <template v-if="getIcon() && !sola_lettura" v-slot:prepend>
<q-icon :name="getIcon()" /> <q-icon :name="getIcon()" />
@@ -72,12 +73,13 @@
<div v-else-if="pickup"> <div v-else-if="pickup">
<q-select <q-select
v-if="pickup" v-if="pickup"
filled
:model-value="myvalue" :model-value="myvalue"
@update:model-value="changeval"
clearable clearable
rounded
outlined
options-dense
use-input use-input
hide-selected
fill-input
input-debounce="300" input-debounce="300"
:dense="dense" :dense="dense"
:input-class="myclass" :input-class="myclass"
@@ -86,11 +88,10 @@
:option-label="optlab" :option-label="optlab"
map-options map-options
@filter="filterFn" @filter="filterFn"
@update:model-value="changeval"
:label="label" :label="label"
options-selected-class="text-deep-orange" options-selected-class="text-deep-blue"
v-bind="$attrs" v-bind="$attrs"
style="width: 250px" class="combowidth"
> >
<template v-if="getIcon()" v-slot:prepend> <template v-if="getIcon()" v-slot:prepend>
<q-icon :name="getIcon()" /> <q-icon :name="getIcon()" />
@@ -187,6 +188,7 @@
:use-input="useinput" :use-input="useinput"
@new-value="newvaluefuncfirst" @new-value="newvaluefuncfirst"
emit-value emit-value
input-debounce="0"
options-selected-class="text-deep-orange" options-selected-class="text-deep-orange"
map-options map-options
v-bind="$attrs" v-bind="$attrs"

View File

@@ -382,10 +382,10 @@ const baseroutes: IListRoutes[] = [
{ {
active: true, active: true,
order: 100, order: 100,
path: '/work', path: '/bacheca',
materialIcon: 'fas fa-bullhorn', materialIcon: 'fas fa-bullhorn',
name: 'mypages.work', name: 'mypages.work',
component: () => import('@/root/work/work.vue'), component: () => import('@/root/bacheca/bacheca.vue'),
meta: { requiresAuth: true }, meta: { requiresAuth: true },
inmenu: true, inmenu: true,
infooter: true, infooter: true,

View File

@@ -553,6 +553,7 @@ export interface ISearchList {
showcount?: boolean showcount?: boolean
tablesel?: string tablesel?: string
icon?: string icon?: string
filteradv?: boolean
} }
export interface IFilter { export interface IFilter {

View File

@@ -19,7 +19,7 @@ import MixinUsers from '@/mixins/mixin-users'
export default defineComponent({ export default defineComponent({
name: 'work', name: 'bacheca',
components: { CSkill, CChartMap, CMapsEsempio, CFinder, CVerifyEmail, CVerifyTelegram, CDashboard, CUserNonVerif }, components: { CSkill, CChartMap, CMapsEsempio, CFinder, CVerifyEmail, CVerifyTelegram, CDashboard, CUserNonVerif },
setup() { setup() {
const globalStore = useGlobalStore() const globalStore = useGlobalStore()

View File

@@ -21,8 +21,8 @@
</q-page> </q-page>
</template> </template>
<script lang="ts" src="./work.ts"> <script lang="ts" src="./bacheca.ts">
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import './work.scss'; @import './bacheca.scss';
</style> </style>

View File

@@ -100,6 +100,7 @@ export const costanti = {
hours: 8000, hours: 8000,
crypted: 9000, crypted: 9000,
object: 10000, object: 10000,
separator: 11000,
}, },
FieldTypeArr: [ FieldTypeArr: [