Aggiunto il filtro per Provincia

This commit is contained in:
paoloar77
2022-01-23 23:25:19 +01:00
parent 6e54fa06c4
commit 030523c8ee
25 changed files with 1097 additions and 405 deletions

View File

@@ -61,6 +61,16 @@ export default defineComponent({
}
}
function getFilterCitiesByProvince(recSubSkill: any, index: number, arr: any) {
const recprov:any = searchList.value.find((rec) => rec.table === 'provinces')
// console.log('recSubSkill', recSubSkill, 'recskills', recskills)
if (recprov) {
return recSubSkill.idSkill === recprov.value
} else {
return true
}
}
searchList.value = [
{
@@ -110,15 +120,28 @@ export default defineComponent({
useinput: true,
},*/
{
label: 'Citta',
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,
notinsearch: true,
},
{
label: 'Città',
table: 'cities',
key: 'idCity',
key: 'idProvince',
type: costanti.FieldType.multiselect_by_server,
value: 0,
addall: true,
arrvalue: tools.getCookie(tools.COOK_SEARCH + 'cities', [costanti.FILTER_TUTTI]),
filter: null,
useinput: true,
filter: getFilterCitiesByProvince,
// param1: shared_consts.PARAM_SHOW_PROVINCE,
tablesel: 'cities',
},
{
@@ -248,10 +271,10 @@ export default defineComponent({
af_objId_tab: '',
},
lookup5: {
lk_tab: 'cities',
lk_LF: 'idCity',
lk_FF: '_id',
lk_as: 'comune',
lk_tab: 'provinces',
lk_LF: 'idProvince',
lk_FF: 'prov',
lk_as: 'descr',
af_objId_tab: '',
},
}

View File

@@ -12,6 +12,7 @@
nodataLabel="Nessuna Competenza trovata"
:prop_search="true"
:finder="true"
:choose_visutype="true"
:butt_modif_new="false"
noresultLabel="Il filtro selezionato non ha trovato nessun risultato"
:arrfilters="arrfilterand"

View File

@@ -328,6 +328,14 @@ export default defineComponent({
fullscreensrc.value = getfullname(mygallery)
}
function onRejected (rejectedEntries: any) {
// Notify plugin needs to be installed
// https://quasar.dev/quasar-plugins/notify#Installation
$q.notify({
type: 'negative',
message: 'La Dimensione massima dell\'immagine è di 2 MB'
})
}
onMounted(created)
return {
@@ -355,6 +363,7 @@ export default defineComponent({
ImgFullScreen,
fullscreen,
fullscreensrc,
onRejected,
}
}
})

View File

@@ -101,6 +101,7 @@
hide-upload-btn
no-thumbnails
@uploaded="uploaded"
@rejected="onRejected"
style="width: 208px"
></q-uploader>
</div>
@@ -215,6 +216,7 @@
hide-upload-btn
no-thumbnails
@uploaded="uploaded"
@rejected="onRejected"
style="width: 208px"
></q-uploader>
</div>

View File

@@ -167,6 +167,11 @@ export default defineComponent({
type: Boolean,
required: false,
default: true
},
choose_visutype: {
type: Boolean,
required: false,
default: false
}
},
components: { CMyPopupEdit, CTitleBanner, CMyFieldDb, CMySelect, CMyFriends },
@@ -1116,7 +1121,17 @@ export default defineComponent({
data: {}
}
mydata.data = newRecord.value
const myobj = newRecord.value
//++ Eliminare eventuali campi ?
mycolumns.value.forEach((col:IColGridTable) => {
if (col.notsave) {
delete myobj[col.name]
}
})
mydata.data = myobj
const data = await globalStore.saveTable(mydata)
.then((ris) => {

View File

@@ -134,6 +134,7 @@
:addall="true"
:tablesel="item.tablesel"
:pickup="true"
:param1="item.param1"
label-color="primary"
class="combowidth"
color="primary"
@@ -233,7 +234,7 @@
<div v-if="pagination.rowsNumber === 1 && prop_search">{{ pagination.rowsNumber }} elemento trovato</div>
<div v-if="pagination.rowsNumber > 1 && prop_search">{{ pagination.rowsNumber }} elementi trovati</div>
<div v-if="finder" class="">
<div v-if="choose_visutype" class="">
<q-radio v-model="myvertical" :val="2" label="Lista"
@update:model-value="tools.setCookie('myv', myvertical) "/>
<q-radio v-model="myvertical" :val="-1" label="Scheda"
@@ -326,8 +327,9 @@
<q-card-section class="inset-shadow">
<q-list dense>
<div v-for="col in mycolumns" :key="col.name">
<q-item v-if="colVisib.includes(col.field + col.subfield) &&
!col.noshowifnone || (col.noshowifnone && !!props.row.value)"
(!col.noshowifnone || (col.noshowifnone && tools.getValue(props.row,col.field, col.subfield)))"
:class="clByCol(col)" class="riduci_pad">
<q-item-section avatar v-if="visuIntestazCol(col)">

View File

@@ -595,6 +595,19 @@ export default defineComponent({
)
}
function getTitleEditor(col: IColGridTable, row: any) {
let title = ''
if (!!col.field_extra1) {
try {
title = tools.getValue(row, col.field_extra1, col.subfield_extra1!)
}catch (e){}
}
return title
}
onBeforeMount(mounted)
crea()
@@ -631,6 +644,7 @@ export default defineComponent({
col,
myImgGall,
noPopupeditByCol,
getTitleEditor,
}
}
})

View File

@@ -31,12 +31,15 @@
</div>
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.string">
<div v-if="visulabel || isInModif" :class="{ flex: !isInModif }">
<div v-if="visulabel || isInModif" :class="{ flex: !isInModif}">
<q-input
v-bind="$attrs"
v-model="myvalue"
autogrow
:style="$q.screen.lt.sm ? 'min-width: 300px' : ''"
counter
:maxlength="col.maxlength ? col.maxlength : undefined"
:disable="disable"
:readonly="disable"
@keyup.enter.stop
@@ -99,7 +102,7 @@
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.listimages" style="text-align: center;">
<p v-if="isInModif">
{{ $t('reg.images') }}:
{{ $t('reg.image') }}:
</p>
<CGallery
:title="getTitleGall()"
@@ -243,7 +246,24 @@
<!-- Show Value -->
<div v-else-if="col.fieldtype === costanti.FieldType.multiselect">
<div v-if="isInModif">
<q-select
<CMySelect
:multiple="true"
:withToggle="true"
:label="col.label"
v-model:arrvalue="myvalue"
@update:arrvalue="changevalRec"
:addall="false"
label-color="primary"
class="combowidth"
color="primary"
:optval="fieldsTable.getKeyByTable(col.jointable)"
:optlab="fieldsTable.getLabelByTable(col.jointable)"
:options="globalStore.getTableJoinByName(col.jointable, col.addall, col.filter)"
:sola_lettura="!isInModif"
:useinput="false">
</CMySelect>
<!--<q-select
v-model="myvalue"
rounded
outlined
@@ -270,7 +290,7 @@
</q-item>
</template>
</q-select>
</q-select>-->
</div>
<div v-else>
@@ -360,9 +380,12 @@
<div v-if="insertMode">
</div>
<p v-if="isInModif" class="text-center">
{{ $t('event.testo_di_spiegazione') }}:
</p>
<div v-if="!isFieldDb()">
<CMyEditor
v-model:value="myvalue" :title="col.title" @keyup.enter.stop
v-model:value="myvalue" :title="getTitleEditor(col, row)" @keyup.enter.stop
:showButtons="false"
:canModify="canModify"
@update:value="changevalRec"
@@ -379,10 +402,12 @@
<!--<div v-html="visuValByType(myvalue, col, row)" @click="visueditor = true"></div>-->
<div v-if="!isFieldDb()">
<q-dialog v-model="visuhtml" full-height full-width auto-close>
<q-dialog v-model="visuhtml" full-height full-width>
<q-card>
<q-bar dense class="bg-primary text-white">
<span class="ellipsis"> {{ getTitleEditor(col, row) }} </span>
<q-space/>
<q-btn flat round color="white" icon="close" v-close-popup></q-btn>
</q-bar>
<q-card-section class="inset-shadow">
<q-card class="dialog_card">
@@ -437,7 +462,7 @@
v-slot="scope">
<div v-if="col.fieldtype === costanti.FieldType.boolean">
<q-checkbox v-model="scope.value" :label="col.title">
<q-checkbox v-model="scope.value" :label="col.title ? col.title : col.titlepopupedit">
</q-checkbox>
<span v-html="visuValByType(myvalue, col, row)"></span>
</div>
@@ -445,6 +470,7 @@
<q-input
v-bind="$attrs"
counter
:maxlength="col.maxlength ? col.maxlength : undefined"
v-model="scope.value"
autogrow
@keyup.enter.stop

View File

@@ -82,6 +82,10 @@ export default defineComponent({
sola_lettura: {
type: Boolean,
default: false,
},
withToggle: {
type: Boolean,
default: false,
}
},
components: {},
@@ -116,7 +120,8 @@ export default defineComponent({
watch(() => props.options, (value: any, oldval: any) => {
if (!props.multiselect_by_server) {
valori.value = valoriload.value
// console.log('@@@ VALORI CHANGED (1)', valori.value)
} else {
console.log('@@@ VALORI CHANGED (1)', valori.value)
}
},
)
@@ -170,8 +175,8 @@ export default defineComponent({
function changeval(newval: any) {
// console.log(' ½½½½½½½ changeval', newval)
if (props.multiselect_by_server) {
console.log(' ½½½½½½½ changeval', newval)
if (props.multiple || props.multiselect_by_server) {
// localStorage.setItem(props.tablesel + '_' + newval, valori.value[newval])
myarrvalue.value = newval && newval['arrvalue'] ? newval['arrvalue'] : newval
saveOptInCookie(newval)
@@ -249,9 +254,9 @@ export default defineComponent({
}
// }
}
console.log('@@@ VALORI CHANGED (4)', valori.value)
if (!props.multiselect_by_server) {
valori.value = valoriload.value
console.log('@@@ VALORI CHANGED (4)', valori.value)
} else {
valori.value = arrtempOpt.value
}
@@ -260,50 +265,34 @@ export default defineComponent({
function filterFn(val: any, update: any, abort: any) {
update(
() => {
async () => {
console.log('Filter val', val, val.length)
let myarr: any = []
if (val.length <= 1) {
valori.value = arrtempOpt.value
console.log('@@@ LENGTH <= 1')
abort()
return
}
let mystr = val.toLocaleLowerCase()
console.log('props.tablesel', props.tablesel)
// console.log('props.tablesel', props.tablesel)
if (fieldsTable.tableRemotePickup.includes(props.tablesel)) {
try {
myarr = props.options
if (mystr !== '')
return globalStore.loadPickup({ table: props.tablesel, search: mystr })
.then((ris) => {
myarr = props.options
if (ris) {
if (props.addall) {
let myobj: any = {}
if (typeof props.optlab === 'string') {
myobj[props.optlab] = '(Tutti)'
myobj[props.optval] = costanti.FILTER_TUTTI
}
ris = [myobj, ...ris]
}
valori.value = ris
if (props.multiselect_by_server) {
console.log('@@@ VALORI CHANGED (2)', valori.value)
}
}
})
// myarr = [{_id:1, prov: 'RN', descr: 'Rimini'}]
myarr = await globalStore.loadPickup({ table: props.tablesel, search: mystr.trim() })
if (myarr === null) {
console.log('@@@ VALORI VALUE XXX', valori.value)
valori.value = arrtempOpt.value
return
}
} catch (e) {
console.log('@@@ VALORI VALUE XXX', valori.value)
valori.value = arrtempOpt.value
return
}
// const needle = val.toLocaleLowerCase()
// optFiltered.value = optFiltered.value.filter((v: any) => v.toLocaleLowerCase().indexOf(needle) > -1)
@@ -332,6 +321,7 @@ export default defineComponent({
},
// "ref" is the Vue reference to the QSelect
(ref: any) => {
// console.log('ref.options', ref.options)
if (val !== '' && ref.options.length > 0) {
ref.setOptionIndex(-1) // reset optionIndex in case there is something selected
ref.moveOptionSelection(1, true) // focus the first selectable option and do not update the input-value

View File

@@ -9,7 +9,7 @@
@filter="filterFn"
@filter-abort="abortFilterFn"
@update:model-value="changeval"
input-debounce="300"
input-debounce="600"
rounded
outlined
multiple
@@ -66,29 +66,7 @@
</q-select>
</div>
<div v-else-if="useinput">
<q-select
:multiple="multiple"
rounded
outlined
v-bind="$attrs"
:input-class="myclass"
:model-value="myvalue"
:use-input="useinput"
input-debounce="0"
@new-value="newvaluefunc"
new-value-mode="add-unique"
map-options
emit-value
:options="valori"
:option-value="optval"
:option-label="optlab"
@update:model-value="changeval"
:label="label"
:dense="dense">
</q-select>
</div>
<div v-else>
<div v-else-if="pickup">
<q-select
v-if="pickup"
filled
@@ -126,9 +104,67 @@
</q-item>
</template>
</q-select>
</div>
<div v-else-if="multiple">
<q-select
v-else
:multiple="multiple"
:multiple="true"
:model-value="myarrvalue"
label-color="primary"
:label="label"
@update:model-value="changeval"
rounded
outlined
v-bind="$attrs"
:input-class="myclass"
:use-input="useinput"
input-debounce="0"
@new-value="newvaluefunc"
new-value-mode="add-unique"
map-options
emit-value
stack-label
:options="valori"
:option-value="optval"
:option-label="optlab"
:dense="dense">
<template
v-slot:selected-item="scope">
<div v-if="scope.opt[optlab]">
<q-chip
removable
dense
@remove="scope.removeAtIndex(scope.index)"
v-if="checkIfShowRec(scope.opt)"
color="white"
text-color="mycol"
class="q-my-none q-ml-xs q-mr-none"
>
<q-avatar color="primary" text-color="white" :icon="scope.opt.icon ? scope.opt.icon : ''" size="12px"/>
{{ scope.opt[optlab] }}
</q-chip>
</div>
</template>
<template
v-if="withToggle"
v-slot:option="{ itemProps, opt, selected, toggleOption }">
<q-item v-bind="itemProps">
<q-item-section>
<q-item-label>{{ opt[optlab] }}</q-item-label>
</q-item-section>
<q-item-section side>
<q-toggle :model-value="selected" @update:value="toggleOption(opt)"/>
</q-item-section>
</q-item>
</template>
</q-select>
</div>
<div v-else>
<q-select
:multiple="false"
rounded
outlined
:dense="dense"

View File

@@ -9,6 +9,7 @@
prop_colkey="idSkill"
col_title="subTitle"
:vertical="true"
:choose_visutype="true"
nodataLabel="Nessuna Competenza inserita"
:prop_search="false"
noresultLabel="Il filtro selezionato non ha trovato nessun risultato"