Ora cambiando Settore, la Categoria viene sbiancata su "Nessuno" (anche se ancora rimane visivamente selezionato)

i campi obbligatori non funziona il controllo? (Erano i campi di tipo Array)
Aggiunta Categoria Ecovillaggi / Comunità + AutoProduzione
Aggiunte consulenza, affrancamento, supporto.. su temi di LAVORO
Quando inserisci un nuovo annuncio, prendi di default tutti i filtri visualizzati
Aggiungere bottone "Condividi Pagina" sui gruppi
This commit is contained in:
paoloar77
2022-02-28 03:33:21 +01:00
parent ab7650193a
commit a31d10ceb8
20 changed files with 268 additions and 104 deletions

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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',

View File

@@ -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 (tools.isArray(newRecord.value[col.name])) {
if (newRecord.value[col.name].length <= 0) {
return false
}
} else {
if (!newRecord.value[col.name]) {
ok = false
return false
}
}
}
}
})
return ok
}
@@ -1347,12 +1369,18 @@ export default defineComponent({
for (col of mycolumns.value) {
if (col.required) {
// console.log('newRecord.value', newRecord.value, newRecord.value[col.name])
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)
}
}
}
}
return ''
}

View File

@@ -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)"

View File

@@ -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,
}
}
})

View File

@@ -19,7 +19,8 @@
<q-img
v-if="tools.getValue(myrec, 'photos', '')"
:src="tools.getFullFileName(tools.getValue(myrec, 'photos', ''), table, myrec.username, myrec.groupname)" class="img"
:src="tools.getFullFileName(tools.getValue(myrec, 'photos', ''), table, myrec.username, myrec.groupname)"
class="img"
alt="immagine del gruppo"></q-img>
</div>
@@ -65,11 +66,19 @@
</div>
</div>
<div class="text-center">
<div class="row q-ma-sm q-pa-sm justify-center">
<div class="q-ma-sm">
<q-btn
icon="far fa-file-alt" label="Apri Pagina" color="primary" text-color="white"
:to="tools.getToByCol(col, table, myrec)"
/>
</div>
<div class="q-ma-sm">
<q-btn
color="primary" text-color="white" icon="fas fa-copy" label="Condividi Pagina"
@click="condividipag"></q-btn>
</div>
</div>
<br><br>

View File

@@ -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,
}
},
})

View File

@@ -2,13 +2,13 @@
<div v-if="tools.isUserOk()">
<div v-if="grp">
<q-item class="q-my-sm" clickable>
<q-item-section avatar @click="naviga(getPathByGroup(grp))">
<q-item-section avatar @click="naviga(tools.getPathByGroup(grp, table))">
<q-avatar size="60px">
<q-img :src="getImgGroup(grp)" :alt="grp.groupname" img-class="imgprofile" height="60px"/>
</q-avatar>
</q-item-section>
<q-item-section @click="naviga(getPathByGroup(grp))">
<q-item-section @click="naviga(tools.getPathByGroup(grp, table))">
<q-item-label><strong>{{ grp.title }}</strong> ({{ grp.groupname }})
</q-item-label>
<q-item-label v-if="grp.descr" caption lines="1"><em>{{ grp.descr }}</em></q-item-label>

View File

@@ -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">
</CMySelect>
</div>
@@ -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">
</CMySelect>
</div>
@@ -306,7 +306,7 @@
</span>
<CMyToggleList
:label="col.titlepopupedit"
:options="globalStore.getTableJoinByName(col.jointable, col.addall, col.filter)"
:options="globalStore.getTableJoinByName(col.jointable, col.addall, col.addnone, col.filter)"
v-model:value="myvalue"
@update:value="changevalRec"
:optval="fieldsTable.getKeyByTable(col.jointable)"
@@ -319,7 +319,7 @@
:type="costanti.FieldType.binary"
:value="myvalue"
@update:value="changevalRec"
: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)"></CMyChipList>
@@ -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)"></CMyChipList>
@@ -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">
</CMySelect>
</div>
@@ -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)}}-->
<CMyChipList
@@ -438,7 +440,7 @@
:labelifblank="canEdit ? 'Selezionare' : '' "
:filter_table="col.filter_table"
:filter_field="col.filter_field"
: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)"></CMyChipList>
@@ -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">
</CMySelect>
@@ -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">
</CMySelect>
</div>
@@ -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">
</CMySelect>
</div>
@@ -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">
</CMySelect>
</div>
@@ -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 @@
<CMyToggleList
:label="col.titlepopupedit"
:options="globalStore.getTableJoinByName(col.jointable, col.addall, col.filter)"
:options="globalStore.getTableJoinByName(col.jointable, col.addall, col.addnone, col.filter)"
v-model:value="scope.value"
:optval="fieldsTable.getKeyByTable(col.jointable)"
:optlab="fieldsTable.getLabelByTable(col.jointable)">
@@ -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">
</CMySelect>
</div>

View File

@@ -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]
}
}

View File

@@ -548,6 +548,7 @@ export interface IColGridTable {
link?: string
jointable?: string
addall?: boolean
addnone?: boolean
filter?: any
resultjoin?: string[]
tablesel?: string

View File

@@ -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
})

View File

@@ -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'],

View File

@@ -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',

View File

@@ -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) {

View File

@@ -60,6 +60,8 @@ export const toolsext = {
TABUSER: 'users',
TABFRIENDS: 'friends',
TABMYGROUPS: 'mygroups',
TABSKILLS: 'skills',
TABSECTORS: 'sectors',
TABMYSKILLS: 'myskills',
TABMYGOODS: 'mygoods',
TABMYBACHECAS: 'mybachecas',

View File

@@ -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)