- Cataloghi aggiornamento...

This commit is contained in:
Surya Paolo
2025-02-11 18:58:06 +01:00
parent 3d0e307e42
commit 0ad4dcff75
23 changed files with 272 additions and 99 deletions

View File

@@ -2213,59 +2213,64 @@ export default defineComponent({
const ok = true
let myrec = null
if (newrec) {
myrec = { ...newRecord.value }
} else {
myrec = { ...recModif.value }
}
try {
// mycolumns.value.forEach((col: IColGridTable) => {
let col: IColGridTable
let myrec = null
if (newrec) {
myrec = { ...newRecord.value }
} else {
myrec = { ...recModif.value }
}
let msg = ''
// mycolumns.value.forEach((col: IColGridTable) => {
let col: IColGridTable
for (col of mycolumns.value) {
if (!msg) {
if (col.showonlyif_dipersona) {
const valori = myrec['idStatusSkill']
let msg = ''
if (valori && (valori.length === 1) && valori.includes(shared_consts.STATUSSKILL_ONLINE)) {
col.required = false
} else {
col.required = true
}
for (col of mycolumns.value) {
if (!msg) {
if (col.showonlyif_dipersona) {
const valori = myrec['idStatusSkill']
col.visible = col.required
}
if (col.required) {
// console.log('newRecord.value', newRecord.value, newRecord.value[col.name])
if (tools.isArray(myrec[col.name])) {
if (myrec[col.name].length <= 0) {
msg = 'Si prega di compilare il campo \'' + getColMissing(myrec) + '\''
if (valori && (valori.length === 1) && valori.includes(shared_consts.STATUSSKILL_ONLINE)) {
col.required = false
} else {
col.required = true
}
} else {
if (!myrec[col.name]) {
msg = 'Si prega di compilare il campo \'' + getColMissing(myrec) + '\''
col.visible = col.required
}
if (col.required) {
// console.log('newRecord.value', newRecord.value, newRecord.value[col.name])
if (tools.isArray(myrec[col.name])) {
if (myrec[col.name].length <= 0) {
msg = 'Si prega di compilare il campo \'' + getColMissing(myrec) + '\''
}
} else {
if (!myrec[col.name]) {
msg = 'Si prega di compilare il campo \'' + getColMissing(myrec) + '\''
}
}
}
}
if (!msg && col.maxlength! > 0) {
if (myrec[col.name].length > col.maxlength!) {
msg = t('annunci.maxlength', { name: translate(col.label_trans), maxlength: col.maxlength })
if (!msg && col.maxlength! > 0 && myrec && myrec[col.name]) {
if ((myrec[col.name].length > col.maxlength!) && (col.fieldtype !== costanti.FieldType.html)) {
msg = t('annunci.maxlength', { name: translate(col.label_trans), maxlength: col.maxlength })
}
}
}
if (!msg && col.minlength! > 0) {
if (myrec[col.name].length < col.minlength!) {
msg = t('annunci.minlength', { name: translate(col.label_trans), minlength: col.minlength })
if (!msg && col.minlength! > 0 && myrec && myrec[col.name]) {
if ((myrec[col.name].length < col.minlength!) && (col.fieldtype !== costanti.FieldType.html)) {
msg = t('annunci.minlength', { name: translate(col.label_trans), minlength: col.minlength })
}
}
}
}
}
if (showmsg && msg) {
tools.showNegativeNotif($q, msg, 5000)
return false
if (showmsg && msg) {
tools.showNegativeNotif($q, msg, 5000)
return false
}
} catch (e) {
}
return ok