11<template lang="pug">
22.row.q-gutter-sm.items-center.q-mt-sm
3- //- .col.col-md-2
4- //- q-select(:options="fieldTypes" label="Type de champ" v-model="fieldType" clearable @update:model-value="clearFields(['field', 'comparator'])")
5- .col.col-md-2
6- q-select( :options ="fields" label ="Champs" v-model ="field" clearable @update:model-value ="onFieldChange($event)" )
7- .col.col-md-2
8- q-select( :options ="comparatorFilteredByType" label ="Comparateurs" v-model ="comparator" clearable @update:model-value ="clearFields([])" : disable= "isFieldDisabled.comparator" )
9- template( v-slot:selected-item ="scope" )
10- q-icon( :name ="scope.opt.icon" size ="xs" )
11- template( v-slot:option ="scope" )
12- q-item( v-bind ="scope.itemProps" )
13- q-item-section( avatar )
14- q-icon( :name ="scope.opt.icon" )
15- q-item-section
16- q-item-label
17- span {{ scope.opt.label }}
18-
19- .col-12.col-md-2 ( v-show ="!comparator?.multiplefields" )
20- q-input( v-model ="search" label ="Rechercher" clearable :type ="searchInputType" : disable= "isFieldDisabled.search" : prefix= "comparator?.prefix" : suffix= "comparator?.suffix" )
21- .col-6.col-md-2 ( v-show ="comparator?.multiplefields" )
22- q-input( v-model ="searchMin" label ="Min" clearable :type ="searchInputType" : disable= "isFieldDisabled.search" )
23- .col-6.col-md-2 ( v-show ="comparator?.multiplefields" )
24- q-input( v-model ="searchMax" label ="Max" clearable :type ="searchInputType" : disable= "isFieldDisabled.search" )
25- .col-12.col-md-1
26- q-btn( color ="primary" @click ="addFilter" : disable= "isFieldDisabled.addButton" ) Ajouter
27- q-space
28- .col-12.col-md-2
29- tk-SearchfiltersRightSelect( ref ="rightSelect" )
3+ //- .col.col-md-2
4+ //- q-select(:options="fieldTypes" label="Type de champ" v-model="fieldType" clearable @update:model-value="clearFields(['field', 'comparator'])")
5+ .col.col-md-2
6+ q-select( :options ="fields" label ="Champs" v-model ="field" clearable @update:model-value ="onFieldChange($event)" )
7+ .col.col-md-2
8+ q-select( :options ="comparatorFilteredByType" label ="Comparateurs" v-model ="comparator" clearable @update:model-value ="clearFields([])" : disable= "isFieldDisabled.comparator" )
9+ template( v-slot:selected-item ="scope" )
10+ q-icon( :name ="scope.opt.icon" size ="xs" )
11+ template( v-slot:option ="scope" )
12+ q-item( v-bind ="scope.itemProps" )
13+ q-item-section( avatar )
14+ q-icon( :name ="scope.opt.icon" )
15+ q-item-section
16+ q-item-label
17+ span {{ scope.opt.label }}
18+
19+ .col-12.col-md-2 ( v-show ="!comparator?.multiplefields" )
20+ q-input( v-model ="search" label ="Rechercher" clearable :type ="searchInputType" : disable= "isFieldDisabled.search" : prefix= "comparator?.prefix" : suffix= "comparator?.suffix" )
21+ .col-6.col-md-2 ( v-show ="comparator?.multiplefields" )
22+ q-input( v-model ="searchMin" label ="Min" clearable :type ="searchInputType" : disable= "isFieldDisabled.search" )
23+ .col-6.col-md-2 ( v-show ="comparator?.multiplefields" )
24+ q-input( v-model ="searchMax" label ="Max" clearable :type ="searchInputType" : disable= "isFieldDisabled.search" )
25+ .col-12.col-md-1
26+ q-btn( color ="primary" @click ="addFilter" : disable= "isFieldDisabled.addButton" ) Ajouter
27+ q-space
28+ .col-12.col-md-2
29+ tk-SearchfiltersRightSelect( ref ="rightSelect" )
3030</template >
3131
3232<script lang="ts" setup>
3333import { ref , computed , inject } from ' vue'
3434import { useRouter , useRoute } from ' nuxt/app'
3535import { useDayjs } from ' #imports' ;
36+ import { pushQuery } from ' ~/composables'
3637import type { Filter , Field , Comparator , SearchFilter } from ' ~/types'
3738const dayjs = useDayjs ()
3839
@@ -70,7 +71,7 @@ const comparatorTypes = ref<Comparator[]>([
7071 { label: ' Inférieur à' , querySign: ' <' , value: ' <' , icon: ' mdi-less-than' , type: [' number' , ' date' ], multiplefields: false , prefix: ' ' , suffix: ' ' },
7172 { label: ' Inférieur ou égal à' , querySign: ' <=' , value: ' <=' , icon: ' mdi-less-than-or-equal' , type: [' number' , ' date' ], multiplefields: false , prefix: ' ' , suffix: ' ' },
7273 { label: ' entre' , querySign: ' <<' , value: ' between' , icon: ' mdi-arrow-expand-horizontal' , type: [' number' , ' date' ], multiplefields: true , prefix: ' ' , suffix: ' ' },
73- { label: ' Contiens' , querySign: ' ^' , value: ' ^' , icon: ' mdi-apple-keyboard-control' , type: [' text' ], multiplefields: false , prefix: ' /' , suffix: ' /' },
74+ { label: ' Contiens' , querySign: ' ^' , value: ' ^' , icon: ' mdi-apple-keyboard-control' , type: [' text' ], multiplefields: false , prefix: ' /' , suffix: ' /i ' },
7475 { label: ' Commence par' , querySign: ' ^' , value: ' /^' , icon: ' mdi-apple-keyboard-control' , type: [' text' ], multiplefields: false , prefix: ' /^' , suffix: ' /' },
7576 { label: ' Fini par' , querySign: ' ^' , value: ' $/' , icon: ' mdi-apple-keyboard-control' , type: [' text' ], multiplefields: false , prefix: ' /' , suffix: ' $/' },
7677 { label: ' Egal à' , querySign: ' @' , value: ' @' , icon: ' mdi-apple-keyboard-control' , type: [], multiplefields: true , prefix: ' ' , suffix: ' ' },
@@ -95,11 +96,11 @@ const addFilter = async () => {
9596 if (! searchFilter ) return
9697 if (searchFilter .comparator .multiplefields ) {
9798 for (const { key, value } of parseMultipleFilter (searchFilter )) {
98- await pushQuery (key , value )
99+ await pushQuery ({ key , value } )
99100 }
100101 } else {
101102 const { key, value } = parseSimpleFilter (searchFilter )
102- await pushQuery (key , value )
103+ await pushQuery ({ key , value } )
103104 }
104105}
105106
@@ -130,15 +131,15 @@ const parseMultipleFilter = (searchFilter: SearchFilter) => {
130131 return [min , max ]
131132}
132133
133- const pushQuery = async (key : string , value : string ) => {
134- const query = {
135- ... route .query ,
136- }
137- query [key ] = value
138- await router .push ({
139- query
140- })
141- }
134+ // const pushQuery = async (key: string, value: string) => {
135+ // const query = {
136+ // ...route.query,
137+ // }
138+ // query[key] = value
139+ // await router.push({
140+ // query
141+ // })
142+ // }
142143
143144const getSearchFilter = computed (() => {
144145 if (field .value === undefined || field .value === null ) return null
0 commit comments