added Tipi di Contributi

This commit is contained in:
paoloar77
2021-12-17 18:30:18 +01:00
parent 87a0f317cd
commit 3c194f06a5
14 changed files with 142 additions and 47 deletions

View File

@@ -808,7 +808,7 @@ export default defineComponent({
function createContribType(value: any) {
console.log('createContribType', value)
tools.createNewRecord($q, 'contribtype', { label: value }).then((myrec) => {
tools.createNewRecord($q, 'contribtypes', { label: value }).then((myrec) => {
// console.log('myrec')
calendarStore.contribtype.push(myrec)
})

View File

@@ -98,6 +98,15 @@ export default defineComponent({
type: costanti.FieldType.multiselect,
filter: null,
},
{
label: 'Contributo',
table: 'contribtypes',
key: 'idContribType',
value: 0,
arrvalue: tools.getCookie(tools.COOK_SEARCH + 'contribtypes', [costanti.FILTER_TUTTI]),
type: costanti.FieldType.multiselect,
filter: null,
},
]
@@ -126,11 +135,12 @@ export default defineComponent({
const data = await globalStore.saveSubRec(mydata)
}
function getdefaultnewrec(): any {
function getdefaultnewrec(): IMySkill {
return {
_id: 0,
idSkill: 0,
idStatusSkill: [],
idContribType: [],
idCity: [],
NumLevel: 0,
photos: [],
@@ -148,10 +158,19 @@ export default defineComponent({
lk_FF: '_id',
lk_as: 'user',
af_objId_tab: 'myId',
},
lookup2: {
lk_tab: 'skills',
lk_LF: 'idSkill',
lk_FF: '_id',
lk_as: 'recSkill',
af_objId_tab: '',
lk_proj: {
'sector.idSector': 1,
recSkill: 1,
sector: 1,
idSkill: 1,
idStatusSkill: 1,
idContribType: 1,
idCity: 1,
numLevel: 1,
photos: 1,
@@ -165,29 +184,13 @@ export default defineComponent({
surname: 1
}
},
lookup2: {
lookup3: {
lk_tab: 'sectors',
lk_LF: 'idSkill',
lk_LF: 'recSkill.idSector',
lk_FF: '_id',
lk_as: 'sector',
af_objId_tab: '',
lk_proj: {
'sector.idSector': 1,
idSkill: 1,
idStatusSkill: 1,
idCity: 1,
numLevel: 1,
photos: 1,
note: 1,
subTitle: 1,
date_created: 1,
date_updated: 1,
userId: 1,
username: 1,
name: 1,
surname: 1
}
}
},
}
}

View File

@@ -263,9 +263,16 @@ export default defineComponent({
// console.log('sortBy', sortBy)
let filtersearch: any[] = []
let filtersearch2: any[] = []
let recSector = searchList.value.find((item: ISearchList) => item.table === 'sectors')
let idSector = recSector ? recSector.value : 0
let recSector = null;
let idSector = 0;
if (searchList.value) {
recSector = searchList.value.find((item: ISearchList) => item.table === 'sectors')
idSector = recSector ? recSector.value : 0
}
// console.table(searchList.value)
if (searchList.value) {
searchList.value.forEach((item: ISearchList) => {
@@ -275,7 +282,12 @@ export default defineComponent({
objitem[item.key] = item.value
filtersearch.push(objitem)
} else if (item.arrvalue.length > 0) {
const myarr = item.arrvalue.filter((value: any) => value > 0)
const myarr = item.arrvalue.filter((value: any) => {
if (typeof value === 'number') {
return value > 0;
}
return true;
})
let arr2: any = []
@@ -292,11 +304,10 @@ export default defineComponent({
filtersearch.push(obj2)
} else {
if (item.table === 'skills' && item.value === costanti.FILTER_TUTTI) {
let obj2: any = {}
// idSector
let obj2: any = {
idSector: idSector
}
filtersearch.push(obj2)
obj2['sector._id'] = idSector
filtersearch2.push(obj2)
}
}
}
@@ -305,7 +316,6 @@ export default defineComponent({
console.log('filtersearch', filtersearch)
if (props.prop_search) {
let nosearch = false
if (filtersearch.length <= 0 && !param_myfilter) {
@@ -342,6 +352,8 @@ export default defineComponent({
// @ts-ignore
filtersearch: filtersearch,
// @ts-ignore
filtersearch2: filtersearch2,
// @ts-ignore
filtercustom: props.filtercustom,
sortBy: myobj,
descending,
@@ -995,8 +1007,14 @@ export default defineComponent({
if (ris) {
// console.log('ris', ris)
newRecordBool.value = false
const indrec = serverData.value.findIndex((rec: IMySkill) => rec._id === ris._id)
const indrec = serverData.value.findIndex((rec: any) => rec._id === ris._id)
console.log('indrec', indrec, serverData.value[indrec])
if (fieldsTable.tableWithUsername.includes(props.prop_mytable)) {
ris.username = userStore.my.username
}
// console.table(serverData.value)
if (indrec >= 0)
serverData.value[indrec] = ris
else
@@ -1049,6 +1067,10 @@ export default defineComponent({
return props.labelBtnAddRow !== addRow.value
}
function checkIfShowRec(rec: any) {
return (rec._id > 0 && typeof rec._id === 'number') || rec._id !== 'number'
}
// onMounted(mounted)
@@ -1118,6 +1140,7 @@ export default defineComponent({
searchList,
searchval,
canModifyThisRec,
checkIfShowRec,
}
}
})

View File

@@ -130,7 +130,7 @@
<template v-slot:top-left v-if="searchList">
<div class="row">
<div class="row text-blue">
<div v-for="(item, index) in searchList" :key="index">
<CMySelect
v-if="item.type === costanti.FieldType.select"
@@ -138,10 +138,13 @@
v-model:value="item.value"
@update:value="searchval(item.value, item.table)"
:addall="true"
label-color="primary"
color="primary"
:optval="fieldsTable.getKeyByTable(item.table)"
:optlab="fieldsTable.getLabelByTable(item.table)"
:options="globalStore.getTableJoinByName(item.table, true, item.filter)"
:useinput="false">
:useinput="false"
>
</CMySelect>
<q-select
@@ -156,11 +159,31 @@
:display-value="fieldsTable.getTitleByTable(item.table)"
emit-value
map-options
stack-label
:options="globalStore.getTableJoinByName(item.table, item.filter)"
style="min-width: 150px"
:option-value="fieldsTable.getKeyByTable(item.table)"
>
>
<template
v-if="item.arrvalue.length >= 1"
v-slot:selected-item="scope">
<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="item.icon" size="12px"/>
{{ scope.opt[fieldsTable.getLabelByTable(item.table)] }}
</q-chip>
<div v-if="scope.opt === -100 && item.arrvalue.length === 1">
{{ fieldsTable.getTitleByTable(item.table) }}
</div>
</template>
<template v-slot:option="{ itemProps, opt, selected, toggleOption }">
<q-item v-bind="itemProps">

View File

@@ -445,10 +445,16 @@ export default defineComponent({
else
return '***************'
} else {
if (val === undefined || val === null)
return ' <span class="text-grey">(' + t('reg.select') + ')</span> '
else if (val === '') {
return ' <span class="text-grey">(' + t('reg.select') + ')</span> '
if (val === undefined || val === null) {
if (props.canEdit)
return ' <span class="text-grey">(' + t('reg.select') + ')</span> '
else
return ''
} else if (val === '') {
if (props.canEdit)
return ' <span class="text-grey">(' + t('reg.select') + ')</span> '
else
return ''
} else {
let mystr = ''
if (props.showall) {

View File

@@ -5,6 +5,7 @@
:multiple="multiple"
rounded
outlined
v-bind="$attrs"
:input-class="myclass"
:model-value="myvalue"
:use-input="useinput"
@@ -33,8 +34,21 @@
@update:model-value="changeval"
:label="label"
emit-value
options-selected-class="text-deep-orange"
map-options
v-bind="$attrs"
style="min-width: 170px; max-width: 400px;">
<template v-slot:option="scope">
<q-item v-bind="scope.itemProps">
<q-item-section avatar>
<q-icon :name="scope.opt.icon ? scope.opt.icon : ''"/>
</q-item-section>
<q-item-section>
<q-item-label>{{ scope.opt.descr }}</q-item-label>
</q-item-section>
</q-item>
</template>
</q-select>
</div>
</div>

View File

@@ -66,6 +66,7 @@ export default defineComponent({
filter: '',
filterand: '',
filtersearch: '',
filtersearch2: '',
filtercustom: '',
sortBy: myobj,
descending,

View File

@@ -55,11 +55,12 @@ export default defineComponent({
const data = await globalStore.saveSubRec(mydata)
}
function getdefaultnewrec(): any {
function getdefaultnewrec(): IMySkill {
return {
_id: 0,
idSkill: 0,
idStatusSkill: [],
idContribType: [],
idCity: [],
NumLevel: 0,
photos: [],
@@ -79,8 +80,6 @@ export default defineComponent({
af_objId_tab: 'myId',
lk_proj: {
idSkill: 1,
idStatusSkill: 1,
idCity: 1,
numLevel: 1,
photos: 1,
note: 1,