From a31d10ceb869a6dddc3e14689ce0d99ab2495fa3 Mon Sep 17 00:00:00 2001 From: paoloar77 Date: Mon, 28 Feb 2022 03:33:21 +0100 Subject: [PATCH] =?UTF-8?q?Ora=20cambiando=20Settore,=20la=20Categoria=20v?= =?UTF-8?q?iene=20sbiancata=20su=20"Nessuno"=20(anche=20se=20ancora=20rima?= =?UTF-8?q?ne=20visivamente=20selezionato)=20i=20campi=20obbligatori=20non?= =?UTF-8?q?=20funziona=20il=20controllo=3F=20(Erano=20i=20campi=20di=20tip?= =?UTF-8?q?o=20Array)=20Aggiunta=20Categoria=20Ecovillaggi=20/=20Comunit?= =?UTF-8?q?=C3=A0=20+=20AutoProduzione=20Aggiunte=20consulenza,=20affranca?= =?UTF-8?q?mento,=20supporto..=20su=20temi=20di=20LAVORO=20Quando=20inseri?= =?UTF-8?q?sci=20un=20nuovo=20annuncio,=20prendi=20di=20default=20tutti=20?= =?UTF-8?q?i=20filtri=20visualizzati=20Aggiungere=20bottone=20"Condividi?= =?UTF-8?q?=20Pagina"=20sui=20gruppi?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 2 +- _ALL_SITES/freeplanet.app/.env.development | 2 +- _ALL_SITES/insiemesipuo.app/.env.development | 2 +- .../popolodelnuovomondo.app/.env.development | 2 +- src/components/CFinder/CFinder.ts | 28 +++--- src/components/CGridTableRec/CGridTableRec.ts | 68 +++++++++----- .../CGridTableRec/CGridTableRec.vue | 4 +- .../CMyCardGrpPopup/CMyCardGrpPopup.ts | 5 ++ .../CMyCardGrpPopup/CMyCardGrpPopup.vue | 21 +++-- src/components/CMyGroup/CMyGroup.ts | 6 +- src/components/CMyGroup/CMyGroup.vue | 4 +- src/components/CMyPopupEdit/CMyPopupEdit.vue | 39 ++++---- src/components/CMySelect/CMySelect.ts | 57 +++++++++++- src/model/GlobalStore.ts | 1 + src/rootgen/admin/importdata/importdata.ts | 3 +- src/store/Modules/costanti.ts | 1 + src/store/Modules/fieldsTable.ts | 20 +++-- src/store/Modules/tools.ts | 88 ++++++++++++++----- src/store/Modules/toolsext.ts | 2 + src/store/globalStore.ts | 17 +++- 20 files changed, 268 insertions(+), 104 deletions(-) diff --git a/.env.development b/.env.development index ebdc7386..23c6dd4f 100755 --- a/.env.development +++ b/.env.development @@ -1,4 +1,4 @@ -APP_VERSION="0.2.13" +APP_VERSION="0.2.14" SERVICE_WORKER_FILE="service-worker.js" APP_ID="13" DIRECTORY_LOCAL="newfreeplanet" diff --git a/_ALL_SITES/freeplanet.app/.env.development b/_ALL_SITES/freeplanet.app/.env.development index e69c9cb7..8e75b9b8 100755 --- a/_ALL_SITES/freeplanet.app/.env.development +++ b/_ALL_SITES/freeplanet.app/.env.development @@ -1,4 +1,4 @@ -APP_VERSION="0.2.13" +APP_VERSION="0.2.14" SERVICE_WORKER_FILE="service-worker.js" APP_ID="1" DIRECTORY_LOCAL="newfreeplanet" diff --git a/_ALL_SITES/insiemesipuo.app/.env.development b/_ALL_SITES/insiemesipuo.app/.env.development index ebdc7386..23c6dd4f 100755 --- a/_ALL_SITES/insiemesipuo.app/.env.development +++ b/_ALL_SITES/insiemesipuo.app/.env.development @@ -1,4 +1,4 @@ -APP_VERSION="0.2.13" +APP_VERSION="0.2.14" SERVICE_WORKER_FILE="service-worker.js" APP_ID="13" DIRECTORY_LOCAL="newfreeplanet" diff --git a/_ALL_SITES/popolodelnuovomondo.app/.env.development b/_ALL_SITES/popolodelnuovomondo.app/.env.development index 5bc6b8a3..3cb19371 100755 --- a/_ALL_SITES/popolodelnuovomondo.app/.env.development +++ b/_ALL_SITES/popolodelnuovomondo.app/.env.development @@ -1,4 +1,4 @@ -APP_VERSION="0.2.13" +APP_VERSION="0.2.14" SERVICE_WORKER_FILE="service-worker.js" APP_ID="12" DIRECTORY_LOCAL="newfreeplanet" diff --git a/src/components/CFinder/CFinder.ts b/src/components/CFinder/CFinder.ts index c58ed0ce..4fbf6ff5 100755 --- a/src/components/CFinder/CFinder.ts +++ b/src/components/CFinder/CFinder.ts @@ -60,7 +60,7 @@ export default defineComponent({ /* const idSectorServizi = computed(() => { let myval: any = null - myval = searchList_Servizi.value.find((rec) => (rec.table === 'sectors')) + myval = searchList_Servizi.value.find((rec) => (rec.table === toolsext.TABSECTORS)) if (myval) { const ris = myval.value || 0 // console.log('idSectorServizi=', ris) @@ -165,9 +165,9 @@ 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 === toolsext.TABSECTORS) // console.log('getFilterSkills', recSkill.idSector, recsectors.value) - if (recsectors) { + if (recsectors && recSkill.idSector) { return recSkill.idSector.includes(recsectors.value) } else { return true @@ -177,7 +177,7 @@ export default defineComponent({ function getFilterGoods(recGood: any, index: number, arr: any) { const recsectorGoods: any = searchList.value.find((rec) => rec.table === 'sectorgoods') // console.log('getFilterSkills', recSkill.idSector, recsectors.value) - if (recsectorGoods) { + if (recsectorGoods && recGood.idSectorGood) { return recGood.idSectorGood.includes(recsectorGoods.value) } else { return true @@ -281,9 +281,9 @@ export default defineComponent({ }, { label: 'Settore', - table: 'sectors', + table: toolsext.TABSECTORS, key: 'idSector', - value: tools.getCookie(tools.COOK_SEARCH + 'sectors', 0), + value: tools.getCookie(tools.COOK_SEARCH + toolsext.TABSECTORS, 0), arrvalue: [], type: costanti.FieldType.select, filter: null, @@ -295,7 +295,7 @@ export default defineComponent({ label: 'Categoria', table: 'skills', key: 'idSkill', - value: tools.getCookie(tools.COOK_SEARCH + 'skills' + '_' + tools.getCookie(tools.COOK_SEARCH + 'sectors', costanti.FILTER_TUTTI), costanti.FILTER_TUTTI), + value: tools.getCookie(tools.COOK_SEARCH + 'skills' + '_' + tools.getCookie(tools.COOK_SEARCH + toolsext.TABSECTORS, costanti.FILTER_TUTTI), costanti.FILTER_TUTTI), arrvalue: [], type: costanti.FieldType.select, addall: true, @@ -444,9 +444,9 @@ export default defineComponent({ }, { label: 'Settore', - table: 'sectors', + table: toolsext.TABSECTORS, key: 'idSector', - value: tools.getCookie(tools.COOK_SEARCH + 'sectors', 0), + value: tools.getCookie(tools.COOK_SEARCH + toolsext.TABSECTORS, 0), arrvalue: [], type: costanti.FieldType.select, filter: null, @@ -458,7 +458,7 @@ export default defineComponent({ label: 'Categoria', table: 'skills', key: 'idSkill', - value: tools.getCookie(tools.COOK_SEARCH + 'skills' + '_' + tools.getCookie(tools.COOK_SEARCH + 'sectors', costanti.FILTER_TUTTI), costanti.FILTER_TUTTI), + value: tools.getCookie(tools.COOK_SEARCH + 'skills' + '_' + tools.getCookie(tools.COOK_SEARCH + toolsext.TABSECTORS, costanti.FILTER_TUTTI), costanti.FILTER_TUTTI), arrvalue: [], type: costanti.FieldType.select, addall: true, @@ -672,9 +672,9 @@ export default defineComponent({ table: 'cities', key: 'idCity', type: costanti.FieldType.select_by_server, - value: 0, + arrvalue: [], addall: true, - arrvalue: tools.getCookie(tools.COOK_SEARCH + 'cities', costanti.FILTER_TUTTI), + value: tools.getCookie(tools.COOK_SEARCH + 'cities', costanti.FILTER_TUTTI), useinput: true, filter: null, // filter: getFilterCitiesByProvince, @@ -891,7 +891,7 @@ export default defineComponent({ } }, lookup3: { - lk_tab: 'sectors', + lk_tab: toolsext.TABSECTORS, lk_LF: 'recSkill.idSector', lk_FF: '_id', lk_as: 'sector', @@ -952,7 +952,7 @@ export default defineComponent({ } }, lookup3: { - lk_tab: 'sectors', + lk_tab: toolsext.TABSECTORS, lk_LF: 'recSkill.idSector', lk_FF: '_id', lk_as: 'sector', diff --git a/src/components/CGridTableRec/CGridTableRec.ts b/src/components/CGridTableRec/CGridTableRec.ts index 7dc2a8e2..d373c429 100755 --- a/src/components/CGridTableRec/CGridTableRec.ts +++ b/src/components/CGridTableRec/CGridTableRec.ts @@ -280,15 +280,15 @@ export default defineComponent({ const myvertical = ref(props.vertical) - const valoriopt = computed(() => (item: any, addall: boolean) => { + const valoriopt = computed(() => (item: any, addall: boolean, addnone: boolean) => { // console.log('valoriopt', item.table) - return globalStore.getTableJoinByName(item.table, addall, item.filter) + return globalStore.getTableJoinByName(item.table, addall, addnone, item.filter) }) const labelcombo = computed(() => (item: any) => { let lab = item.label if (item.showcount) - lab += ' (' + valoriopt.value(item, false).length + ')' + lab += ' (' + valoriopt.value(item, false, false).length + ')' return lab }) @@ -319,7 +319,7 @@ export default defineComponent({ let trovato = false let arrvalues = [] if (rec) { - arrvalues = valoriopt.value(rec.value, false) + arrvalues = valoriopt.value(rec.value, false, false) if (arrvalues) trovato = arrvalues.find((rec: any) => rec[rec.key] === valsaved) } @@ -336,11 +336,16 @@ export default defineComponent({ } function searchval(newval: any, table: any) { - // console.log('searchval', newval, table) + console.log('searchval', newval, table) tools.setCookie(tools.COOK_SEARCH + table, newval) - if (table === 'sectors') { - setCategBySector('skills', table, newval) + if (table === toolsext.TABSKILLS) { + const recSector = searchList.value.find((rec) => rec.table === 'sectors') + if (recSector) { + tools.setCookie(tools.COOK_SEARCH + table + '_' + recSector.value, newval) + } + } else if (table === toolsext.TABSECTORS) { + setCategBySector(toolsext.TABSKILLS, table, newval) }else if (table === 'goods') { setCategBySector('sectorgoods', table, newval) } @@ -400,7 +405,7 @@ export default defineComponent({ let idRegion = 0 let idSkill = 0 if (searchList.value) { - recSector = searchList.value.find((item: ISearchList) => item.table === 'sectors') + recSector = searchList.value.find((item: ISearchList) => item.table === toolsext.TABSECTORS) idSector = recSector ? recSector.value : 0 } if (searchList.value) { @@ -420,7 +425,7 @@ export default defineComponent({ } if (searchList.value) { - recSkill = searchList.value.find((item: ISearchList) => item.table === 'skills') + recSkill = searchList.value.find((item: ISearchList) => item.table === toolsext.TABSKILLS) idSkill = recSkill ? recSkill.value : 0 console.log('recSkill', idSkill) } @@ -514,7 +519,7 @@ export default defineComponent({ } } else { - if ((item.table === 'skills') && item.value === costanti.FILTER_TUTTI) { + if ((item.table === toolsext.TABSKILLS) && item.value === costanti.FILTER_TUTTI) { let obj2: any = {} if (idSector > 0) { @@ -776,12 +781,20 @@ export default defineComponent({ function selItem(item: any, col: IColGridTable, inmodif?: boolean) { console.log('selItem', item, col) - rowsel = item - idsel = item._id - colsel.value = col if (inmodif) { } + if (col.jointable === toolsext.TABSECTORS) { + // Sbianca la select della Categoria + + if (item && item.hasOwnProperty('idSkill')) { + item['idSkill'] = costanti.FILTER_NESSUNO + newRecord.value['idSkill'] = item['idSkill'] + } + } + rowsel = item + idsel = item._id + colsel.value = col } function undoVal() { @@ -1328,14 +1341,23 @@ export default defineComponent({ let ok = true - mycolumns.value.forEach((col: IColGridTable) => { + //mycolumns.value.forEach((col: IColGridTable) => { + let col: IColGridTable + + for (col of mycolumns.value) { if (col.required) { // console.log('newRecord.value', newRecord.value, newRecord.value[col.name]) - if (!newRecord.value[col.name]) { - ok = false + if (tools.isArray(newRecord.value[col.name])) { + if (newRecord.value[col.name].length <= 0) { + return false + } + } else { + if (!newRecord.value[col.name]) { + return false + } } } - }) + } return ok } @@ -1347,9 +1369,15 @@ export default defineComponent({ for (col of mycolumns.value) { if (col.required) { // console.log('newRecord.value', newRecord.value, newRecord.value[col.name]) - if (!newRecord.value[col.name]) { - // console.log('col.name', col.name) - return translate(col.label_trans) + if (tools.isArray(newRecord.value[col.name])) { + if (newRecord.value[col.name].length <= 0){ + return translate(col.label_trans) + } + } else { + if (!newRecord.value[col.name]) { + // console.log('col.name', col.name) + return translate(col.label_trans) + } } } } diff --git a/src/components/CGridTableRec/CGridTableRec.vue b/src/components/CGridTableRec/CGridTableRec.vue index 1c837623..f4727e42 100755 --- a/src/components/CGridTableRec/CGridTableRec.vue +++ b/src/components/CGridTableRec/CGridTableRec.vue @@ -151,6 +151,7 @@ v-model:value="item.value" @update:value="searchval(item.value, item.table)" :addall="item.addall" + :addnone="item.addnone" :tablesel="item.type === costanti.FieldType.select_by_server ? item.tablesel : ''" :pickup="item.type === costanti.FieldType.select_by_server" label-color="primary" @@ -177,6 +178,7 @@ v-model:arrvalue="item.arrvalue" @update:arrvalue="searchval(item.arrvalue, item.table)" :addall="item.addall" + :addnone="item.addnone" :tablesel="item.tablesel" :pickup="true" :param1="item.param1" @@ -207,7 +209,7 @@ map-options stack-label :useinput="item.useinput" - :options="valoriopt(item, item.addall)" + :options="valoriopt(item, item.addall, item.addnone)" :filter="item.filter" class="combowidth" :option-value="fieldsTable.getKeyByTable(item.table)" diff --git a/src/components/CMyCardGrpPopup/CMyCardGrpPopup.ts b/src/components/CMyCardGrpPopup/CMyCardGrpPopup.ts index a81e4377..aa412f93 100644 --- a/src/components/CMyCardGrpPopup/CMyCardGrpPopup.ts +++ b/src/components/CMyCardGrpPopup/CMyCardGrpPopup.ts @@ -74,6 +74,10 @@ export default defineComponent({ load() } + function condividipag() { + return tools.copyStringToClipboard($q, self.location.host + tools.getPathByGroup(myrec.value, props.table), true) + } + onMounted(mounted) return { @@ -90,6 +94,7 @@ export default defineComponent({ colCitys, toolsext, col, + condividipag, } } }) diff --git a/src/components/CMyCardGrpPopup/CMyCardGrpPopup.vue b/src/components/CMyCardGrpPopup/CMyCardGrpPopup.vue index 6e814224..e8b5c844 100644 --- a/src/components/CMyCardGrpPopup/CMyCardGrpPopup.vue +++ b/src/components/CMyCardGrpPopup/CMyCardGrpPopup.vue @@ -19,7 +19,8 @@ @@ -65,11 +66,19 @@ -
- +
+
+ + +
+
+ +


diff --git a/src/components/CMyGroup/CMyGroup.ts b/src/components/CMyGroup/CMyGroup.ts index d42cbc3f..8f9d5361 100755 --- a/src/components/CMyGroup/CMyGroup.ts +++ b/src/components/CMyGroup/CMyGroup.ts @@ -78,10 +78,6 @@ export default defineComponent({ onMounted(mounted) - function getPathByGroup(grp: IMyGroup){ - return '/' + tools.getDirectoryByTable(table.value) + '/' + grp.groupname - } - return { grp, costanti, @@ -92,7 +88,7 @@ export default defineComponent({ userStore, tools, $q, - getPathByGroup, + table, } }, }) diff --git a/src/components/CMyGroup/CMyGroup.vue b/src/components/CMyGroup/CMyGroup.vue index c2a02c91..79b0db9e 100755 --- a/src/components/CMyGroup/CMyGroup.vue +++ b/src/components/CMyGroup/CMyGroup.vue @@ -2,13 +2,13 @@
- + - + {{ grp.title }} ({{ grp.groupname }}) {{ grp.descr }} diff --git a/src/components/CMyPopupEdit/CMyPopupEdit.vue b/src/components/CMyPopupEdit/CMyPopupEdit.vue index e713eb42..6e0fbbdb 100755 --- a/src/components/CMyPopupEdit/CMyPopupEdit.vue +++ b/src/components/CMyPopupEdit/CMyPopupEdit.vue @@ -233,7 +233,7 @@ :pickup="pickup" :optval="fieldsTable.getKeyByTable(col.jointable)" :optlab="fieldsTable.getLabelByTable(col.jointable)" - :options="globalStore.getTableJoinByName(col.jointable, col.addall, col.filter)" + :options="globalStore.getTableJoinByName(col.jointable, col.addall, col.addnone, col.filter)" :useinput="false">
@@ -254,7 +254,7 @@ :pickup="pickup" :optval="fieldsTable.getKeyByTable(col.jointable)" :optlab="fieldsTable.getLabelByTable(col.jointable)" - :options="globalStore.getTableJoinByName(col.jointable, col.addall, col.filter)" + :options="globalStore.getTableJoinByName(col.jointable, col.addall, col.addnone, col.filter)" :useinput="false">
@@ -306,7 +306,7 @@ @@ -342,12 +342,13 @@ v-model:arrvalue="myvalue" @update:arrvalue="changevalRec" :addall="false" + :addnone="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)" + :options="globalStore.getTableJoinByName(col.jointable, col.addall, col.addnone, col.filter)" :sola_lettura="!isInModif" :useinput="col.allowNewValue" :newvaluefunc="addNewValue"> @@ -363,7 +364,7 @@ :display-value="fieldsTable.getTitleByTable(col.jointable)" emit-value map-options - :options="globalStore.getTableJoinByName(col.jointable, col.addall, col.filter)" + :options="globalStore.getTableJoinByName(col.jointable, col.addall, col.addnone, col.filter)" class="combowidth" :option-value="fieldsTable.getKeyByTable(col.jointable)" @update:model-value="changevalRec"> @@ -390,7 +391,7 @@ :type_out="col.field_outtype" @update:value="changevalRec" :value="myvalue" - :options="globalStore.getTableJoinByName(col.jointable, col.addall, col.filter)" + :options="globalStore.getTableJoinByName(col.jointable, col.addall, col.addnone, col.filter)" :optval="fieldsTable.getKeyByTable(col.jointable)" :optlab="fieldsTable.getLabelByTable(col.jointable)" :opticon="fieldsTable.getIconByTable(col.jointable)"> @@ -410,11 +411,12 @@ @update:value="changevalRec" :newvaluefunc="addNewValue" :filter_table="col.filter_table" + :addnone="col.addnone" :filter_field="col.filter_field" :value_extra="value_extra" :optval="fieldsTable.getKeyByTable(col.jointable)" :optlab="fieldsTable.getLabelByTable(col.jointable)" - :options="globalStore.getTableJoinByName(col.jointable, col.addall, col.filter)" + :options="globalStore.getTableJoinByName(col.jointable, col.addall, col.addnone, col.filter)" :useinput="col.allowNewValue">
@@ -425,7 +427,7 @@ row: {{row}} col.jointable {{col.jointable}} myvalue {{myvalue}} - opt: {{globalStore.getTableJoinByName(col.jointable, col.addall, col.filter)}} + opt: {{globalStore.getTableJoinByName(col.jointable, col.addall, col.addnone, col.filter)}} val: {{fieldsTable.getKeyByTable(col.jointable)}} lab: {{fieldsTable.getLabelByTable(col.jointable)}}--> @@ -455,6 +457,7 @@ v-model:arrvalue="myvalue" @update:arrvalue="changevalRec" :addall="false" + :addnone="false" :tablesel="col.tablesel" :pickup="true" :filter_table="col.filter_table" @@ -465,7 +468,7 @@ color="primary" :optval="fieldsTable.getKeyByTable(col.jointable)" :optlab="fieldsTable.getLabelByTable(col.jointable)" - :options="globalStore.getTableJoinByName(col.jointable, col.addall, col.filter)" + :options="globalStore.getTableJoinByName(col.jointable, col.addall, col.addnone, col.filter)" :sola_lettura="!isInModif" :useinput="isInModif"> @@ -484,7 +487,7 @@ :value_extra="value_extra" :optval="fieldsTable.getKeyByTable(col.jointable)" :optlab="fieldsTable.getLabelByTable(col.jointable)" - :options="globalStore.getTableJoinByName(col.jointable, col.addall, col.filter)" + :options="globalStore.getTableJoinByName(col.jointable, col.addall, col.addnone, col.filter)" :useinput="false"> @@ -678,6 +681,7 @@ :label="col.label ? col.label : t(col.label_trans)" v-model:value="scope.value" :pickup="col.fieldtype === costanti.FieldType.select_by_server" + :addnone="col.addnone" :tablesel="col.fieldtype === costanti.FieldType.select_by_server ? tablesel : ''" :filter_table="col.filter_table" :filter_field="col.filter_field" @@ -685,7 +689,7 @@ :newvaluefunc="addNewValue" :optval="fieldsTable.getKeyByTable(col.jointable)" :optlab="fieldsTable.getLabelByTable(col.jointable)" - :options="globalStore.getTableJoinByName(col.jointable, col.addall, col.filter)" + :options="globalStore.getTableJoinByName(col.jointable, col.addall, col.addnone, col.filter)" :useinput="col.allowNewValue"> @@ -699,6 +703,7 @@ v-model:arrvalue="scope.value" @update:arrvalue="changevalRec" :addall="false" + :addnone="false" :tablesel="tablesel" :filter_table="col.filter_table" :filter_field="col.filter_field" @@ -709,7 +714,7 @@ color="primary" :optval="fieldsTable.getKeyByTable(col.jointable)" :optlab="fieldsTable.getLabelByTable(col.jointable)" - :options="globalStore.getTableJoinByName(col.jointable, col.addall, col.filter)" + :options="globalStore.getTableJoinByName(col.jointable, col.addall, col.addnone, col.filter)" :useinput="true"> @@ -724,7 +729,7 @@ :display-value="fieldsTable.getTitleByTable(col.jointable)" emit-value map-options - :options="globalStore.getTableJoinByName(col.jointable, col.addall, col.filter)" + :options="globalStore.getTableJoinByName(col.jointable, col.addall, col.addnone, col.filter)" class="combowidth" :useinput="col.allowNewValue" :newvaluefunc="addNewValue" @@ -816,7 +821,7 @@ @@ -831,7 +836,7 @@ v-model:value="scope.value" :optval="fieldsTable.getKeyByTable(col.jointable)" :optlab="fieldsTable.getLabelByTable(col.jointable)" - :options="globalStore.getTableJoinByName(col.jointable, col.addall, col.filter)" + :options="globalStore.getTableJoinByName(col.jointable, col.addall, col.addnone, col.filter)" :useinput="false"> diff --git a/src/components/CMySelect/CMySelect.ts b/src/components/CMySelect/CMySelect.ts index 60bdc371..98eb79d5 100755 --- a/src/components/CMySelect/CMySelect.ts +++ b/src/components/CMySelect/CMySelect.ts @@ -97,6 +97,11 @@ export default defineComponent({ required: false, default: false }, + addnone: { + type: Boolean, + required: false, + default: false + }, dense: { type: Boolean, required: false, @@ -220,7 +225,6 @@ export default defineComponent({ // localStorage.setItem(props.tablesel + '_' + newval, valori.value[newval]) if (props.type_out === costanti.FieldType.object) { - // debugger; const arrout = [] for (const val of newval) { let obj: any = {} @@ -264,7 +268,7 @@ export default defineComponent({ } function update() { - // console.log('update') + console.log('update') // console.log(' #### mounted myselect', props.options, 'arrvalue', myarrvalue.value) let rec: any if (optionsreal.value) { @@ -285,6 +289,15 @@ export default defineComponent({ arrtempOpt.value.push(myobj) } + if (props.addnone) { + let myobj: any = {} + if (typeof props.optlab === 'string') { + myobj[props.optlab] = '[Nessuno]' + myobj[props.optval] = costanti.FILTER_NESSUNO + } + + arrtempOpt.value = [myobj, ...arrtempOpt.value] + } for (let i = 0; i < num; i++) { const itemId = parseInt(localStorage.getItem(props.tablesel + i + props.optval)!) const itemlab = localStorage.getItem(props.tablesel + i + props.optlab) @@ -326,6 +339,16 @@ export default defineComponent({ myarrvalue.value.push(rec[`${props.optval}`]) } } + } else { + if (props.addnone) { + let myobj: any = {} + if (typeof props.optlab === 'string') { + myobj[props.optlab] = '[Nessuno]' + myobj[props.optval] = costanti.FILTER_NESSUNO + } + + myarrvalue.value = [myobj, ...myarrvalue.value] + } } if (props.tablesel === 'friendsandme') { @@ -383,7 +406,7 @@ export default defineComponent({ // console.log(props.col.jointable, props.filter) if (props.col.jointable) { - optionsreal.value = globalStore.getTableJoinByName(props.col.jointable, props.col.addall, props.filter) + optionsreal.value = globalStore.getTableJoinByName(props.col.jointable, props.col.addall, props.col.addnone, props.filter) // console.log('optionsreal.value', optionsreal.value) } else { optionsreal.value = props.options @@ -402,7 +425,13 @@ export default defineComponent({ if (props.multiple) { myarr = myarr.filter((rec: any) => rec[props.filter_field] === needle) } else { - myarr = myarr.filter((rec: any) => rec[props.filter_field].includes(needle)) + + myarr = myarr.filter((rec: any) => { + if (tools.isArray(rec[props.filter_field])) + return rec[props.filter_field].includes(needle) + else + return false + }) } // console.log(' RISSSSSSSSS: ', myarr) } @@ -420,6 +449,17 @@ export default defineComponent({ // console.log(' myarr: ', myarr) } + if (props.addnone) { + let myobj: any = {} + if (typeof props.optlab === 'string') { + myobj[props.optlab] = '[Nessuno]' + myobj[props.optval] = costanti.FILTER_NESSUNO + } + + if (myarr) + myarr = [myobj, ...myarr] + } + // console.log(' myarr: ', myarr) return myarr } @@ -505,6 +545,15 @@ export default defineComponent({ myobj[props.optval] = costanti.FILTER_TUTTI } + myarr = [myobj, ...myarr] + } + if (props.addnone) { + let myobj: any = {} + if (typeof props.optlab === 'string') { + myobj[props.optlab] = '[Nessuno]' + myobj[props.optval] = costanti.FILTER_NESSUNO + } + myarr = [myobj, ...myarr] } } diff --git a/src/model/GlobalStore.ts b/src/model/GlobalStore.ts index 5eaacd38..7c359c94 100755 --- a/src/model/GlobalStore.ts +++ b/src/model/GlobalStore.ts @@ -548,6 +548,7 @@ export interface IColGridTable { link?: string jointable?: string addall?: boolean + addnone?: boolean filter?: any resultjoin?: string[] tablesel?: string diff --git a/src/rootgen/admin/importdata/importdata.ts b/src/rootgen/admin/importdata/importdata.ts index 09619cbc..457153d6 100755 --- a/src/rootgen/admin/importdata/importdata.ts +++ b/src/rootgen/admin/importdata/importdata.ts @@ -9,6 +9,7 @@ import { useUserStore } from '@store/UserStore' import { useGlobalStore } from '@store/globalStore' import { useQuasar } from 'quasar' import { IParamsQuery } from 'model' +import { toolsext } from '@store/Modules/toolsext' export default defineComponent({ name: 'Sendpushnotif', @@ -97,7 +98,7 @@ export default defineComponent({ } if (true) { - params.table = 'sectors' + params.table = toolsext.TABSECTORS globalStore.loadTable(params).then((data) => { arrSector.value = data.rows }) diff --git a/src/store/Modules/costanti.ts b/src/store/Modules/costanti.ts index 799a6df3..31601443 100755 --- a/src/store/Modules/costanti.ts +++ b/src/store/Modules/costanti.ts @@ -128,6 +128,7 @@ export const costanti = { REQ_ADD_USER_TO_GROUP: 40, REQ_REMOVE_USER_TO_GROUP: 41, + FILTER_NESSUNO: 0, FILTER_TUTTI: -100, TABLES_ARRAY: ['mygroups'], TABLES_USERNAME_DATE: ['friends', 'friendsandme'], diff --git a/src/store/Modules/fieldsTable.ts b/src/store/Modules/fieldsTable.ts index ae95198b..da2579a9 100755 --- a/src/store/Modules/fieldsTable.ts +++ b/src/store/Modules/fieldsTable.ts @@ -77,6 +77,7 @@ function AddCol(params: IColGridTable) { tablesel: (params.tablesel === undefined) ? '' : params.tablesel, jointable: (params.jointable === undefined) ? '' : params.jointable, addall: (params.addall === undefined) ? false : params.addall, + addnone: (params.addnone === undefined) ? false : params.addnone, filter: (params.filter === undefined) ? null : params.filter, allowchar: (params.allowchar === undefined) ? null : params.allowchar, showWhen: (params.showWhen === undefined) ? costanti.showWhen.NewRec + costanti.showWhen.InEdit + costanti.showWhen.InView : params.showWhen, @@ -342,7 +343,7 @@ export const colSectors = [ name: 'idSector', label_trans: 'sectors.name', fieldtype: costanti.FieldType.select, - jointable: 'sectors', + jointable: toolsext.TABSECTORS, }), AddCol({ name: 'main', label_trans: 'store.main', fieldtype: costanti.FieldType.boolean }), AddCol({ name: 'color', label_trans: 'products.color' }), @@ -458,7 +459,7 @@ export const colSkills = [ name: 'idSector', label_trans: 'sectors.name', fieldtype: costanti.FieldType.multiselect, - jointable: 'sectors', + jointable: toolsext.TABSECTORS, }), AddCol({ name: 'color', label_trans: 'products.color' }), AddCol({ name: 'theme', label_trans: 'products.theme' }), @@ -663,6 +664,7 @@ export const colmyGoods = [ fieldtype: costanti.FieldType.select, required: false, jointable: 'goods', + addnone: true, filter_table: 'sectorgoods', filter_field: 'idSectorGood', noshowlabel: true, @@ -818,7 +820,7 @@ export const colmySkills = [ label_trans: 'sectors.name', fieldtype: costanti.FieldType.select, required: true, - jointable: 'sectors', + jointable: toolsext.TABSECTORS, showWhen: costanti.showWhen.NewRec + costanti.showWhen.InEdit + costanti.showWhen.InView_OnlyifExist, visible: true, icon: 'category', @@ -828,9 +830,10 @@ export const colmySkills = [ label_trans: 'skill.name', fieldtype: costanti.FieldType.select, jointable: 'skills', - filter_table: 'sectors', + filter_table: toolsext.TABSECTORS, filter_field: 'idSector', noshowlabel: true, + addnone: true, icon: 'engineering', showWhen: costanti.showWhen.NewRec + costanti.showWhen.InPage + costanti.showWhen.InEdit + costanti.showWhen.InView, allowNewValue: false, @@ -1001,7 +1004,7 @@ export const colmyBachecas = [ label_trans: 'sectors.name', fieldtype: costanti.FieldType.select, required: true, - jointable: 'sectors', + jointable: toolsext.TABSECTORS, showWhen: costanti.showWhen.NewRec + costanti.showWhen.InEdit + costanti.showWhen.InView_OnlyifExist, visible: true, icon: 'category', @@ -1012,7 +1015,8 @@ export const colmyBachecas = [ label_trans: 'skill.name', fieldtype: costanti.FieldType.select, jointable: 'skills', - filter_table: 'sectors', + addnone: true, + filter_table: toolsext.TABSECTORS, filter_field: 'idSector', noshowlabel: true, icon: 'engineering', @@ -2580,7 +2584,7 @@ export const fieldsTable = { collabel: 'descr', }, { - value: 'sectors', + value: toolsext.TABSECTORS, label: 'Settori', columns: colSectors, colkey: '_id', @@ -2595,7 +2599,7 @@ export const fieldsTable = { }, { value: 'catgrps', - label: 'Categorie', + label: 'Categorie Gruppi', columns: colCatGrps, colkey: '_id', collabel: 'descr', diff --git a/src/store/Modules/tools.ts b/src/store/Modules/tools.ts index 7bf3794f..af26e545 100644 --- a/src/store/Modules/tools.ts +++ b/src/store/Modules/tools.ts @@ -4958,16 +4958,50 @@ export const tools = { }, + getCitySel() { + const objcity = tools.getCookie(tools.COOK_SEARCH + 'cities', {_id: 0}) + let defcity: any = [] + if (objcity && objcity._id > 0) { + defcity = [objcity._id] + } else { + return [] + } + + return defcity + }, + + getSelectionByTable(table: string, mydef: any) { + + const arrtable = ['sectors', 'statusSkills', 'contribtypes', 'adtypes', 'sectorgoods', 'otherfilters', 'shippings'] + const arrmultisel_tab = ['skills', 'goods'] + const arrmultisel = [ + { table: 'skills', join: 'sectors'}, + { table: 'goods', join: 'sectorgoods'} + ] + + if (arrtable.includes(table)) { + return tools.getCookie(tools.COOK_SEARCH + table, mydef) + } else if (arrmultisel_tab.includes(table)){ + const rec = arrmultisel.find((rec) => rec.table === table) + if (rec) { + return tools.getCookie(tools.COOK_SEARCH + table + '_' + tools.getCookie(tools.COOK_SEARCH + rec.join, 0), mydef) + } + } + + return mydef + }, + getdefaultnewrec_MySkill(): any { + return { _id: 0, - idSector: 0, - idSkill: 0, - idStatusSkill: [], - idContribType: [], - idCity: [], + idSector: tools.getSelectionByTable('sectors', 0), + idSkill: tools.getSelectionByTable('skills', 0), + idStatusSkill: tools.getSelectionByTable('statusSkills', []), + idContribType: tools.getSelectionByTable('contribtypes', []), + idCity: this.getCitySel(), NumLevel: 0, - adType: 0, + adType: tools.getSelectionByTable('adtypes', costanti.FILTER_TUTTI), photos: [], note: '', //**ADDFIELD_MYSKILL @@ -4979,15 +5013,25 @@ export const tools = { getdefaultnewrec_MyGoods(): any { return { _id: 0, - idSectorGood: 0, - idGood: 0, - idShipping: [], - otherfilters: [], - idStatusSkill: [], - idContribType: [], - idCity: [], + + // idSectorGood: 0, + // idGood: 0, + // idStatusSkill: [], + // idContribType: [], + // idCity: [], + // adType: 0 + // idShipping: [], + // otherfilters: [], + + idSectorGood: tools.getSelectionByTable('sectorgoods', 0), + idGood: tools.getSelectionByTable('goods', 0), + idStatusSkill: tools.getSelectionByTable('statusSkills', []), + idContribType: tools.getSelectionByTable('contribtypes', []), + idCity: this.getCitySel(), NumLevel: 0, - adType: 0, + adType: tools.getSelectionByTable('adtypes', costanti.FILTER_TUTTI), + idShipping: [tools.getSelectionByTable('shippings', [])], + otherfilters: tools.getSelectionByTable('otherfilters', []), photos: [], note: '', //**ADDFIELD_MYSKILL @@ -5014,15 +5058,15 @@ export const tools = { getdefaultnewrec_MyBacheca(): any { return { _id: 0, - idSector: 0, - idSkill: 0, - idStatusSkill: [], - idContribType: [], + idSector: tools.getSelectionByTable('sectors', 0), + idSkill: tools.getSelectionByTable('skills', 0), + idStatusSkill: tools.getSelectionByTable('statusSkills', []), + idContribType: tools.getSelectionByTable('contribtypes', []), dateTimeStart: new Date(), dateTimeEnd: new Date(), - idCity: [], + idCity: this.getCitySel(), NumLevel: 0, - adType: 0, + adType: tools.getSelectionByTable('adtypes', costanti.FILTER_TUTTI), photos: [], note: '', //**ADDFIELD_MYBACHECAS @@ -5097,6 +5141,10 @@ export const tools = { return '' }, + getPathByGroup(grp: any, table: string) { + return '/' + tools.getDirectoryByTable(table) + '/' + grp.groupname + }, + // getLocale() { // if (navigator.languages && navigator.languages.length > 0) { diff --git a/src/store/Modules/toolsext.ts b/src/store/Modules/toolsext.ts index 6acd2980..0c818da4 100755 --- a/src/store/Modules/toolsext.ts +++ b/src/store/Modules/toolsext.ts @@ -60,6 +60,8 @@ export const toolsext = { TABUSER: 'users', TABFRIENDS: 'friends', TABMYGROUPS: 'mygroups', + TABSKILLS: 'skills', + TABSECTORS: 'sectors', TABMYSKILLS: 'myskills', TABMYGOODS: 'mygoods', TABMYBACHECAS: 'mybachecas', diff --git a/src/store/globalStore.ts b/src/store/globalStore.ts index df266871..a36df441 100644 --- a/src/store/globalStore.ts +++ b/src/store/globalStore.ts @@ -250,7 +250,7 @@ export const useGlobalStore = defineStore('GlobalStore', { // return state.subSkills else if (table === 'statusSkills') return state.statusSkills - else if (table === 'sectors') + else if (table === toolsext.TABSECTORS) return state.sectors else if (table === 'sectorgoods') return state.sectorgoods @@ -1509,7 +1509,7 @@ export const useGlobalStore = defineStore('GlobalStore', { return arr }, - getTableJoinByName(table: string, addall?: boolean, filter?: any) { + getTableJoinByName(table: string, addall?: boolean, addnone?: boolean, filter?: any) { let myarr: any = [] if (table === 'permissions') myarr = [shared_consts.Permissions.Admin, shared_consts.Permissions.Manager, shared_consts.Permissions.Teacher, shared_consts.Permissions.Tutor, shared_consts.Permissions.Editor, shared_consts.Permissions.Zoomeri, shared_consts.Permissions.Department] @@ -1541,6 +1541,19 @@ export const useGlobalStore = defineStore('GlobalStore', { if (addall) myarr = [costanti.FILTER_TUTTI, ...myarr] + + if (addnone) { + const mykey = fieldsTable.getKeyByTable(table) + const collab = fieldsTable.getLabelByTable(table) + let obj: any = {} + obj[mykey] = costanti.FILTER_NESSUNO + obj[collab] = '[Nessuno]' + obj['idSector'] = [] + + myarr = [obj, ...myarr] + + } + if (filter) { // console.log('table', table, 'filter', filter, 'arrprima', myarr) myarr = myarr.filter(filter)