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) { function createContribType(value: any) {
console.log('createContribType', value) console.log('createContribType', value)
tools.createNewRecord($q, 'contribtype', { label: value }).then((myrec) => { tools.createNewRecord($q, 'contribtypes', { label: value }).then((myrec) => {
// console.log('myrec') // console.log('myrec')
calendarStore.contribtype.push(myrec) calendarStore.contribtype.push(myrec)
}) })

View File

@@ -98,6 +98,15 @@ export default defineComponent({
type: costanti.FieldType.multiselect, type: costanti.FieldType.multiselect,
filter: null, 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) const data = await globalStore.saveSubRec(mydata)
} }
function getdefaultnewrec(): any { function getdefaultnewrec(): IMySkill {
return { return {
_id: 0, _id: 0,
idSkill: 0, idSkill: 0,
idStatusSkill: [], idStatusSkill: [],
idContribType: [],
idCity: [], idCity: [],
NumLevel: 0, NumLevel: 0,
photos: [], photos: [],
@@ -148,10 +158,19 @@ export default defineComponent({
lk_FF: '_id', lk_FF: '_id',
lk_as: 'user', lk_as: 'user',
af_objId_tab: 'myId', af_objId_tab: 'myId',
},
lookup2: {
lk_tab: 'skills',
lk_LF: 'idSkill',
lk_FF: '_id',
lk_as: 'recSkill',
af_objId_tab: '',
lk_proj: { lk_proj: {
'sector.idSector': 1, recSkill: 1,
sector: 1,
idSkill: 1, idSkill: 1,
idStatusSkill: 1, idStatusSkill: 1,
idContribType: 1,
idCity: 1, idCity: 1,
numLevel: 1, numLevel: 1,
photos: 1, photos: 1,
@@ -165,29 +184,13 @@ export default defineComponent({
surname: 1 surname: 1
} }
}, },
lookup2: { lookup3: {
lk_tab: 'sectors', lk_tab: 'sectors',
lk_LF: 'idSkill', lk_LF: 'recSkill.idSector',
lk_FF: '_id', lk_FF: '_id',
lk_as: 'sector', lk_as: 'sector',
af_objId_tab: '', 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) // console.log('sortBy', sortBy)
let filtersearch: any[] = [] let filtersearch: any[] = []
let filtersearch2: any[] = []
let recSector = searchList.value.find((item: ISearchList) => item.table === 'sectors') let recSector = null;
let idSector = recSector ? recSector.value : 0 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) { if (searchList.value) {
searchList.value.forEach((item: ISearchList) => { searchList.value.forEach((item: ISearchList) => {
@@ -275,7 +282,12 @@ export default defineComponent({
objitem[item.key] = item.value objitem[item.key] = item.value
filtersearch.push(objitem) filtersearch.push(objitem)
} else if (item.arrvalue.length > 0) { } 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 = [] let arr2: any = []
@@ -292,11 +304,10 @@ export default defineComponent({
filtersearch.push(obj2) filtersearch.push(obj2)
} else { } else {
if (item.table === 'skills' && item.value === costanti.FILTER_TUTTI) { if (item.table === 'skills' && item.value === costanti.FILTER_TUTTI) {
let obj2: any = {}
// idSector // idSector
let obj2: any = { obj2['sector._id'] = idSector
idSector: idSector filtersearch2.push(obj2)
}
filtersearch.push(obj2)
} }
} }
} }
@@ -305,7 +316,6 @@ export default defineComponent({
console.log('filtersearch', filtersearch) console.log('filtersearch', filtersearch)
if (props.prop_search) { if (props.prop_search) {
let nosearch = false let nosearch = false
if (filtersearch.length <= 0 && !param_myfilter) { if (filtersearch.length <= 0 && !param_myfilter) {
@@ -342,6 +352,8 @@ export default defineComponent({
// @ts-ignore // @ts-ignore
filtersearch: filtersearch, filtersearch: filtersearch,
// @ts-ignore // @ts-ignore
filtersearch2: filtersearch2,
// @ts-ignore
filtercustom: props.filtercustom, filtercustom: props.filtercustom,
sortBy: myobj, sortBy: myobj,
descending, descending,
@@ -995,8 +1007,14 @@ export default defineComponent({
if (ris) { if (ris) {
// console.log('ris', ris) // console.log('ris', ris)
newRecordBool.value = false 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]) 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) if (indrec >= 0)
serverData.value[indrec] = ris serverData.value[indrec] = ris
else else
@@ -1049,6 +1067,10 @@ export default defineComponent({
return props.labelBtnAddRow !== addRow.value return props.labelBtnAddRow !== addRow.value
} }
function checkIfShowRec(rec: any) {
return (rec._id > 0 && typeof rec._id === 'number') || rec._id !== 'number'
}
// onMounted(mounted) // onMounted(mounted)
@@ -1118,6 +1140,7 @@ export default defineComponent({
searchList, searchList,
searchval, searchval,
canModifyThisRec, canModifyThisRec,
checkIfShowRec,
} }
} }
}) })

View File

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

View File

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

View File

@@ -5,6 +5,7 @@
:multiple="multiple" :multiple="multiple"
rounded rounded
outlined outlined
v-bind="$attrs"
:input-class="myclass" :input-class="myclass"
:model-value="myvalue" :model-value="myvalue"
:use-input="useinput" :use-input="useinput"
@@ -33,8 +34,21 @@
@update:model-value="changeval" @update:model-value="changeval"
:label="label" :label="label"
emit-value emit-value
options-selected-class="text-deep-orange"
map-options map-options
v-bind="$attrs"
style="min-width: 170px; max-width: 400px;"> 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> </q-select>
</div> </div>
</div> </div>

View File

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

View File

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

View File

@@ -7,6 +7,13 @@ body {
//font-size: 1rem; //font-size: 1rem;
} }
.text-mycol {
color: #333333 !important;
}
.bg-mycol {
background: #333333 !important;
}
html { html {
font-size: 100%; // default font size (browser 16) -> (10 62.5%) font-size: 100%; // default font size (browser 16) -> (10 62.5%)
} }

View File

@@ -446,9 +446,11 @@ export interface IParamsQuery {
userId: string userId: string
codeId?: string codeId?: string
filtersearch: string filtersearch: string
filtersearch2: string
filtercustom: string filtercustom: string
lookup1?: IParLookup lookup1?: IParLookup
lookup2?: IParLookup lookup2?: IParLookup
lookup3?: IParLookup
} }
export interface IColGridTable { export interface IColGridTable {
@@ -595,6 +597,7 @@ export interface IMySkill {
_id: number _id: number
idSkill: number idSkill: number
idStatusSkill: number[] idStatusSkill: number[]
idContribType: string[]
idCity: number[] idCity: number[]
photos: IGallery[] photos: IGallery[]
NumLevel: number NumLevel: number

View File

@@ -295,6 +295,7 @@ const msg_enUs = {
registered: 'Registrato', registered: 'Registrato',
contacted: 'Contattato', contacted: 'Contattato',
name_complete: 'Nome Completo', name_complete: 'Nome Completo',
edit: 'Edit',
num_invitati: 'Num.Invitati', num_invitati: 'Num.Invitati',
is_in_whatsapp: 'In Whatsapp', is_in_whatsapp: 'In Whatsapp',
is_in_telegram: 'In Telegram', is_in_telegram: 'In Telegram',

View File

@@ -329,6 +329,7 @@ const msg_it = {
consiglio: 'Consiglio', consiglio: 'Consiglio',
volta: 'volta', volta: 'volta',
volte: 'volte', volte: 'volte',
edit: 'Modifica',
registered: 'Registrato', registered: 'Registrato',
contacted: 'Contattato', contacted: 'Contattato',
name_complete: 'Nome Completo', name_complete: 'Nome Completo',
@@ -784,6 +785,9 @@ const msg_it = {
}, },
sectors: { sectors: {
name: 'Settore', name: 'Settore',
},
contribtype: {
name: 'Contributo'
} }
}, },

View File

@@ -339,9 +339,10 @@ export const colSkills = [
] ]
export const colmySkills = [ export const colmySkills = [
AddCol({ /*AddCol({
name: 'userId', label_trans: 'order.users', fieldtype: costanti.FieldType.select, jointable: 'users', name: 'userId', label_trans: 'order.users', fieldtype: costanti.FieldType.string, jointable: 'users',
}), visible: false
}), */
//AddCol({ name: 'name', label_trans: 'reg.name', fieldtype: costanti.FieldType.string }), //AddCol({ name: 'name', label_trans: 'reg.name', fieldtype: costanti.FieldType.string }),
//AddCol({ name: 'surname', label_trans: 'reg.surname', fieldtype: costanti.FieldType.string }), //AddCol({ name: 'surname', label_trans: 'reg.surname', fieldtype: costanti.FieldType.string }),
AddCol({ name: 'username', label_trans: 'reg.username', foredit: false }), AddCol({ name: 'username', label_trans: 'reg.username', foredit: false }),
@@ -365,6 +366,12 @@ export const colmySkills = [
fieldtype: costanti.FieldType.multiselect, fieldtype: costanti.FieldType.multiselect,
jointable: 'statusSkills', jointable: 'statusSkills',
}), }),
AddCol({
name: 'idContribType',
label_trans: 'contribtype.name',
fieldtype: costanti.FieldType.multiselect,
jointable: 'contribtypes',
}),
AddCol({ AddCol({
name: 'idCity', name: 'idCity',
label_trans: 'skill.city', label_trans: 'skill.city',
@@ -705,7 +712,7 @@ const colTableEvents = [
name: 'contribtype', name: 'contribtype',
label_trans: 'event.contribtype', label_trans: 'event.contribtype',
fieldtype: costanti.FieldType.select, fieldtype: costanti.FieldType.select,
jointable: 'contribtype', jointable: 'contribtypes',
}), }),
AddCol({ name: 'price', label_trans: 'event.price' }), AddCol({ name: 'price', label_trans: 'event.price' }),
AddCol({ name: 'infoafterprice', label_trans: 'event.infoafterprice' }), AddCol({ name: 'infoafterprice', label_trans: 'event.infoafterprice' }),
@@ -1257,6 +1264,10 @@ export const fieldsTable = {
'myskills', 'myskills',
], ],
tableWithUsername: [
'myskills',
],
tablesList: [ tablesList: [
{ {
value: 'operators', value: 'operators',
@@ -1322,7 +1333,7 @@ export const fieldsTable = {
collabel: 'title', collabel: 'title',
}, },
{ {
value: 'contribtype', value: 'contribtypes',
label: 'Tipi di Contributi', label: 'Tipi di Contributi',
columns: colcontribtype, columns: colcontribtype,
colkey: '_id', colkey: '_id',

View File

@@ -196,7 +196,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
return calendarStore.internalpages return calendarStore.internalpages
else if (table === 'wheres') else if (table === 'wheres')
return calendarStore.wheres return calendarStore.wheres
else if (table === 'contribtype') else if (table === 'contribtypes')
return calendarStore.contribtype return calendarStore.contribtype
else if (table === 'disciplines') ris = state.disciplines else if (table === 'disciplines') ris = state.disciplines
else if (table === toolsext.TABNEWSLETTER) ris = state.newstosent else if (table === toolsext.TABNEWSLETTER) ris = state.newstosent