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,
order: 10,
path: '/work',
path: '/bacheca',
materialIcon: 'fas fa-bullhorn',
name: 'mypages.work',
component: () => import('@/root/work/work.vue'),
component: () => import('@/root/bacheca/bacheca.vue'),
meta: { requiresAuth: true },
inmenu: true,
infooter: true,

View File

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

View File

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

View File

@@ -90,6 +90,32 @@ export default defineComponent({
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',
table: 'adtypes',
@@ -138,6 +164,20 @@ 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',
@@ -148,32 +188,6 @@ export default defineComponent({
filter: null,
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',
table: 'levels',
@@ -184,6 +198,7 @@ export default defineComponent({
type: costanti.FieldType.select,
filter: null,
useinput: false,
filteradv: true,
},
{
label: 'Stato',
@@ -195,6 +210,7 @@ export default defineComponent({
filter: null,
useinput: false,
icon: 'mood',
filteradv: true,
},
{
label: 'Contributo',
@@ -206,6 +222,7 @@ export default defineComponent({
filter: null,
useinput: false,
icon: 'currency_exchange',
filteradv: true,
//icon: 'swap_horizontal_circle',
},

View File

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

View File

@@ -105,9 +105,15 @@
<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>
<CMySelect
:col="fieldsTable.getColByTable(mytable, item.key)"
v-if="(item.type === costanti.FieldType.select) || (item.type === costanti.FieldType.select_by_server)"
v-show="(item.filteradv && showfilteradv) || !item.filteradv"
:label="labelcombo(item)"
v-model:value="item.value"
@update:value="searchval(item.value, item.table)"
@@ -131,6 +137,7 @@
<CMySelect
v-if="item.type === costanti.FieldType.multiselect_by_server"
v-show="(item.filteradv && showfilteradv) || !item.filteradv"
:col="fieldsTable.getColByTable(mytable, item.key)"
:multiselect_by_server="true"
:label="labelcombo(item)"
@@ -153,6 +160,7 @@
<q-select
v-if="(item.type === costanti.FieldType.multiselect)"
v-show="(item.filteradv && showfilteradv) || !item.filteradv"
v-model="item.arrvalue"
label-color="primary"
:label="labelcombo(item)"
@@ -212,10 +220,12 @@
<div v-if="(prop_search || canEdit)"
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
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>
<q-btn v-if="mytable" dense label="" color="primary" @click="refresh" icon="search"></q-btn>
</template>

View File

@@ -2,7 +2,7 @@
<div>
<div class="row q-ma-sm shadow" style="border-radius: 4px;border: 1px solid rgba(0, 0, 0, 0.12);">
<CBigBtn
label="Lavoro" to="/work" icon="fas fa-bullhorn" color="blue">
label="Bacheca" to="/bacheca" icon="fas fa-bullhorn" color="blue">
</CBigBtn>
<CBigBtn
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 mystr = val.toLocaleLowerCase()
myarr = updateArrOptions()
if (!fieldsTable.tableRemotePickup.includes(props.tablesel)) {
if (myarr && myarr.length > 0) {
@@ -435,6 +437,16 @@ export default defineComponent({
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
}
@@ -444,8 +456,6 @@ export default defineComponent({
return
}
let mystr = val.toLocaleLowerCase()
// console.log('props.tablesel', props.tablesel)
if (fieldsTable.tableRemotePickup.includes(props.tablesel)) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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