- Gruppi (2)
This commit is contained in:
@@ -5,6 +5,8 @@ import { tools } from '../../store/Modules/tools'
|
||||
|
||||
import { fieldsTable } from '@store/Modules/fieldsTable'
|
||||
|
||||
import { shared_consts } from '@/common/shared_vuejs'
|
||||
|
||||
import {
|
||||
IColGridTable,
|
||||
IFilter,
|
||||
@@ -313,6 +315,15 @@ export default defineComponent({
|
||||
|
||||
function canModifyThisRec(rec: any) {
|
||||
// console.log('rec', rec)
|
||||
|
||||
if (tablesel.value === 'mygroups') {
|
||||
// is Admin ?
|
||||
const trovato = rec.admins.find((myuser: any) => myuser.username === userStore.my.username)
|
||||
if (trovato) {
|
||||
return !!trovato
|
||||
}
|
||||
}
|
||||
|
||||
if (rec.hasOwnProperty('userId')) {
|
||||
let userId = rec.userId
|
||||
if (userId === userStore.my._id) {
|
||||
@@ -819,6 +830,8 @@ export default defineComponent({
|
||||
|
||||
await createNewRecordDialog()
|
||||
|
||||
console.log('newRecord.value', newRecord.value)
|
||||
|
||||
serverData.value.push(newRecord.value)
|
||||
pagination.value.rowsNumber++
|
||||
|
||||
@@ -882,6 +895,7 @@ export default defineComponent({
|
||||
|
||||
function exec_func_table(table: string, func: number, par: IParamDialog) {
|
||||
|
||||
|
||||
if (func === lists.MenuAction.DELETE_RECTABLE) {
|
||||
globalStore.DeleteRec({ table, id: par.param1 }).then((ris) => {
|
||||
if (ris) {
|
||||
@@ -1149,10 +1163,29 @@ export default defineComponent({
|
||||
return ok
|
||||
}
|
||||
|
||||
function getColMissing() {
|
||||
|
||||
let col: IColGridTable
|
||||
|
||||
for (col of mycolumns.value) {
|
||||
if (col.required) {
|
||||
// console.log('newRecord.value', newRecord.value, newRecord.value[col.name])
|
||||
if (!newRecord.value[col.name]) {
|
||||
// console.log('col.name', col.name)
|
||||
return translate(col.label_trans)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ''
|
||||
}
|
||||
|
||||
async function saveNewRecord() {
|
||||
// check if the field are setted
|
||||
|
||||
if (!enableSaveNewRec()) {
|
||||
tools.showNeutralNotif($q, 'Si prega di compilare il campo \'' + getColMissing() + '\'', 5000)
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -1243,10 +1276,21 @@ export default defineComponent({
|
||||
return ((rec._id > 0 && typeof rec._id === 'number') || rec._id !== 'number') && rec !== -100
|
||||
}
|
||||
|
||||
function showColCheck(col: IColGridTable, tipovis: number, visulabel:boolean, value: any = ''){
|
||||
function showColCheck(col: IColGridTable, tipovis: number, visulabel:boolean, value: any = '', record: any = null){
|
||||
const check = tools.checkIfShowField(col, tipovis, visulabel, value)
|
||||
|
||||
const valuePresent = (colVisib.value.includes(col.field! + col.subfield) || colVisib.value.includes(col.field + '.' + col.subfield))
|
||||
let valuePresent = (colVisib.value.includes(col.field! + col.subfield) || colVisib.value.includes(col.field + '.' + col.subfield))
|
||||
|
||||
if (valuePresent && col.visibleif! > 0 && record) {
|
||||
if (col.visib_field) {
|
||||
if (col.visibleif === costanti.BINARY_CHECK) {
|
||||
if (!tools.isBitActive(record[col.visib_field], col.visib_value))
|
||||
valuePresent = false
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return check && valuePresent
|
||||
}
|
||||
@@ -1337,6 +1381,7 @@ export default defineComponent({
|
||||
myvertical,
|
||||
showColCheck,
|
||||
getValueExtra,
|
||||
shared_consts,
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<q-space></q-space>
|
||||
<div v-if="butt_modif_new">
|
||||
<q-btn
|
||||
v-if="mytable && mytable !== 'myskills'" rounded dense size="sm" flat
|
||||
v-if="mytable && !shared_consts.TABLES_FINDER.includes(mytable)" rounded dense size="sm" flat
|
||||
:color="canEdit ? 'positive' : 'light-gray'"
|
||||
:disable="disabilita()"
|
||||
:val="lists.MenuAction.CAN_EDIT_TABLE"
|
||||
@@ -105,7 +105,7 @@
|
||||
:class="$q.screen.lt.sm ? `` : `row` + ` text-blue `">
|
||||
<span v-for="(item, index) in searchList" :key="index">
|
||||
<CMySelect
|
||||
:col="fieldsTable.getColByTable('myskills', item.key)"
|
||||
:col="fieldsTable.getColByTable(mytable, item.key)"
|
||||
v-if="(item.type === costanti.FieldType.select) || (item.type === costanti.FieldType.select_by_server)"
|
||||
:label="labelcombo(item)"
|
||||
v-model:value="item.value"
|
||||
@@ -129,7 +129,7 @@
|
||||
|
||||
<CMySelect
|
||||
v-if="item.type === costanti.FieldType.multiselect_by_server"
|
||||
:col="fieldsTable.getColByTable('myskills', item.key)"
|
||||
:col="fieldsTable.getColByTable(mytable, item.key)"
|
||||
:multiselect_by_server="true"
|
||||
:label="labelcombo(item)"
|
||||
v-model:arrvalue="item.arrvalue"
|
||||
@@ -261,7 +261,7 @@
|
||||
<q-td
|
||||
v-for="col in mycolumns" :key="col.name" :props="props">
|
||||
<div
|
||||
v-if="showColCheck(col, tools.TIPOVIS_SHOW_RECORD, true, 1)" class="tdclass">
|
||||
v-if="showColCheck(col, tools.TIPOVIS_SHOW_RECORD, true, 1, props.row)" class="tdclass">
|
||||
<div :class="getclrow(props.row)">
|
||||
<CMyPopupEdit
|
||||
:table="mytable"
|
||||
@@ -331,6 +331,7 @@
|
||||
<q-bar v-if="!visuinpage" dense class="bg-primary text-white full-height">
|
||||
<span class=""> {{ props.row[col_title] }} </span>
|
||||
<q-space/>
|
||||
|
||||
<q-btn
|
||||
v-if="canModifyThisRec(props.row)"
|
||||
flat round color="white" icon="fas fa-pencil-alt" size="sm"
|
||||
@@ -444,7 +445,7 @@
|
||||
<div
|
||||
v-for="col in mycolumns" :key="col.name" class="newrec_fields">
|
||||
<div
|
||||
v-if="showColCheck(col, tools.TIPOVIS_NEW_RECORD, true) && col.foredit">
|
||||
v-if="showColCheck(col, tools.TIPOVIS_NEW_RECORD, true, 0, newRecord) && col.foredit">
|
||||
<div class="">
|
||||
<CMyPopupEdit
|
||||
:table="mytable"
|
||||
|
||||
Reference in New Issue
Block a user