- Add New Record directly by the QSelect
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import {
|
import {
|
||||||
|
computed,
|
||||||
defineComponent, onBeforeMount, onBeforeUnmount, onMounted, ref, toRef, toRefs, watch,
|
defineComponent, onBeforeMount, onBeforeUnmount, onMounted, ref, toRef, toRefs, watch,
|
||||||
} from 'vue'
|
} from 'vue'
|
||||||
|
|
||||||
@@ -32,6 +33,19 @@ export default defineComponent({
|
|||||||
const filtercustom: any = ref([])
|
const filtercustom: any = ref([])
|
||||||
const searchList = ref(<ISearchList[]>[])
|
const searchList = ref(<ISearchList[]>[])
|
||||||
|
|
||||||
|
const idSector = computed(() => {
|
||||||
|
let myval = 0
|
||||||
|
searchList.value.forEach((rec) => {
|
||||||
|
console.log(' rec', rec)
|
||||||
|
if (rec.table === 'sectors') {
|
||||||
|
console.log('trovato')
|
||||||
|
myval = rec.value
|
||||||
|
}
|
||||||
|
})
|
||||||
|
console.log('IDSECTOR = ' + myval)
|
||||||
|
return myval
|
||||||
|
})
|
||||||
|
|
||||||
function mounted() {
|
function mounted() {
|
||||||
/*arrfilterand.value = [
|
/*arrfilterand.value = [
|
||||||
{
|
{
|
||||||
@@ -98,7 +112,7 @@ export default defineComponent({
|
|||||||
useinput: true,
|
useinput: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Specializz.',
|
label: 'Specializzazione',
|
||||||
table: 'subskills',
|
table: 'subskills',
|
||||||
key: 'idSubSkill',
|
key: 'idSubSkill',
|
||||||
value: 0,
|
value: 0,
|
||||||
@@ -205,6 +219,7 @@ export default defineComponent({
|
|||||||
function getdefaultnewrec(): IMySkill {
|
function getdefaultnewrec(): IMySkill {
|
||||||
return {
|
return {
|
||||||
_id: 0,
|
_id: 0,
|
||||||
|
idSector: 0,
|
||||||
idSkill: 0,
|
idSkill: 0,
|
||||||
idSubSkill: [],
|
idSubSkill: [],
|
||||||
idStatusSkill: [],
|
idStatusSkill: [],
|
||||||
@@ -236,6 +251,7 @@ export default defineComponent({
|
|||||||
lk_proj: {
|
lk_proj: {
|
||||||
recSkill: 1,
|
recSkill: 1,
|
||||||
sector: 1,
|
sector: 1,
|
||||||
|
idSector: 1,
|
||||||
idSkill: 1,
|
idSkill: 1,
|
||||||
idSubSkill: 1,
|
idSubSkill: 1,
|
||||||
idStatusSkill: 1,
|
idStatusSkill: 1,
|
||||||
@@ -292,6 +308,7 @@ export default defineComponent({
|
|||||||
arrfilterand,
|
arrfilterand,
|
||||||
filtercustom,
|
filtercustom,
|
||||||
searchList,
|
searchList,
|
||||||
|
idSector,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="q-pa-sm bi-border-all">
|
<div class="bi-border-all">
|
||||||
<div class="q-ma-sm q-gutter-sm q-pa-xs bg-green">
|
<div class="q-ma-xs q-gutter-xs q-pa-xs bg-green">
|
||||||
<CGridTableRec
|
<CGridTableRec
|
||||||
v-if="searchList.length > 0"
|
v-if="searchList.length > 0"
|
||||||
prop_mytable="myskills"
|
prop_mytable="myskills"
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
prop_colkey="idSkill"
|
prop_colkey="idSkill"
|
||||||
col_title="subTitle"
|
col_title="subTitle"
|
||||||
:vertical="true"
|
:vertical="true"
|
||||||
nodataLabel="Nessuna Competenza trovata"
|
:nodataLabel="idSector > 0 ? 'Nessuna Competenza trovata': 'Selezionare un Settore'"
|
||||||
:prop_search="true"
|
:prop_search="true"
|
||||||
:finder="true"
|
:finder="true"
|
||||||
:choose_visutype="true"
|
:choose_visutype="true"
|
||||||
|
|||||||
@@ -275,14 +275,14 @@ export default defineComponent({
|
|||||||
|
|
||||||
// Delete File on server:
|
// Delete File on server:
|
||||||
const ris = await globalStore.DeleteFile({ filename })
|
const ris = await globalStore.DeleteFile({ filename })
|
||||||
console.log('ris', ris)
|
// console.log('ris', ris)
|
||||||
if (ris)
|
if (ris)
|
||||||
deleted(rec)
|
deleted(rec)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function save() {
|
function save() {
|
||||||
console.log('CGallery save')
|
console.log('CGallery save', gallerylist.value)
|
||||||
if (gallerylist.value.length > 0) {
|
if (gallerylist.value.length > 0) {
|
||||||
if (!props.single) {
|
if (!props.single) {
|
||||||
emit('showandsave', gallerylist.value)
|
emit('showandsave', gallerylist.value)
|
||||||
@@ -290,7 +290,7 @@ export default defineComponent({
|
|||||||
emit('showandsave', gallerylist.value[0].imagefile)
|
emit('showandsave', gallerylist.value[0].imagefile)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
emit('showandsave', '')
|
emit('showandsave', !props.single ? [] : '')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -91,7 +91,7 @@
|
|||||||
<div v-if="edit" class="q-gutter-sm " style="max-height: 200px; width: 208px;">
|
<div v-if="edit" class="q-gutter-sm " style="max-height: 200px; width: 208px;">
|
||||||
<q-uploader
|
<q-uploader
|
||||||
label="Aggiungi Immagine"
|
label="Aggiungi Immagine"
|
||||||
accept=".jpg, image/*, .pdf"
|
accept="image/jpeg, image/jpg, image/png, .pdf"
|
||||||
:url="getUrl()"
|
:url="getUrl()"
|
||||||
:headers="tools.getheaders()"
|
:headers="tools.getheaders()"
|
||||||
:max-file-size="3000000"
|
:max-file-size="3000000"
|
||||||
@@ -206,7 +206,7 @@
|
|||||||
<div class="q-gutter-sm " style="max-height: 200px; width: 208px;">
|
<div class="q-gutter-sm " style="max-height: 200px; width: 208px;">
|
||||||
<q-uploader
|
<q-uploader
|
||||||
label="Aggiungi Immagine"
|
label="Aggiungi Immagine"
|
||||||
accept=".jpg, image/*, .pdf"
|
accept="image/jpeg, image/jpg, image/png, .pdf"
|
||||||
:url="getUrl()"
|
:url="getUrl()"
|
||||||
:headers="tools.getheaders()"
|
:headers="tools.getheaders()"
|
||||||
:max-file-size="2000000"
|
:max-file-size="2000000"
|
||||||
|
|||||||
@@ -802,6 +802,7 @@ export default defineComponent({
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async function createNewRecord() {
|
async function createNewRecord() {
|
||||||
|
|
||||||
await createNewRecordDialog()
|
await createNewRecordDialog()
|
||||||
@@ -947,12 +948,9 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
|
|
||||||
function visCol(col: IColGridTable) {
|
function visCol(col: IColGridTable) {
|
||||||
if (col.visuonlyEditVal) {
|
if ((!tools.isBitActive(col.showWhen, costanti.showWhen.NewRec)) && !tools.isBitActive(col.showWhen, costanti.showWhen.InView)
|
||||||
if (canEdit.value) {
|
&& !tools.isBitActive(col.showWhen, costanti.showWhen.InView_OnlyifExist) && tools.isBitActive(col.showWhen, costanti.showWhen.InEdit)) {
|
||||||
return col.visuonlyEditVal
|
return (canEdit.value)
|
||||||
} else {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
@@ -1129,9 +1127,8 @@ export default defineComponent({
|
|||||||
|
|
||||||
mycolumns.value.forEach((col: IColGridTable) => {
|
mycolumns.value.forEach((col: IColGridTable) => {
|
||||||
if (col.required) {
|
if (col.required) {
|
||||||
console.log('newRecord.value', newRecord.value, newRecord.value[col.name])
|
// console.log('newRecord.value', newRecord.value, newRecord.value[col.name])
|
||||||
if (!newRecord.value[col.name]) {
|
if (!newRecord.value[col.name]) {
|
||||||
|
|
||||||
ok = false
|
ok = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1202,8 +1199,8 @@ export default defineComponent({
|
|||||||
|
|
||||||
const data = await globalStore.saveTable(mydata)
|
const data = await globalStore.saveTable(mydata)
|
||||||
.then((ris) => {
|
.then((ris) => {
|
||||||
|
// console.log('ris', ris)
|
||||||
if (ris) {
|
if (ris) {
|
||||||
// console.log('ris', ris)
|
|
||||||
editRecordBool.value = false
|
editRecordBool.value = false
|
||||||
const indrec = serverData.value.findIndex((rec: IMySkill) => rec._id === ris._id)
|
const indrec = serverData.value.findIndex((rec: IMySkill) => rec._id === ris._id)
|
||||||
console.log('indrec', indrec, serverData.value[indrec])
|
console.log('indrec', indrec, serverData.value[indrec])
|
||||||
@@ -1234,11 +1231,12 @@ export default defineComponent({
|
|||||||
return ((rec._id > 0 && typeof rec._id === 'number') || rec._id !== 'number') && rec !== -100
|
return ((rec._id > 0 && typeof rec._id === 'number') || rec._id !== 'number') && rec !== -100
|
||||||
}
|
}
|
||||||
|
|
||||||
function showColCheck(col: IColGridTable, newrec: boolean){
|
function showColCheck(col: IColGridTable, tipovis: number, visulabel:boolean, value: any = ''){
|
||||||
return (colVisib.value.includes(col.field! + col.subfield) || colVisib.value.includes(col.field + '.' + col.subfield)) &&
|
const check = tools.checkIfShowField(col, tipovis, visulabel, value)
|
||||||
(!col.showOnlyNewRec || (col.showOnlyNewRec && newrec)) &&
|
|
||||||
(col.visible) &&
|
const valuePresent = (colVisib.value.includes(col.field! + col.subfield) || colVisib.value.includes(col.field + '.' + col.subfield))
|
||||||
(!props.visuinpage || (col.visuinpage && props.visuinpage))
|
|
||||||
|
return check && valuePresent
|
||||||
}
|
}
|
||||||
|
|
||||||
function getValueExtra(col: IColGridTable, record: any) {
|
function getValueExtra(col: IColGridTable, record: any) {
|
||||||
|
|||||||
@@ -65,7 +65,7 @@
|
|||||||
:props="props"
|
:props="props"
|
||||||
class="text-italic text-weight-bold"
|
class="text-italic text-weight-bold"
|
||||||
>
|
>
|
||||||
<span v-if="col && showColCheck(col, false)">
|
<span v-if="col && showColCheck(col, tools.TIPOVIS_SHOW_RECORD, true)">
|
||||||
{{ col.label }}
|
{{ col.label }}
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
@@ -102,7 +102,7 @@
|
|||||||
<template v-slot:top-left>
|
<template v-slot:top-left>
|
||||||
|
|
||||||
<div v-if="searchList"
|
<div v-if="searchList"
|
||||||
:class="$q.screen.lt.sm ? `` : `row` + ` text-blue`">
|
:class="$q.screen.lt.sm ? `` : `row` + ` text-blue `">
|
||||||
<span v-for="(item, index) in searchList" :key="index">
|
<span v-for="(item, index) in searchList" :key="index">
|
||||||
<CMySelect
|
<CMySelect
|
||||||
v-if="(item.type === costanti.FieldType.select) || (item.type === costanti.FieldType.select_by_server)"
|
v-if="(item.type === costanti.FieldType.select) || (item.type === costanti.FieldType.select_by_server)"
|
||||||
@@ -252,7 +252,7 @@
|
|||||||
<q-td
|
<q-td
|
||||||
v-for="col in mycolumns" :key="col.name" :props="props">
|
v-for="col in mycolumns" :key="col.name" :props="props">
|
||||||
<div
|
<div
|
||||||
v-if="showColCheck(col, false)" class="tdclass">
|
v-if="showColCheck(col, tools.TIPOVIS_SHOW_RECORD, true, 1)" class="tdclass">
|
||||||
<div :class="getclrow(props.row)">
|
<div :class="getclrow(props.row)">
|
||||||
<CMyPopupEdit
|
<CMyPopupEdit
|
||||||
:table="mytable"
|
:table="mytable"
|
||||||
@@ -306,7 +306,7 @@
|
|||||||
class="q-pa-xs col-xs-12 col-sm-6 col-md-4 col-lg-3 grid-style-transition"
|
class="q-pa-xs col-xs-12 col-sm-6 col-md-4 col-lg-3 grid-style-transition"
|
||||||
:style="props.selected ? 'transform: scale(0.95);' : ''"
|
:style="props.selected ? 'transform: scale(0.95);' : ''"
|
||||||
>
|
>
|
||||||
<q-card :class="props.selected ? 'bg-grey-2' : ''" style="min-width: 200px;">
|
<q-card :class="props.selected ? 'bg-grey-2 my-card' : 'my-card'">
|
||||||
<q-bar v-if="!visuinpage" dense class="bg-primary text-white full-height">
|
<q-bar v-if="!visuinpage" dense class="bg-primary text-white full-height">
|
||||||
<span class=""> {{ props.row[col_title] }} </span>
|
<span class=""> {{ props.row[col_title] }} </span>
|
||||||
<q-space/>
|
<q-space/>
|
||||||
@@ -328,9 +328,7 @@
|
|||||||
<q-list dense>
|
<q-list dense>
|
||||||
<div v-for="col in mycolumns" :key="col.name">
|
<div v-for="col in mycolumns" :key="col.name">
|
||||||
|
|
||||||
<q-item v-if="showColCheck(col, false) &&
|
<q-item v-if="showColCheck(col, tools.TIPOVIS_SHOW_RECORD, false, tools.getValue(props.row,col.field, col.subfield))"
|
||||||
(!col.noshowifnone || (col.noshowifnone && tools.getValue(props.row,col.field, col.subfield))
|
|
||||||
)"
|
|
||||||
:class="clByCol(col)" class="riduci_pad">
|
:class="clByCol(col)" class="riduci_pad">
|
||||||
|
|
||||||
<q-item-section avatar v-if="col.icon">
|
<q-item-section avatar v-if="col.icon">
|
||||||
@@ -378,7 +376,7 @@
|
|||||||
<div
|
<div
|
||||||
class="q-ma-xs q-pa-xs text-center rounded-borders q-list--bordered"
|
class="q-ma-xs q-pa-xs text-center rounded-borders q-list--bordered"
|
||||||
v-for="mycol in mycolumns" :key="mycol.name">
|
v-for="mycol in mycolumns" :key="mycol.name">
|
||||||
<div v-if="showColCheck(mycol, false)">
|
<div v-if="showColCheck(mycol, tools.TIPOVIS_SHOW_RECORD, false)">
|
||||||
<div class="row items-center justify-center q-gutter-md q-ma-xs">
|
<div class="row items-center justify-center q-gutter-md q-ma-xs">
|
||||||
<div class="q-ma-xs">
|
<div class="q-ma-xs">
|
||||||
<q-field rounded outlined bg-color="orange-3" dense>
|
<q-field rounded outlined bg-color="orange-3" dense>
|
||||||
@@ -426,7 +424,7 @@
|
|||||||
<div
|
<div
|
||||||
v-for="col in mycolumns" :key="col.name" class="newrec_fields">
|
v-for="col in mycolumns" :key="col.name" class="newrec_fields">
|
||||||
<div
|
<div
|
||||||
v-if="showColCheck(col, true) && col.foredit">
|
v-if="showColCheck(col, tools.TIPOVIS_NEW_RECORD, true) && col.foredit">
|
||||||
<div class="">
|
<div class="">
|
||||||
<CMyPopupEdit
|
<CMyPopupEdit
|
||||||
:table="mytable"
|
:table="mytable"
|
||||||
@@ -469,7 +467,7 @@
|
|||||||
<div
|
<div
|
||||||
v-for="col in mycolumns" :key="col.name">
|
v-for="col in mycolumns" :key="col.name">
|
||||||
<div
|
<div
|
||||||
v-if="showColCheck(col, false) && col.foredit">
|
v-if="showColCheck(col, tools.TIPOVIS_EDIT_RECORD, false) && col.foredit">
|
||||||
<div>
|
<div>
|
||||||
<CMyPopupEdit
|
<CMyPopupEdit
|
||||||
:table="mytable"
|
:table="mytable"
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ export default defineComponent({
|
|||||||
// Carica il profilo di quest'utente
|
// Carica il profilo di quest'utente
|
||||||
if (username.value) {
|
if (username.value) {
|
||||||
userStore.loadFriends(username.value).then((ris) => {
|
userStore.loadFriends(username.value).then((ris) => {
|
||||||
console.log('ris', ris)
|
// console.log('ris', ris)
|
||||||
if (ris) {
|
if (ris) {
|
||||||
userStore.my.profile.friends = ris.listFriends ? ris.listFriends : []
|
userStore.my.profile.friends = ris.listFriends ? ris.listFriends : []
|
||||||
userStore.my.profile.req_friends = ris.listRequestFriends ? ris.listRequestFriends : []
|
userStore.my.profile.req_friends = ris.listRequestFriends ? ris.listRequestFriends : []
|
||||||
|
|||||||
@@ -251,6 +251,27 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function addNewValue(value: any) {
|
||||||
|
console.log('addNewValue', value, col.value)
|
||||||
|
|
||||||
|
if (col.value.allowNewValue && col.value.jointable) {
|
||||||
|
let myrec: any = {}
|
||||||
|
|
||||||
|
let mylabel = fieldsTable.getLabelByTable(col.value.jointable)
|
||||||
|
myrec[mylabel] = value
|
||||||
|
|
||||||
|
if (col.value.filter_field && props.value_extra) {
|
||||||
|
myrec[col.value.filter_field] = props.value_extra
|
||||||
|
}
|
||||||
|
|
||||||
|
// console.log('value_extra', props.value_extra)
|
||||||
|
if (props.table) {
|
||||||
|
return await globalStore.saveNewRecord(col.value.jointable, myrec)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
function changevalRec(newval: any) {
|
function changevalRec(newval: any) {
|
||||||
console.log('popypedit: changevalRec', newval)
|
console.log('popypedit: changevalRec', newval)
|
||||||
// console.log('row', props.row, 'col', props.mycol, 'newval', newval)
|
// console.log('row', props.row, 'col', props.mycol, 'newval', newval)
|
||||||
@@ -280,25 +301,29 @@ export default defineComponent({
|
|||||||
|
|
||||||
function mounted() {
|
function mounted() {
|
||||||
|
|
||||||
// console.log('mounted', 'isFieldDb()', isFieldDb())
|
try {
|
||||||
if (isFieldDb()) {
|
// console.log('mounted', 'isFieldDb()', isFieldDb())
|
||||||
|
if (isFieldDb()) {
|
||||||
|
|
||||||
} else {
|
|
||||||
if (props.subfield !== '') {
|
|
||||||
if (props.row[props.field] === undefined) {
|
|
||||||
myrow.value[props.field] = {}
|
|
||||||
myvalue.value = ''
|
|
||||||
} else {
|
|
||||||
myvalue.value = myrow.value[props.field][props.subfield]
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (props.field !== '')
|
if (props.subfield !== '') {
|
||||||
myvalue.value = myrow.value[props.field]
|
if (props.row[props.field] === undefined) {
|
||||||
else {
|
myrow.value[props.field] = {}
|
||||||
// @ts-ignore
|
myvalue.value = ''
|
||||||
myvalue.value = myrow.value
|
} else {
|
||||||
|
myvalue.value = myrow.value[props.field][props.subfield]
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (props.field !== '')
|
||||||
|
myvalue.value = myrow.value[props.field]
|
||||||
|
else {
|
||||||
|
// @ts-ignore
|
||||||
|
myvalue.value = myrow.value
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// console.log('popupedit: myvalue.value', myvalue.value)
|
// console.log('popupedit: myvalue.value', myvalue.value)
|
||||||
@@ -520,10 +545,6 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function visInNewRec(col: any) {
|
|
||||||
return (!col.notShowInNewRec || (col.showOnlyNewRec && props.insertMode)) && (!col.noShowView || (col.noShowView && props.isInModif))
|
|
||||||
}
|
|
||||||
|
|
||||||
function getclassCol(col: any) {
|
function getclassCol(col: any) {
|
||||||
if (col) {
|
if (col) {
|
||||||
let mycl = (col.disable || isviewfield()) ? '' : 'colmodif'
|
let mycl = (col.disable || isviewfield()) ? '' : 'colmodif'
|
||||||
@@ -631,6 +652,7 @@ export default defineComponent({
|
|||||||
isviewfield,
|
isviewfield,
|
||||||
changeval,
|
changeval,
|
||||||
changevalRec,
|
changevalRec,
|
||||||
|
addNewValue,
|
||||||
changevalRecHours,
|
changevalRecHours,
|
||||||
updatedata,
|
updatedata,
|
||||||
OpenEdit,
|
OpenEdit,
|
||||||
@@ -638,7 +660,6 @@ export default defineComponent({
|
|||||||
annulla,
|
annulla,
|
||||||
Savedb,
|
Savedb,
|
||||||
visuValByType,
|
visuValByType,
|
||||||
visInNewRec,
|
|
||||||
getclassCol,
|
getclassCol,
|
||||||
selectcountry,
|
selectcountry,
|
||||||
intcode_change,
|
intcode_change,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div :class="getclassCol(col)">
|
<div :class="getclassCol(col)">
|
||||||
<div v-if="(visInNewRec(col) && visulabel) || (!visulabel && !col.showOnlyNewRec && !col.noShowView) " style="flex-grow: 1;">
|
<div v-if="tools.checkIfShowField(col, (isInModif ? tools.TIPOVIS_EDIT_RECORD : 0) + (insertMode ? tools.TIPOVIS_NEW_RECORD : 0), visulabel, myvalue)" style="flex-grow: 1;">
|
||||||
<div
|
<div
|
||||||
:class="{ flex: !isInModif, 'justify-center': true }">
|
:class="{ flex: !isInModif, 'justify-center': true }">
|
||||||
<div>
|
<div>
|
||||||
@@ -91,6 +91,7 @@
|
|||||||
@update:value="changevalRec"
|
@update:value="changevalRec"
|
||||||
optval="_id" optlab="label"
|
optval="_id" optlab="label"
|
||||||
:useinput="false"
|
:useinput="false"
|
||||||
|
:col="col"
|
||||||
:options="tools.SelectHours">
|
:options="tools.SelectHours">
|
||||||
</CMySelect>
|
</CMySelect>
|
||||||
</div>
|
</div>
|
||||||
@@ -158,6 +159,7 @@
|
|||||||
<div v-else-if="col.fieldtype === costanti.FieldType.nationality">
|
<div v-else-if="col.fieldtype === costanti.FieldType.nationality">
|
||||||
<div v-if="isInModif" class="justify-center q-gutter-sm clgutter q-mt-sm">
|
<div v-if="isInModif" class="justify-center q-gutter-sm clgutter q-mt-sm">
|
||||||
<CMySelect
|
<CMySelect
|
||||||
|
:col="col"
|
||||||
:label="col.label"
|
:label="col.label"
|
||||||
v-model:value="myvalue"
|
v-model:value="myvalue"
|
||||||
@update:value="changevalRec"
|
@update:value="changevalRec"
|
||||||
@@ -176,6 +178,7 @@
|
|||||||
<div v-else-if="col.fieldtype === costanti.FieldType.intcode">
|
<div v-else-if="col.fieldtype === costanti.FieldType.intcode">
|
||||||
<div v-if="isInModif" class="justify-center q-gutter-sm clgutter q-mt-sm">
|
<div v-if="isInModif" class="justify-center q-gutter-sm clgutter q-mt-sm">
|
||||||
<CMySelect
|
<CMySelect
|
||||||
|
:col="col"
|
||||||
:label="col.label"
|
:label="col.label"
|
||||||
v-model:value="myvalue"
|
v-model:value="myvalue"
|
||||||
@update:value="changevalRec"
|
@update:value="changevalRec"
|
||||||
@@ -250,6 +253,7 @@
|
|||||||
<div v-else-if="col.fieldtype === costanti.FieldType.multiselect">
|
<div v-else-if="col.fieldtype === costanti.FieldType.multiselect">
|
||||||
<div v-if="isInModif">
|
<div v-if="isInModif">
|
||||||
<CMySelect
|
<CMySelect
|
||||||
|
:col="col"
|
||||||
:multiple="true"
|
:multiple="true"
|
||||||
:withToggle="true"
|
:withToggle="true"
|
||||||
:label="col.label"
|
:label="col.label"
|
||||||
@@ -266,7 +270,8 @@
|
|||||||
:optlab="fieldsTable.getLabelByTable(col.jointable)"
|
:optlab="fieldsTable.getLabelByTable(col.jointable)"
|
||||||
:options="globalStore.getTableJoinByName(col.jointable, col.addall, col.filter)"
|
:options="globalStore.getTableJoinByName(col.jointable, col.addall, col.filter)"
|
||||||
:sola_lettura="!isInModif"
|
:sola_lettura="!isInModif"
|
||||||
:useinput="false">
|
:useinput="col.allowNewValue"
|
||||||
|
:newvaluefunc="addNewValue">
|
||||||
</CMySelect>
|
</CMySelect>
|
||||||
|
|
||||||
<!--<q-select
|
<!--<q-select
|
||||||
@@ -314,18 +319,20 @@
|
|||||||
v-else-if="(col.fieldtype === costanti.FieldType.select) || (col.fieldtype === costanti.FieldType.select_by_server)">
|
v-else-if="(col.fieldtype === costanti.FieldType.select) || (col.fieldtype === costanti.FieldType.select_by_server)">
|
||||||
<div v-if="isInModif">
|
<div v-if="isInModif">
|
||||||
<CMySelect
|
<CMySelect
|
||||||
|
:col="col"
|
||||||
:label="col.label"
|
:label="col.label"
|
||||||
v-model:value="myvalue"
|
v-model:value="myvalue"
|
||||||
:pickup="col.fieldtype === costanti.FieldType.select_by_server"
|
:pickup="col.fieldtype === costanti.FieldType.select_by_server"
|
||||||
:tablesel="col.type === costanti.FieldType.select_by_server ? tablesel : ''"
|
:tablesel="col.type === costanti.FieldType.select_by_server ? tablesel : ''"
|
||||||
@update:value="changevalRec"
|
@update:value="changevalRec"
|
||||||
|
:newvaluefunc="addNewValue"
|
||||||
:filter_table="col.filter_table"
|
:filter_table="col.filter_table"
|
||||||
:filter_field="col.filter_field"
|
:filter_field="col.filter_field"
|
||||||
:value_extra="value_extra"
|
:value_extra="value_extra"
|
||||||
:optval="fieldsTable.getKeyByTable(col.jointable)"
|
:optval="fieldsTable.getKeyByTable(col.jointable)"
|
||||||
:optlab="fieldsTable.getLabelByTable(col.jointable)"
|
:optlab="fieldsTable.getLabelByTable(col.jointable)"
|
||||||
:options="globalStore.getTableJoinByName(col.jointable, col.addall, col.filter)"
|
:options="globalStore.getTableJoinByName(col.jointable, col.addall, col.filter)"
|
||||||
:useinput="false">
|
:useinput="col.allowNewValue">
|
||||||
</CMySelect>
|
</CMySelect>
|
||||||
</div>
|
</div>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
@@ -342,6 +349,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div v-else-if="col.fieldtype === costanti.FieldType.multiselect_by_server">
|
<div v-else-if="col.fieldtype === costanti.FieldType.multiselect_by_server">
|
||||||
<CMySelect
|
<CMySelect
|
||||||
|
:col="col"
|
||||||
:multiselect_by_server="true"
|
:multiselect_by_server="true"
|
||||||
:label="col.label"
|
:label="col.label"
|
||||||
v-model:arrvalue="myvalue"
|
v-model:arrvalue="myvalue"
|
||||||
@@ -365,6 +373,7 @@
|
|||||||
<div v-else-if="col.fieldtype === costanti.FieldType.star5">
|
<div v-else-if="col.fieldtype === costanti.FieldType.star5">
|
||||||
<div v-if="isInModif">
|
<div v-if="isInModif">
|
||||||
<CMySelect
|
<CMySelect
|
||||||
|
:col="col"
|
||||||
:label="col.label"
|
:label="col.label"
|
||||||
v-model:value="myvalue"
|
v-model:value="myvalue"
|
||||||
@update:value="changevalRec"
|
@update:value="changevalRec"
|
||||||
@@ -400,7 +409,7 @@
|
|||||||
</p>
|
</p>
|
||||||
<div v-if="!isFieldDb()">
|
<div v-if="!isFieldDb()">
|
||||||
<CMyEditor
|
<CMyEditor
|
||||||
v-model:value="myvalue" :title="getTitleEditor(col, row) && !isInModif" @keyup.enter.stop
|
v-model:value="myvalue" :title="!isInModif ? getTitleEditor(col, row) : ''" @keyup.enter.stop
|
||||||
:showButtons="false"
|
:showButtons="false"
|
||||||
:canModify="canModify"
|
:canModify="canModify"
|
||||||
@update:value="changevalRec"
|
@update:value="changevalRec"
|
||||||
@@ -529,6 +538,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div v-if="isFieldDb()">
|
<div v-if="isFieldDb()">
|
||||||
<CMySelect
|
<CMySelect
|
||||||
|
:col="col"
|
||||||
label="Ore" v-model:value="myvalue"
|
label="Ore" v-model:value="myvalue"
|
||||||
optval="value" optlab="label"
|
optval="value" optlab="label"
|
||||||
:dense="false"
|
:dense="false"
|
||||||
@@ -550,6 +560,7 @@
|
|||||||
<div
|
<div
|
||||||
v-else-if="(col.fieldtype === costanti.FieldType.select) || (col.fieldtype === costanti.FieldType.select_by_server)">
|
v-else-if="(col.fieldtype === costanti.FieldType.select) || (col.fieldtype === costanti.FieldType.select_by_server)">
|
||||||
<CMySelect
|
<CMySelect
|
||||||
|
:col="col"
|
||||||
:label="col.label"
|
:label="col.label"
|
||||||
v-model:value="scope.value"
|
v-model:value="scope.value"
|
||||||
:pickup="col.fieldtype === costanti.FieldType.select_by_server"
|
:pickup="col.fieldtype === costanti.FieldType.select_by_server"
|
||||||
@@ -557,14 +568,16 @@
|
|||||||
:filter_table="col.filter_table"
|
:filter_table="col.filter_table"
|
||||||
:filter_field="col.filter_field"
|
:filter_field="col.filter_field"
|
||||||
:value_extra="value_extra"
|
:value_extra="value_extra"
|
||||||
|
:newvaluefunc="addNewValue"
|
||||||
:optval="fieldsTable.getKeyByTable(col.jointable)"
|
:optval="fieldsTable.getKeyByTable(col.jointable)"
|
||||||
:optlab="fieldsTable.getLabelByTable(col.jointable)"
|
:optlab="fieldsTable.getLabelByTable(col.jointable)"
|
||||||
:options="globalStore.getTableJoinByName(col.jointable, col.addall, col.filter)"
|
:options="globalStore.getTableJoinByName(col.jointable, col.addall, col.filter)"
|
||||||
:useinput="false">
|
:useinput="col.allowNewValue">
|
||||||
</CMySelect>
|
</CMySelect>
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="col.fieldtype === costanti.FieldType.multiselect_by_server">
|
<div v-else-if="col.fieldtype === costanti.FieldType.multiselect_by_server">
|
||||||
<CMySelect
|
<CMySelect
|
||||||
|
:col="col"
|
||||||
:multiselect_by_server="true"
|
:multiselect_by_server="true"
|
||||||
:label="col.label"
|
:label="col.label"
|
||||||
v-model:arrvalue="scope.value"
|
v-model:arrvalue="scope.value"
|
||||||
@@ -597,6 +610,8 @@
|
|||||||
map-options
|
map-options
|
||||||
:options="globalStore.getTableJoinByName(col.jointable, col.addall, col.filter)"
|
:options="globalStore.getTableJoinByName(col.jointable, col.addall, col.filter)"
|
||||||
class="combowidth"
|
class="combowidth"
|
||||||
|
:useinput="col.allowNewValue"
|
||||||
|
:newvaluefunc="addNewValue"
|
||||||
:option-value="fieldsTable.getKeyByTable(col.jointable)"
|
:option-value="fieldsTable.getKeyByTable(col.jointable)"
|
||||||
@update:model-value="changeval">
|
@update:model-value="changeval">
|
||||||
|
|
||||||
@@ -617,6 +632,7 @@
|
|||||||
<div v-else-if="col.fieldtype === costanti.FieldType.nationality">
|
<div v-else-if="col.fieldtype === costanti.FieldType.nationality">
|
||||||
<div class="justify-center q-gutter-sm clgutter q-mt-sm">
|
<div class="justify-center q-gutter-sm clgutter q-mt-sm">
|
||||||
<CMySelect
|
<CMySelect
|
||||||
|
:col="col"
|
||||||
:label="col.label"
|
:label="col.label"
|
||||||
v-model:value="scope.value"
|
v-model:value="scope.value"
|
||||||
@update:value="changevalRec"
|
@update:value="changevalRec"
|
||||||
@@ -635,6 +651,7 @@
|
|||||||
<div v-else-if="col.fieldtype === costanti.FieldType.intcode">
|
<div v-else-if="col.fieldtype === costanti.FieldType.intcode">
|
||||||
<div class="justify-center q-gutter-sm clgutter q-mt-sm">
|
<div class="justify-center q-gutter-sm clgutter q-mt-sm">
|
||||||
<CMySelect
|
<CMySelect
|
||||||
|
:col="col"
|
||||||
:label="col.label"
|
:label="col.label"
|
||||||
v-model:value="scope.value"
|
v-model:value="scope.value"
|
||||||
@update:value="changevalRec"
|
@update:value="changevalRec"
|
||||||
@@ -659,6 +676,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div v-else-if="col.fieldtype === costanti.FieldType.star5">
|
<div v-else-if="col.fieldtype === costanti.FieldType.star5">
|
||||||
<CMySelect
|
<CMySelect
|
||||||
|
:col="col"
|
||||||
:label="col.label"
|
:label="col.label"
|
||||||
v-model:value="scope.value"
|
v-model:value="scope.value"
|
||||||
:optval="fieldsTable.getKeyByTable(col.jointable)"
|
:optval="fieldsTable.getKeyByTable(col.jointable)"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { computed, defineComponent, onMounted, ref, watch } from 'vue'
|
import { computed, defineComponent, onMounted, PropType, ref, toRef, watch } from 'vue'
|
||||||
import { useI18n } from '@src/boot/i18n'
|
import { useI18n } from '@src/boot/i18n'
|
||||||
import { useUserStore } from '@store/UserStore'
|
import { useUserStore } from '@store/UserStore'
|
||||||
import { useGlobalStore } from '@store/globalStore'
|
import { useGlobalStore } from '@store/globalStore'
|
||||||
@@ -6,6 +6,8 @@ import { useQuasar } from 'quasar'
|
|||||||
import { costanti } from '@costanti'
|
import { costanti } from '@costanti'
|
||||||
import { fieldsTable } from '@store/Modules/fieldsTable'
|
import { fieldsTable } from '@store/Modules/fieldsTable'
|
||||||
import { shared_consts } from '@/common/shared_vuejs'
|
import { shared_consts } from '@/common/shared_vuejs'
|
||||||
|
import { IColGridTable, IOperators } from 'model'
|
||||||
|
import { tools } from '@store/Modules/tools'
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'CMySelect',
|
name: 'CMySelect',
|
||||||
@@ -42,6 +44,13 @@ export default defineComponent({
|
|||||||
required: false,
|
required: false,
|
||||||
default: 0
|
default: 0
|
||||||
},
|
},
|
||||||
|
col: {
|
||||||
|
type: Object as PropType<IColGridTable>,
|
||||||
|
required: false,
|
||||||
|
default: () => {
|
||||||
|
return { name: '' }
|
||||||
|
},
|
||||||
|
},
|
||||||
filter_table: {
|
filter_table: {
|
||||||
type: String,
|
type: String,
|
||||||
required: false,
|
required: false,
|
||||||
@@ -122,19 +131,10 @@ export default defineComponent({
|
|||||||
const myarrvalue = ref(<any[]>[])
|
const myarrvalue = ref(<any[]>[])
|
||||||
const arrtempOpt = ref(<any[]>[])
|
const arrtempOpt = ref(<any[]>[])
|
||||||
|
|
||||||
|
const optionsreal: any = []
|
||||||
|
|
||||||
const valoriload = computed(() => {
|
const valoriload = computed(() => {
|
||||||
let myarr = props.options
|
return updateArrOptions()
|
||||||
if (props.addall) {
|
|
||||||
let myobj: any = {}
|
|
||||||
if (typeof props.optlab === 'string') {
|
|
||||||
myobj[props.optlab] = '(Tutti)'
|
|
||||||
myobj[props.optval] = costanti.FILTER_TUTTI
|
|
||||||
}
|
|
||||||
|
|
||||||
myarr = [myobj, ...myarr]
|
|
||||||
}
|
|
||||||
|
|
||||||
return myarr
|
|
||||||
})
|
})
|
||||||
|
|
||||||
watch(() => props.options, (value: any, oldval: any) => {
|
watch(() => props.options, (value: any, oldval: any) => {
|
||||||
@@ -146,13 +146,13 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
watch(() => props.value, (value: any, oldval: any) => {
|
watch(() => props.value, (value: any, oldval: any) => {
|
||||||
mounted()
|
update()
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
watch(() => props.arrvalue, (value: any, oldval: any) => {
|
watch(() => props.arrvalue, (value: any, oldval: any) => {
|
||||||
console.log(' MODIF props.arrvalue', props.arrvalue)
|
console.log(' MODIF props.arrvalue', props.arrvalue)
|
||||||
mounted()
|
update()
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -222,16 +222,22 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
|
|
||||||
function mounted() {
|
function mounted() {
|
||||||
|
optionsreal.value = props.options
|
||||||
|
update()
|
||||||
|
}
|
||||||
|
|
||||||
|
function update() {
|
||||||
|
// console.log('update')
|
||||||
// console.log(' #### mounted myselect', props.options, 'arrvalue', myarrvalue.value)
|
// console.log(' #### mounted myselect', props.options, 'arrvalue', myarrvalue.value)
|
||||||
let rec: any
|
let rec: any
|
||||||
if (props.options) {
|
if (optionsreal.value) {
|
||||||
if (!props.multiselect_by_server) {
|
if (!props.multiselect_by_server) {
|
||||||
rec = props.options.find((myrec: any) => myrec[`${props.optval}`] === props.value)
|
rec = optionsreal.value.find((myrec: any) => myrec[`${props.optval}`] === props.value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (props.multiselect_by_server) {
|
if (props.multiselect_by_server) {
|
||||||
const num = parseInt(localStorage.getItem(props.tablesel + 'NUM')!)
|
const num = parseInt(localStorage.getItem(props.tablesel + 'NUM')!)
|
||||||
console.log('num LOADED ', num)
|
// console.log('num LOADED ', num)
|
||||||
arrtempOpt.value = []
|
arrtempOpt.value = []
|
||||||
if (props.addall) {
|
if (props.addall) {
|
||||||
let myobj: any = {}
|
let myobj: any = {}
|
||||||
@@ -262,72 +268,109 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (rec) {
|
|
||||||
if (props.funcgetvaluebyid)
|
if (props.multiple) {
|
||||||
myvalue.value = props.funcgetvaluebyid(rec[`${props.optval}`])
|
let arrrec = []
|
||||||
else
|
for (const val of props.arrvalue) {
|
||||||
myvalue.value = rec[`${props.optlab}`]
|
rec = optionsreal.value.find((myrec: any) => val === (myrec[`${props.optval}`]))
|
||||||
} else {
|
if (rec) {
|
||||||
// if (!props.useinput) {
|
arrrec.push(rec[`${props.optval}`])
|
||||||
if (props.value) {
|
}
|
||||||
myvalue.value = props.value
|
}
|
||||||
|
if (arrrec) {
|
||||||
|
if (props.funcgetvaluebyid)
|
||||||
|
myarrvalue.value = props.funcgetvaluebyid(arrrec)
|
||||||
|
else
|
||||||
|
myarrvalue.value = arrrec
|
||||||
|
} else {
|
||||||
|
if (props.arrvalue) {
|
||||||
|
myarrvalue.value = props.arrvalue
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// }
|
|
||||||
}
|
|
||||||
// console.log('@@@ VALORI CHANGED (4)', valori.value)
|
|
||||||
if (!props.multiselect_by_server) {
|
|
||||||
valori.value = valoriload.value
|
|
||||||
} else {
|
} else {
|
||||||
|
if (rec) {
|
||||||
|
if (props.funcgetvaluebyid)
|
||||||
|
myvalue.value = props.funcgetvaluebyid(rec[`${props.optval}`])
|
||||||
|
else
|
||||||
|
myvalue.value = rec[`${props.optlab}`]
|
||||||
|
} else {
|
||||||
|
// if (!props.useinput) {
|
||||||
|
if (props.value) {
|
||||||
|
myvalue.value = props.value
|
||||||
|
}
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
// console.log('myvalue', props.tablesel, myvalue.value)
|
||||||
|
// console.log('props.value', props.value)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (props.multiselect_by_server) {
|
||||||
valori.value = arrtempOpt.value
|
valori.value = arrtempOpt.value
|
||||||
|
} else {
|
||||||
|
valori.value = valoriload.value
|
||||||
}
|
}
|
||||||
// console.log('cmyselect: myvalue.value', myvalue.value)
|
// console.log('cmyselect: myvalue.value', myvalue.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateArrOptions() {
|
||||||
|
let myarr: any = []
|
||||||
|
|
||||||
|
if (props.col.jointable) {
|
||||||
|
optionsreal.value = globalStore.getTableJoinByName(props.col.jointable, props.col.addall, props.col.filter)
|
||||||
|
}
|
||||||
|
|
||||||
|
myarr = optionsreal.value
|
||||||
|
if (!fieldsTable.tableRemotePickup.includes(props.tablesel)) {
|
||||||
|
|
||||||
|
let needle: any = props.value_extra
|
||||||
|
|
||||||
|
// console.log('needle', needle, 'props.multiple', props.multiple)
|
||||||
|
if (props.filter_table) {
|
||||||
|
// console.log(' FILTERTABLE', props.filter_field, myarr)
|
||||||
|
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))
|
||||||
|
}
|
||||||
|
// console.log(' RISSSSSSSSS: ', myarr)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (props.addall) {
|
||||||
|
let myobj: any = {}
|
||||||
|
if (typeof props.optlab === 'string') {
|
||||||
|
myobj[props.optlab] = '(Tutti)'
|
||||||
|
myobj[props.optval] = costanti.FILTER_TUTTI
|
||||||
|
}
|
||||||
|
|
||||||
|
if (myarr)
|
||||||
|
myarr = [myobj, ...myarr]
|
||||||
|
// console.log(' myarr: ', myarr)
|
||||||
|
}
|
||||||
|
|
||||||
|
return myarr
|
||||||
|
}
|
||||||
|
|
||||||
function filterFn(val: any, update: any, abort: any) {
|
function filterFn(val: any, update: any, abort: any) {
|
||||||
update(
|
update(
|
||||||
async () => {
|
async () => {
|
||||||
console.log('Filter val', val, val.length)
|
console.log('Filter val', val, val.length)
|
||||||
|
|
||||||
let myarr: any = []
|
let myarr: any = []
|
||||||
|
|
||||||
if (!fieldsTable.tableRemotePickup.includes(props.tablesel)) {
|
myarr = updateArrOptions()
|
||||||
myarr = props.options
|
if (!fieldsTable.tableRemotePickup.includes(props.tablesel)) {
|
||||||
|
if (myarr && myarr.length > 0) {
|
||||||
|
valori.value = myarr
|
||||||
|
} else {
|
||||||
|
if (props.filter_table) {
|
||||||
|
valori.value = []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
let needle: any = props.value_extra
|
if (val.length <= 1) {
|
||||||
|
|
||||||
// console.log('needle', needle)
|
|
||||||
if (props.filter_table) {
|
|
||||||
// console.log(' FILTERTABLE', props.filter_field, myarr)
|
|
||||||
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))
|
|
||||||
}
|
|
||||||
// console.log(' RISSSSSSSSS: ', myarr)
|
|
||||||
}
|
|
||||||
if (props.addall) {
|
|
||||||
let myobj: any = {}
|
|
||||||
if (typeof props.optlab === 'string') {
|
|
||||||
myobj[props.optlab] = '(Tutti)'
|
|
||||||
myobj[props.optval] = costanti.FILTER_TUTTI
|
|
||||||
}
|
|
||||||
|
|
||||||
if (myarr)
|
|
||||||
myarr = [myobj, ...myarr]
|
|
||||||
// console.log(' myarr: ', myarr)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (myarr && myarr.length > 0) {
|
|
||||||
valori.value = myarr
|
|
||||||
} else {
|
|
||||||
if (props.filter_table) {
|
|
||||||
valori.value = []
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (val.length <= 1) {
|
|
||||||
console.log('@@@ LENGTH <= 1')
|
console.log('@@@ LENGTH <= 1')
|
||||||
abort()
|
abort()
|
||||||
return
|
return
|
||||||
@@ -339,7 +382,7 @@ export default defineComponent({
|
|||||||
|
|
||||||
if (fieldsTable.tableRemotePickup.includes(props.tablesel)) {
|
if (fieldsTable.tableRemotePickup.includes(props.tablesel)) {
|
||||||
try {
|
try {
|
||||||
myarr = props.options
|
myarr = optionsreal.value
|
||||||
if (mystr !== '')
|
if (mystr !== '')
|
||||||
// myarr = [{_id:1, prov: 'RN', descr: 'Rimini'}]
|
// myarr = [{_id:1, prov: 'RN', descr: 'Rimini'}]
|
||||||
myarr = await globalStore.loadPickup({ table: props.tablesel, search: mystr.trim() })
|
myarr = await globalStore.loadPickup({ table: props.tablesel, search: mystr.trim() })
|
||||||
@@ -354,16 +397,15 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
// const needle = val.toLocaleLowerCase()
|
// const needle = val.toLocaleLowerCase()
|
||||||
// optFiltered.value = optFiltered.value.filter((v: any) => v.toLocaleLowerCase().indexOf(needle) > -1)
|
// optFiltered.value = optFiltered.value.filter((v: any) => v.toLocaleLowerCase().indexOf(needle) > -1)
|
||||||
}
|
if (props.addall) {
|
||||||
|
let myobj: any = {}
|
||||||
|
if (typeof props.optlab === 'string') {
|
||||||
|
myobj[props.optlab] = '(Tutti)'
|
||||||
|
myobj[props.optval] = costanti.FILTER_TUTTI
|
||||||
|
}
|
||||||
|
|
||||||
if (props.addall) {
|
myarr = [myobj, ...myarr]
|
||||||
let myobj: any = {}
|
|
||||||
if (typeof props.optlab === 'string') {
|
|
||||||
myobj[props.optlab] = '(Tutti)'
|
|
||||||
myobj[props.optval] = costanti.FILTER_TUTTI
|
|
||||||
}
|
}
|
||||||
|
|
||||||
myarr = [myobj, ...myarr]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (myarr && myarr.length > 0) {
|
if (myarr && myarr.length > 0) {
|
||||||
@@ -377,10 +419,12 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
// "ref" is the Vue reference to the QSelect
|
// "ref" is the Vue reference to the QSelect
|
||||||
(ref: any) => {
|
(ref: any) => {
|
||||||
// console.log('ref.options', ref.options)
|
if (!props.useinput) {
|
||||||
if (val !== '' && ref.options.length > 0) {
|
// console.log('ref.options', ref.options)
|
||||||
ref.setOptionIndex(-1) // reset optionIndex in case there is something selected
|
if (val !== '' && ref.options.length > 0) {
|
||||||
ref.moveOptionSelection(1, true) // focus the first selectable option and do not update the input-value
|
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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -394,6 +438,62 @@ export default defineComponent({
|
|||||||
return (rec._id > 0 && typeof rec._id === 'number') || rec._id !== 'number'
|
return (rec._id > 0 && typeof rec._id === 'number') || rec._id !== 'number'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function newvaluefuncfirst(value: any, done: any) {
|
||||||
|
if (props.newvaluefunc && props.col) {
|
||||||
|
const fieldval = fieldsTable.getLabelByTable(props.col.jointable!)
|
||||||
|
// console.log('fieldval', fieldval, 'optionsreal.value', optionsreal.value)
|
||||||
|
// Se esiste già, non crearlo
|
||||||
|
const esiste = optionsreal.value.find((rec: any) => {
|
||||||
|
// console.log('rec[fieldval]',rec[fieldval], value.toLowerCase())
|
||||||
|
return rec[fieldval].toLowerCase() === value.toLowerCase() && (rec[props.filter_field] === props.value_extra)
|
||||||
|
})
|
||||||
|
console.log('esiste', esiste)
|
||||||
|
if (!esiste || (esiste && esiste.length === 0)) {
|
||||||
|
// console.log('non esiste, lo creo ! ', value)
|
||||||
|
const newrec = await props.newvaluefunc(tools.CapitalizeAllWords(value))
|
||||||
|
if (newrec) {
|
||||||
|
if (props.col && props.col.jointable) {
|
||||||
|
// Reload
|
||||||
|
// console.log(' A1', optionsreal.value)
|
||||||
|
// valori.value = valoriload.value
|
||||||
|
// optionsreal.value = valori.value
|
||||||
|
console.log('DOPO', optionsreal.value)
|
||||||
|
}
|
||||||
|
console.log('newrec', newrec)
|
||||||
|
const myid = fieldsTable.getKeyByTable(props.col.jointable!)
|
||||||
|
const recfound = valori.value.find((rec: any) => rec[myid] === newrec[myid])
|
||||||
|
if (!recfound) {
|
||||||
|
done(newrec, 'add-unique')
|
||||||
|
}
|
||||||
|
|
||||||
|
// console.log('myid', myid, optionsreal.value)
|
||||||
|
// console.log('recfound',recfound)
|
||||||
|
// console.log('newrec[myid]',newrec[myid])
|
||||||
|
/*if (recfound) {
|
||||||
|
const arrout = [...myarrvalue.value]
|
||||||
|
if (!arrout.includes(recfound[myid])) {
|
||||||
|
arrout.push(recfound[myid])
|
||||||
|
}
|
||||||
|
console.log(' arrout (1)', arrout)
|
||||||
|
if (props.multiple || props.multiselect_by_server) {
|
||||||
|
if (myid) {
|
||||||
|
done(newrec, 'add-unique')
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
done(recfound[myid], 'add-unique')
|
||||||
|
}
|
||||||
|
|
||||||
|
/* if (props.multiple || props.multiselect_by_server) {
|
||||||
|
console.log('arrout (2)', arrout)
|
||||||
|
changeval(arrout)
|
||||||
|
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(mounted)
|
onMounted(mounted)
|
||||||
|
|
||||||
|
|
||||||
@@ -406,6 +506,7 @@ export default defineComponent({
|
|||||||
fieldsTable,
|
fieldsTable,
|
||||||
checkIfShowRec,
|
checkIfShowRec,
|
||||||
abortFilterFn,
|
abortFilterFn,
|
||||||
|
newvaluefuncfirst,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -119,8 +119,7 @@
|
|||||||
:input-class="myclass"
|
:input-class="myclass"
|
||||||
:use-input="useinput"
|
:use-input="useinput"
|
||||||
input-debounce="0"
|
input-debounce="0"
|
||||||
@new-value="newvaluefunc"
|
@new-value="newvaluefuncfirst"
|
||||||
new-value-mode="add-unique"
|
|
||||||
map-options
|
map-options
|
||||||
emit-value
|
emit-value
|
||||||
stack-label
|
stack-label
|
||||||
@@ -176,12 +175,13 @@
|
|||||||
@update:model-value="changeval"
|
@update:model-value="changeval"
|
||||||
@filter="filterFn"
|
@filter="filterFn"
|
||||||
:label="label"
|
:label="label"
|
||||||
|
:use-input="useinput"
|
||||||
|
@new-value="newvaluefuncfirst"
|
||||||
emit-value
|
emit-value
|
||||||
options-selected-class="text-deep-orange"
|
options-selected-class="text-deep-orange"
|
||||||
map-options
|
map-options
|
||||||
v-bind="$attrs"
|
v-bind="$attrs"
|
||||||
class="combowidth"
|
class="combowidth">
|
||||||
>
|
|
||||||
<template v-slot:option="scope">
|
<template v-slot:option="scope">
|
||||||
<q-item v-bind="scope.itemProps">
|
<q-item v-bind="scope.itemProps">
|
||||||
<q-item-section avatar>
|
<q-item-section avatar>
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ export default defineComponent({
|
|||||||
function getdefaultnewrec(): IMySkill {
|
function getdefaultnewrec(): IMySkill {
|
||||||
return {
|
return {
|
||||||
_id: 0,
|
_id: 0,
|
||||||
|
idSector: 0,
|
||||||
idSkill: 0,
|
idSkill: 0,
|
||||||
idSubSkill: [],
|
idSubSkill: [],
|
||||||
idStatusSkill: [],
|
idStatusSkill: [],
|
||||||
@@ -102,6 +103,7 @@ export default defineComponent({
|
|||||||
lk_proj: {
|
lk_proj: {
|
||||||
recSkill: 1,
|
recSkill: 1,
|
||||||
sector: 1,
|
sector: 1,
|
||||||
|
idSector: 1,
|
||||||
idSkill: 1,
|
idSkill: 1,
|
||||||
idSubSkill: 1,
|
idSubSkill: 1,
|
||||||
idStatusSkill: 1,
|
idStatusSkill: 1,
|
||||||
@@ -132,6 +134,7 @@ export default defineComponent({
|
|||||||
lk_proj: {
|
lk_proj: {
|
||||||
recSkill: 1,
|
recSkill: 1,
|
||||||
sector: 1,
|
sector: 1,
|
||||||
|
idSector: 1,
|
||||||
idSkill: 1,
|
idSkill: 1,
|
||||||
idSubSkill: 1,
|
idSubSkill: 1,
|
||||||
idStatusSkill: 1,
|
idStatusSkill: 1,
|
||||||
|
|||||||
@@ -868,7 +868,7 @@ $heightBtn: 100%;
|
|||||||
}
|
}
|
||||||
|
|
||||||
.combowidth {
|
.combowidth {
|
||||||
min-width: 100px;
|
min-width: 180px;
|
||||||
@media (max-width: 450px) {
|
@media (max-width: 450px) {
|
||||||
min-width: 250px;
|
min-width: 250px;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -502,19 +502,15 @@ export interface IColGridTable {
|
|||||||
addall?: boolean
|
addall?: boolean
|
||||||
filter?: any
|
filter?: any
|
||||||
resultjoin?: string[]
|
resultjoin?: string[]
|
||||||
visuonlyEditVal?: boolean
|
|
||||||
noshowifnone?: boolean
|
|
||||||
notShowInNewRec?: boolean
|
|
||||||
tablesel?: string
|
tablesel?: string
|
||||||
notsave?: boolean
|
notsave?: boolean
|
||||||
showOnlyNewRec?: boolean
|
showWhen?: number
|
||||||
visuinpage?: boolean
|
|
||||||
noShowView?: boolean
|
|
||||||
maxlength?: number
|
maxlength?: number
|
||||||
filter_table?: string
|
filter_table?: string
|
||||||
filter_field?: string
|
filter_field?: string
|
||||||
field_extra1?: string
|
field_extra1?: string
|
||||||
subfield_extra1?: string
|
subfield_extra1?: string
|
||||||
|
allowNewValue?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ITableRec {
|
export interface ITableRec {
|
||||||
@@ -650,6 +646,7 @@ export interface ICity {
|
|||||||
|
|
||||||
export interface IMySkill {
|
export interface IMySkill {
|
||||||
_id: number
|
_id: number
|
||||||
|
idSector: number
|
||||||
idSkill: number
|
idSkill: number
|
||||||
idSubSkill: number[]
|
idSubSkill: number[]
|
||||||
idStatusSkill: number[]
|
idStatusSkill: number[]
|
||||||
|
|||||||
@@ -598,6 +598,7 @@ const msg_it = {
|
|||||||
newproj: 'Titolo Progetto',
|
newproj: 'Titolo Progetto',
|
||||||
newsubproj: 'Titolo Sotto-Progetto',
|
newsubproj: 'Titolo Sotto-Progetto',
|
||||||
insertbottom: 'Inserisci Nuovo Project',
|
insertbottom: 'Inserisci Nuovo Project',
|
||||||
|
shortdescr: 'Breve Descrizione',
|
||||||
longdescr: 'Descrizione',
|
longdescr: 'Descrizione',
|
||||||
note: 'Note',
|
note: 'Note',
|
||||||
hoursplanned: 'Ore Preventivate',
|
hoursplanned: 'Ore Preventivate',
|
||||||
@@ -809,7 +810,7 @@ const msg_it = {
|
|||||||
photos: 'Foto',
|
photos: 'Foto',
|
||||||
note: 'Note',
|
note: 'Note',
|
||||||
short_node: 'Breve Nota',
|
short_node: 'Breve Nota',
|
||||||
subskill: 'Specializz.',
|
subskill: 'Specializzazione',
|
||||||
},
|
},
|
||||||
level: {
|
level: {
|
||||||
name: 'Livello',
|
name: 'Livello',
|
||||||
|
|||||||
@@ -28,6 +28,14 @@ export const costanti = {
|
|||||||
|
|
||||||
DRAGULA: false,
|
DRAGULA: false,
|
||||||
|
|
||||||
|
showWhen: {
|
||||||
|
NewRec: 1,
|
||||||
|
InPage: 2,
|
||||||
|
InEdit: 4,
|
||||||
|
InView: 8,
|
||||||
|
InView_OnlyifExist: 16,
|
||||||
|
},
|
||||||
|
|
||||||
TABEVENTS: 'myevents',
|
TABEVENTS: 'myevents',
|
||||||
|
|
||||||
NOFIELD: 'nofield',
|
NOFIELD: 'nofield',
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ function AddCol(params: IColGridTable) {
|
|||||||
titlepopupedit: (params.titlepopupedit === undefined) ? '' : params.titlepopupedit,
|
titlepopupedit: (params.titlepopupedit === undefined) ? '' : params.titlepopupedit,
|
||||||
field_extra1: (params.field_extra1 === undefined) ? '' : params.field_extra1,
|
field_extra1: (params.field_extra1 === undefined) ? '' : params.field_extra1,
|
||||||
subfield_extra1: (params.subfield_extra1 === undefined) ? '' : params.subfield_extra1,
|
subfield_extra1: (params.subfield_extra1 === undefined) ? '' : params.subfield_extra1,
|
||||||
|
allowNewValue: (params.allowNewValue === undefined) ? false : params.allowNewValue,
|
||||||
visible: (params.visible === undefined) ? true : params.visible,
|
visible: (params.visible === undefined) ? true : params.visible,
|
||||||
icon: (params.icon === undefined) ? '' : params.icon,
|
icon: (params.icon === undefined) ? '' : params.icon,
|
||||||
action: (params.action === undefined) ? '' : params.action,
|
action: (params.action === undefined) ? '' : params.action,
|
||||||
@@ -63,18 +64,13 @@ function AddCol(params: IColGridTable) {
|
|||||||
fieldtype: (params.fieldtype === undefined) ? costanti.FieldType.string : params.fieldtype,
|
fieldtype: (params.fieldtype === undefined) ? costanti.FieldType.string : params.fieldtype,
|
||||||
tipovisu: (params.tipovisu === undefined) ? costanti.TipoVisu.TESTO : params.tipovisu,
|
tipovisu: (params.tipovisu === undefined) ? costanti.TipoVisu.TESTO : params.tipovisu,
|
||||||
link: (params.link === undefined) ? '' : params.link,
|
link: (params.link === undefined) ? '' : params.link,
|
||||||
visuonlyEditVal: (params.visuonlyEditVal === undefined) ? false : params.visuonlyEditVal,
|
|
||||||
askaction: (params.askaction === undefined) ? '' : params.askaction,
|
askaction: (params.askaction === undefined) ? '' : params.askaction,
|
||||||
tablesel: (params.tablesel === undefined) ? '' : params.tablesel,
|
tablesel: (params.tablesel === undefined) ? '' : params.tablesel,
|
||||||
jointable: (params.jointable === undefined) ? '' : params.jointable,
|
jointable: (params.jointable === undefined) ? '' : params.jointable,
|
||||||
addall: (params.addall === undefined) ? false : params.addall,
|
addall: (params.addall === undefined) ? false : params.addall,
|
||||||
filter: (params.filter === undefined) ? null : params.filter,
|
filter: (params.filter === undefined) ? null : params.filter,
|
||||||
noshowifnone: (params.noshowifnone === undefined) ? false : params.noshowifnone,
|
showWhen: (params.showWhen === undefined) ? costanti.showWhen.NewRec + costanti.showWhen.InEdit + costanti.showWhen.InView : params.showWhen,
|
||||||
noshowlabel: (params.noshowlabel === undefined) ? false : params.noshowlabel,
|
noshowlabel: (params.noshowlabel === undefined) ? false : params.noshowlabel,
|
||||||
notShowInNewRec: (params.notShowInNewRec === undefined) ? false : params.notShowInNewRec,
|
|
||||||
showOnlyNewRec: (params.showOnlyNewRec === undefined) ? false : params.showOnlyNewRec,
|
|
||||||
visuinpage: (params.visuinpage === undefined) ? false : params.visuinpage,
|
|
||||||
noShowView: (params.noShowView === undefined) ? false : params.noShowView,
|
|
||||||
notsave: (params.notsave === undefined) ? false : params.notsave,
|
notsave: (params.notsave === undefined) ? false : params.notsave,
|
||||||
filter_table: (params.filter_table === undefined) ? '' : params.filter_table,
|
filter_table: (params.filter_table === undefined) ? '' : params.filter_table,
|
||||||
maxlength: (params.maxlength === undefined) ? 0 : params.maxlength,
|
maxlength: (params.maxlength === undefined) ? 0 : params.maxlength,
|
||||||
@@ -272,7 +268,7 @@ export const colTableHours = [
|
|||||||
// AddCol({ name: 'time_start', label_trans: 'hours.time_start', fieldtype: costanti.FieldType.number }),
|
// AddCol({ name: 'time_start', label_trans: 'hours.time_start', fieldtype: costanti.FieldType.number }),
|
||||||
// AddCol({ name: 'time_end', label_trans: 'hours.time_end', fieldtype: costanti.FieldType.number }),
|
// AddCol({ name: 'time_end', label_trans: 'hours.time_end', fieldtype: costanti.FieldType.number }),
|
||||||
AddCol({ name: 'descr', label_trans: 'hours.note' }),
|
AddCol({ name: 'descr', label_trans: 'hours.note' }),
|
||||||
AddCol({ name: 'username', label_trans: 'reg.username_short', notShowInNewRec: true }),
|
AddCol({ name: 'username', label_trans: 'reg.username_short', showWhen: costanti.showWhen.InPage + costanti.showWhen.InEdit + costanti.showWhen.InView }),
|
||||||
AddCol(DeleteRec),
|
AddCol(DeleteRec),
|
||||||
AddCol(DuplicateRec),
|
AddCol(DuplicateRec),
|
||||||
]
|
]
|
||||||
@@ -426,13 +422,16 @@ export const colmySkills = [
|
|||||||
}), */
|
}), */
|
||||||
//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: 'subTitle', label_trans: 'event.title', fieldtype: costanti.FieldType.string, noshowifnone: true, maxlength: 70, noshowlabel: true, noShowView: true }),
|
AddCol({ name: 'subTitle', label_trans: 'event.title', fieldtype: costanti.FieldType.string,
|
||||||
|
showWhen: costanti.showWhen.NewRec + costanti.showWhen.InPage + costanti.showWhen.InEdit , maxlength: 70, noshowlabel: true }),
|
||||||
|
AddCol({ name: 'descr', label_trans: 'proj.shortdescr', fieldtype: costanti.FieldType.string,
|
||||||
|
showWhen: costanti.showWhen.NewRec + costanti.showWhen.InPage + costanti.showWhen.InEdit + costanti.showWhen.InView_OnlyifExist, noshowlabel: true, maxlength: 200 }),
|
||||||
AddCol({
|
AddCol({
|
||||||
name: 'photos',
|
name: 'photos',
|
||||||
label_trans: 'skill.photos',
|
label_trans: 'skill.photos',
|
||||||
fieldtype: costanti.FieldType.listimages,
|
fieldtype: costanti.FieldType.listimages,
|
||||||
jointable: '',
|
jointable: '',
|
||||||
noshowifnone: true,
|
showWhen: costanti.showWhen.NewRec + costanti.showWhen.InPage + costanti.showWhen.InEdit + costanti.showWhen.InView_OnlyifExist,
|
||||||
}),
|
}),
|
||||||
AddCol({
|
AddCol({
|
||||||
name: 'idSector',
|
name: 'idSector',
|
||||||
@@ -440,8 +439,7 @@ export const colmySkills = [
|
|||||||
fieldtype: costanti.FieldType.select,
|
fieldtype: costanti.FieldType.select,
|
||||||
required: true,
|
required: true,
|
||||||
jointable: 'sectors',
|
jointable: 'sectors',
|
||||||
notsave: true,
|
showWhen: costanti.showWhen.NewRec + costanti.showWhen.InEdit,
|
||||||
showOnlyNewRec: true,
|
|
||||||
visible: true,
|
visible: true,
|
||||||
}),
|
}),
|
||||||
AddCol({
|
AddCol({
|
||||||
@@ -454,48 +452,47 @@ export const colmySkills = [
|
|||||||
filter_field: 'idSector',
|
filter_field: 'idSector',
|
||||||
noshowlabel: true,
|
noshowlabel: true,
|
||||||
icon: 'far fa-id-card',
|
icon: 'far fa-id-card',
|
||||||
visuinpage: true,
|
showWhen: costanti.showWhen.NewRec + costanti.showWhen.InPage + costanti.showWhen.InEdit + costanti.showWhen.InView,
|
||||||
|
allowNewValue: true,
|
||||||
}),
|
}),
|
||||||
AddCol({
|
AddCol({
|
||||||
name: 'idSubSkill',
|
name: 'idSubSkill',
|
||||||
label_trans: 'skill.subskill',
|
label_trans: 'skill.subskill',
|
||||||
fieldtype: costanti.FieldType.multiselect,
|
fieldtype: costanti.FieldType.multiselect,
|
||||||
required: true,
|
required: false,
|
||||||
jointable: 'subskills',
|
jointable: 'subskills',
|
||||||
filter_table: 'skills',
|
filter_table: 'skills',
|
||||||
filter_field: 'idSkill',
|
filter_field: 'idSkill',
|
||||||
noshowlabel: true,
|
noshowlabel: true,
|
||||||
icon: 'fas fa-scroll',
|
icon: 'fas fa-scroll',
|
||||||
visuinpage: true,
|
showWhen: costanti.showWhen.NewRec + costanti.showWhen.InPage + costanti.showWhen.InEdit + costanti.showWhen.InView,
|
||||||
|
allowNewValue: true,
|
||||||
}),
|
}),
|
||||||
AddCol({
|
AddCol({
|
||||||
name: 'numLevel',
|
name: 'numLevel',
|
||||||
label_trans: 'level.name',
|
label_trans: 'level.name',
|
||||||
fieldtype: costanti.FieldType.star5,
|
fieldtype: costanti.FieldType.star5,
|
||||||
required: true,
|
required: false,
|
||||||
jointable: 'levels',
|
jointable: 'levels',
|
||||||
noshowifnone: true,
|
showWhen: costanti.showWhen.NewRec + costanti.showWhen.InPage + costanti.showWhen.InEdit + costanti.showWhen.InView_OnlyifExist,
|
||||||
noshowlabel: true,
|
noshowlabel: true,
|
||||||
icon: 'fas fa-layer-group',
|
icon: 'fas fa-layer-group',
|
||||||
visuinpage: true,
|
|
||||||
}),
|
}),
|
||||||
AddCol({
|
AddCol({
|
||||||
name: 'idStatusSkill',
|
name: 'idStatusSkill',
|
||||||
label_trans: 'statusSkill.name',
|
label_trans: 'statusSkill.name',
|
||||||
fieldtype: costanti.FieldType.multiselect,
|
fieldtype: costanti.FieldType.multiselect,
|
||||||
jointable: 'statusSkills',
|
jointable: 'statusSkills',
|
||||||
noshowifnone: true,
|
showWhen: costanti.showWhen.NewRec + costanti.showWhen.InPage + costanti.showWhen.InEdit + costanti.showWhen.InView_OnlyifExist,
|
||||||
visuinpage: true,
|
|
||||||
}),
|
}),
|
||||||
AddCol({
|
AddCol({
|
||||||
name: 'idContribType',
|
name: 'idContribType',
|
||||||
label_trans: 'contribtype.name',
|
label_trans: 'contribtype.name',
|
||||||
fieldtype: costanti.FieldType.multiselect,
|
fieldtype: costanti.FieldType.multiselect,
|
||||||
jointable: 'contribtypes',
|
jointable: 'contribtypes',
|
||||||
noshowifnone: true,
|
showWhen: costanti.showWhen.NewRec + costanti.showWhen.InPage + costanti.showWhen.InEdit + costanti.showWhen.InView_OnlyifExist,
|
||||||
noshowlabel: true,
|
noshowlabel: true,
|
||||||
icon: 'fas fa-hands-helping',
|
icon: 'fas fa-hands-helping',
|
||||||
visuinpage: true,
|
|
||||||
}),
|
}),
|
||||||
AddCol({
|
AddCol({
|
||||||
name: 'idCity',
|
name: 'idCity',
|
||||||
@@ -505,11 +502,12 @@ export const colmySkills = [
|
|||||||
tablesel: 'cities',
|
tablesel: 'cities',
|
||||||
noshowlabel: true,
|
noshowlabel: true,
|
||||||
icon: 'fas fa-map-marker-alt',
|
icon: 'fas fa-map-marker-alt',
|
||||||
visuinpage: true,
|
showWhen: costanti.showWhen.NewRec + costanti.showWhen.InPage + costanti.showWhen.InEdit + costanti.showWhen.InView,
|
||||||
}),
|
}),
|
||||||
AddCol({ name: 'username', label_trans: 'reg.username', foredit: false, tipovisu: costanti.TipoVisu.LINK, link: '/my/username', noshowlabel: true }),
|
AddCol({ name: 'username', label_trans: 'reg.username', foredit: false, tipovisu: costanti.TipoVisu.LINK, link: '/my/username', noshowlabel: true }),
|
||||||
AddCol({ name: 'note', label_trans: 'proj.longdescr', fieldtype: costanti.FieldType.html, noshowifnone: true,
|
AddCol({ name: 'note', label_trans: 'proj.longdescr', fieldtype: costanti.FieldType.html,
|
||||||
titlepopupedit: 'Dettagli:', field_extra1: 'username', subfield_extra1: '' }),
|
showWhen: costanti.showWhen.NewRec + costanti.showWhen.InEdit + costanti.showWhen.InView_OnlyifExist,
|
||||||
|
titlepopupedit: 'Dettagli', field_extra1: 'username', subfield_extra1: '' }),
|
||||||
AddCol(DuplicateRec),
|
AddCol(DuplicateRec),
|
||||||
AddCol(ModifRec),
|
AddCol(ModifRec),
|
||||||
AddCol(DeleteRec),
|
AddCol(DeleteRec),
|
||||||
@@ -1822,7 +1820,7 @@ export const fieldsTable = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: 'subskills',
|
value: 'subskills',
|
||||||
label: 'Specializz',
|
label: 'Specializzazione',
|
||||||
columns: colSubSkills,
|
columns: colSubSkills,
|
||||||
colkey: '_id',
|
colkey: '_id',
|
||||||
collabel: 'descr',
|
collabel: 'descr',
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { translation } from '@store/Modules/translation'
|
import { translation } from '@store/Modules/translation'
|
||||||
import {
|
import {
|
||||||
|
IColGridTable,
|
||||||
IColl,
|
IColl,
|
||||||
ICollaborations, IDataToSet,
|
ICollaborations, IDataToSet,
|
||||||
IEvents, IFriends,
|
IEvents, IFriends,
|
||||||
@@ -61,6 +62,11 @@ export const tools = {
|
|||||||
TYPECONF_ZOOM: 'zoom',
|
TYPECONF_ZOOM: 'zoom',
|
||||||
TYPECONF_JITSI: 'jitsi',
|
TYPECONF_JITSI: 'jitsi',
|
||||||
|
|
||||||
|
TIPOVIS_NEW_RECORD: 1,
|
||||||
|
TIPOVIS_EDIT_RECORD: 2,
|
||||||
|
TIPOVIS_SHOW_RECORD: 4,
|
||||||
|
TIPOVIS_SHOW_INPAGE: 8,
|
||||||
|
|
||||||
APORTADOR_SOLIDARIO: 'apsol',
|
APORTADOR_SOLIDARIO: 'apsol',
|
||||||
|
|
||||||
IDAPP_AYNI: '7',
|
IDAPP_AYNI: '7',
|
||||||
@@ -1477,7 +1483,7 @@ export const tools = {
|
|||||||
} else {
|
} else {
|
||||||
ris = myimage
|
ris = myimage
|
||||||
}
|
}
|
||||||
}catch (e) {
|
} catch (e) {
|
||||||
return myimage
|
return myimage
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4582,6 +4588,30 @@ export const tools = {
|
|||||||
return (str + '').replace(/[\\"']/g, '\\$&').replace(/\u0000/g, '\\0')
|
return (str + '').replace(/[\\"']/g, '\\$&').replace(/\u0000/g, '\\0')
|
||||||
},
|
},
|
||||||
|
|
||||||
|
checkIfShowField(col: IColGridTable, tipovis: number, visulabel: boolean, valuePresent: any = '') {
|
||||||
|
|
||||||
|
let check = (col.visible)
|
||||||
|
|
||||||
|
if (tipovis === tools.TIPOVIS_NEW_RECORD) {
|
||||||
|
check = check && tools.isBitActive(col.showWhen, costanti.showWhen.NewRec)
|
||||||
|
} else if (tipovis === tools.TIPOVIS_EDIT_RECORD) {
|
||||||
|
check = check && tools.isBitActive(col.showWhen, costanti.showWhen.InEdit)
|
||||||
|
} else if (tipovis === tools.TIPOVIS_SHOW_RECORD) {
|
||||||
|
if (tools.isBitActive(col.showWhen, costanti.showWhen.InView_OnlyifExist)) {
|
||||||
|
check = check && valuePresent
|
||||||
|
} else {
|
||||||
|
check = check && tools.isBitActive(col.showWhen, costanti.showWhen.InView)
|
||||||
|
}
|
||||||
|
} else if (tipovis === tools.TIPOVIS_SHOW_INPAGE) {
|
||||||
|
check = check && tools.isBitActive(col.showWhen, costanti.showWhen.InPage)
|
||||||
|
}
|
||||||
|
|
||||||
|
return check
|
||||||
|
|
||||||
|
|
||||||
|
// (!col.noShowView || (col.noShowView && isInModif)) ||
|
||||||
|
// (!visulabel && !col.showOnlyNewRec && !col.noShowView)
|
||||||
|
},
|
||||||
|
|
||||||
// getLocale() {
|
// getLocale() {
|
||||||
// if (navigator.languages && navigator.languages.length > 0) {
|
// if (navigator.languages && navigator.languages.length > 0) {
|
||||||
|
|||||||
@@ -470,6 +470,48 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
UpdateValuesInMemoryByTable(mydata: any, table: string): void {
|
||||||
|
|
||||||
|
try {
|
||||||
|
const mylist = this.getListByTable(table)
|
||||||
|
const mykey = fieldsTable.getKeyByTable(table)
|
||||||
|
const id = mydata[mykey]
|
||||||
|
|
||||||
|
console.log('mylist', mylist)
|
||||||
|
console.log('mykey', mykey)
|
||||||
|
console.log('id', id)
|
||||||
|
|
||||||
|
if (mylist) {
|
||||||
|
const myrec = mylist.find((event: any) => event[mykey] === id)
|
||||||
|
// console.log('myrec', myrec)
|
||||||
|
if (myrec) {
|
||||||
|
// console.log('key', value, myrec[key])
|
||||||
|
for (const [key, value] of Object.entries(mydata)) {
|
||||||
|
myrec[key] = value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('update: ', myrec)
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
newValueInMemoryByTable(mydata: any, table: string): void {
|
||||||
|
|
||||||
|
try {
|
||||||
|
const mylist = this.getListByTable(table)
|
||||||
|
|
||||||
|
if (mylist) {
|
||||||
|
mylist.push(mydata)
|
||||||
|
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
createPushSubscription() {
|
createPushSubscription() {
|
||||||
|
|
||||||
// If Already subscribed, don't send to the Server DB
|
// If Already subscribed, don't send to the Server DB
|
||||||
@@ -799,6 +841,27 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
async saveNewRecord(mytable: string, myrec: any) {
|
||||||
|
const userStore = useUserStore()
|
||||||
|
console.log('saveNewRecord', mytable, myrec)
|
||||||
|
|
||||||
|
const mydata: any = {
|
||||||
|
table: mytable,
|
||||||
|
data: myrec
|
||||||
|
}
|
||||||
|
|
||||||
|
mydata.data.userId = userStore.my._id
|
||||||
|
|
||||||
|
const ris = await this.saveTable(mydata)
|
||||||
|
|
||||||
|
if (ris) {
|
||||||
|
this.newValueInMemoryByTable(ris, mytable);
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('saveNewRecord', ris)
|
||||||
|
return ris
|
||||||
|
},
|
||||||
|
|
||||||
async saveFieldValue(mydata: IDataToSet) {
|
async saveFieldValue(mydata: IDataToSet) {
|
||||||
// const userStore = useUserStore()
|
// const userStore = useUserStore()
|
||||||
return Api.SendReq('/chval', 'PATCH', { data: mydata })
|
return Api.SendReq('/chval', 'PATCH', { data: mydata })
|
||||||
|
|||||||
Reference in New Issue
Block a user