2025-03-01 14:14:43 +01:00
|
|
|
import type { PropType } from 'vue';
|
|
|
|
|
import { defineComponent, onMounted, onBeforeMount, ref, toRef, watch, computed } from 'vue'
|
|
|
|
|
import { useI18n } from 'vue-i18n'
|
2021-09-16 21:08:02 +02:00
|
|
|
import { useUserStore } from '@store/UserStore'
|
|
|
|
|
import { useGlobalStore } from '@store/globalStore'
|
|
|
|
|
import { useQuasar } from 'quasar'
|
2025-03-01 14:14:43 +01:00
|
|
|
import type { IColGridTable, IImgGallery, ISpecialField } from 'model'
|
2021-09-16 21:08:02 +02:00
|
|
|
import { CMyChipList } from '../CMyChipList'
|
|
|
|
|
import { CDate } from '../CDate'
|
|
|
|
|
import { CDateTime } from '../CDateTime'
|
2022-02-24 23:36:27 +01:00
|
|
|
import { CLabel } from '../CLabel'
|
2021-09-16 21:08:02 +02:00
|
|
|
import { CMyToggleList } from '../CMyToggleList'
|
|
|
|
|
import { CMySelect } from '../CMySelect'
|
2022-09-12 18:36:54 +02:00
|
|
|
import { CCurrencyValue } from '../CCurrencyValue'
|
2024-07-31 15:02:30 +02:00
|
|
|
import { CMapEditAddressByCoord } from '../CMapEditAddressByCoord'
|
2025-04-04 18:15:14 +02:00
|
|
|
import { CInput } from '../CInput'
|
2021-09-16 21:08:02 +02:00
|
|
|
import { CMyEditor } from '../CMyEditor'
|
|
|
|
|
import { CGallery } from '../CGallery'
|
2022-11-17 08:10:43 +01:00
|
|
|
import { CSelectImage } from '../CSelectImage'
|
2022-05-05 23:56:23 +02:00
|
|
|
import { CAccomodation } from '../CAccomodation'
|
2025-03-01 14:14:43 +01:00
|
|
|
import { tools } from '@tools'
|
2021-09-16 21:08:02 +02:00
|
|
|
import { costanti } from '@costanti'
|
|
|
|
|
|
2022-11-28 14:00:15 +01:00
|
|
|
|
2021-12-03 22:47:53 +01:00
|
|
|
// @ts-ignore
|
|
|
|
|
// import VueTelInput from 'vue3-tel-input'
|
|
|
|
|
// import 'vue3-tel-input/dist/vue3-tel-input.css'
|
|
|
|
|
|
2021-09-16 21:08:02 +02:00
|
|
|
import { fieldsTable } from '@store/Modules/fieldsTable'
|
2025-03-01 14:14:43 +01:00
|
|
|
import MixinBase from '@src/mixins/mixin-base'
|
|
|
|
|
import MixinUsers from '@src/mixins/mixin-users'
|
2022-02-17 00:44:52 +01:00
|
|
|
import { toolsext } from '@store/Modules/toolsext'
|
2025-03-01 14:14:43 +01:00
|
|
|
import { shared_consts } from '@src/common/shared_vuejs'
|
2022-12-10 02:01:26 +01:00
|
|
|
import { useRouter } from 'vue-router'
|
2021-09-16 21:08:02 +02:00
|
|
|
|
2022-08-15 15:10:00 +02:00
|
|
|
|
2021-09-16 21:08:02 +02:00
|
|
|
export default defineComponent({
|
|
|
|
|
name: 'CMyPopupEdit',
|
2023-06-07 17:25:14 +02:00
|
|
|
emits: ['showandsave', 'update:row', 'show', 'save', 'annulla', 'update_col'],
|
2021-09-16 21:08:02 +02:00
|
|
|
props: {
|
2021-11-04 16:02:14 +01:00
|
|
|
title: {
|
|
|
|
|
type: String,
|
|
|
|
|
required: false,
|
|
|
|
|
default: '',
|
|
|
|
|
},
|
2021-09-16 21:08:02 +02:00
|
|
|
row: {
|
|
|
|
|
type: Object,
|
|
|
|
|
required: true,
|
|
|
|
|
},
|
2022-02-21 13:12:04 +01:00
|
|
|
rec: {
|
|
|
|
|
type: Object,
|
|
|
|
|
required: false,
|
|
|
|
|
default: null,
|
|
|
|
|
},
|
2022-11-17 08:10:43 +01:00
|
|
|
fielddb: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
required: false,
|
|
|
|
|
default: false,
|
|
|
|
|
},
|
2024-01-13 16:21:19 +01:00
|
|
|
dense: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
required: false,
|
|
|
|
|
default: false,
|
|
|
|
|
},
|
|
|
|
|
justifycenter: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
required: false,
|
|
|
|
|
default: true,
|
|
|
|
|
},
|
2022-02-05 23:28:01 +01:00
|
|
|
isrec: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
required: false,
|
|
|
|
|
default: false,
|
|
|
|
|
},
|
2021-11-04 16:02:14 +01:00
|
|
|
mycol: {
|
2022-11-17 08:10:43 +01:00
|
|
|
type: Object as PropType<IColGridTable | undefined>,
|
2021-09-16 21:08:02 +02:00
|
|
|
required: true,
|
|
|
|
|
},
|
|
|
|
|
canEdit: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
required: false,
|
|
|
|
|
default: false,
|
|
|
|
|
},
|
2022-01-16 23:20:46 +01:00
|
|
|
insertMode: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
required: false,
|
|
|
|
|
default: false,
|
|
|
|
|
},
|
2021-12-11 22:12:44 +01:00
|
|
|
canModify: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
required: false,
|
|
|
|
|
default: false,
|
|
|
|
|
},
|
2021-12-02 10:12:57 +01:00
|
|
|
isInModif: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
required: false,
|
|
|
|
|
default: false,
|
|
|
|
|
},
|
2021-09-16 21:08:02 +02:00
|
|
|
field: {
|
|
|
|
|
type: String,
|
|
|
|
|
required: false,
|
|
|
|
|
default: '',
|
|
|
|
|
},
|
|
|
|
|
subfield: {
|
|
|
|
|
type: String,
|
|
|
|
|
required: false,
|
|
|
|
|
default: '',
|
|
|
|
|
},
|
2021-11-04 16:02:14 +01:00
|
|
|
mysubsubkey: {
|
|
|
|
|
type: String,
|
|
|
|
|
required: false,
|
|
|
|
|
default: '',
|
|
|
|
|
},
|
2022-07-21 00:20:48 +02:00
|
|
|
specialField: {
|
|
|
|
|
type: Object as PropType<ISpecialField>,
|
|
|
|
|
required: false,
|
|
|
|
|
default: null,
|
|
|
|
|
},
|
2021-11-04 16:02:14 +01:00
|
|
|
serv: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
required: false,
|
|
|
|
|
default: false,
|
|
|
|
|
},
|
|
|
|
|
indrec: {
|
|
|
|
|
type: Number,
|
|
|
|
|
required: false,
|
|
|
|
|
default: -1,
|
|
|
|
|
},
|
|
|
|
|
type: {
|
|
|
|
|
type: Number,
|
|
|
|
|
required: false,
|
|
|
|
|
default: 0,
|
|
|
|
|
},
|
2021-09-16 21:08:02 +02:00
|
|
|
showall: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
required: false,
|
|
|
|
|
default: false,
|
|
|
|
|
},
|
|
|
|
|
view: {
|
|
|
|
|
type: String,
|
|
|
|
|
required: false,
|
|
|
|
|
default: 'row',
|
|
|
|
|
},
|
|
|
|
|
disable: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
required: false,
|
|
|
|
|
default: false,
|
|
|
|
|
},
|
|
|
|
|
visulabel: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
required: false,
|
|
|
|
|
default: false,
|
|
|
|
|
},
|
2021-11-04 16:02:14 +01:00
|
|
|
jointable: {
|
|
|
|
|
type: String,
|
|
|
|
|
required: false,
|
|
|
|
|
default: '',
|
|
|
|
|
},
|
2022-07-21 00:20:48 +02:00
|
|
|
filter: {
|
|
|
|
|
type: [String, Function],
|
|
|
|
|
required: false,
|
|
|
|
|
default: null,
|
|
|
|
|
},
|
2022-01-26 01:31:07 +01:00
|
|
|
field_extra: {
|
|
|
|
|
type: String,
|
|
|
|
|
required: false,
|
|
|
|
|
default: '',
|
|
|
|
|
},
|
|
|
|
|
value_extra: {
|
|
|
|
|
type: [String, Number],
|
|
|
|
|
required: false,
|
|
|
|
|
default: '',
|
|
|
|
|
},
|
2021-10-28 00:37:48 +02:00
|
|
|
table: {
|
|
|
|
|
type: String,
|
|
|
|
|
required: false,
|
|
|
|
|
default: '',
|
|
|
|
|
},
|
2021-11-04 16:02:14 +01:00
|
|
|
myimg: {
|
|
|
|
|
type: String,
|
|
|
|
|
required: false,
|
|
|
|
|
default: '',
|
|
|
|
|
},
|
|
|
|
|
id: {
|
2022-02-17 17:43:27 +01:00
|
|
|
type: [String, Number],
|
2021-11-04 16:02:14 +01:00
|
|
|
required: false,
|
|
|
|
|
default: '',
|
|
|
|
|
},
|
|
|
|
|
idmain: {
|
|
|
|
|
type: String,
|
|
|
|
|
required: false,
|
|
|
|
|
default: '',
|
|
|
|
|
},
|
2021-12-21 01:26:29 +01:00
|
|
|
tablesel: {
|
|
|
|
|
type: String,
|
|
|
|
|
required: false,
|
|
|
|
|
default: '',
|
|
|
|
|
},
|
|
|
|
|
pickup: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
required: false,
|
|
|
|
|
default: false,
|
|
|
|
|
},
|
2022-11-17 08:10:43 +01:00
|
|
|
nosaveToDb: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
required: false,
|
|
|
|
|
default: false,
|
|
|
|
|
},
|
2024-02-28 17:04:34 +01:00
|
|
|
notAllowAtChar: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
required: false,
|
|
|
|
|
default: false,
|
|
|
|
|
},
|
2022-11-17 08:10:43 +01:00
|
|
|
path: {
|
|
|
|
|
type: String,
|
|
|
|
|
required: false,
|
|
|
|
|
default: '',
|
|
|
|
|
},
|
2021-09-16 21:08:02 +02:00
|
|
|
},
|
2022-11-29 00:16:25 +01:00
|
|
|
components: {
|
|
|
|
|
CMyChipList, CDateTime, CDate, CMyToggleList, CMySelect, CMyEditor, CGallery,
|
2025-04-04 18:15:14 +02:00
|
|
|
CCurrencyValue, CLabel, CAccomodation, CSelectImage, CMapEditAddressByCoord, CInput,
|
2022-11-29 00:16:25 +01:00
|
|
|
},
|
2021-09-16 21:08:02 +02:00
|
|
|
setup(props, { emit }) {
|
|
|
|
|
const $q = useQuasar()
|
|
|
|
|
const { t } = useI18n()
|
|
|
|
|
const userStore = useUserStore()
|
|
|
|
|
const globalStore = useGlobalStore()
|
|
|
|
|
|
2022-11-11 18:16:28 +01:00
|
|
|
const myvalue = ref(null as any)
|
2021-09-16 21:08:02 +02:00
|
|
|
const myvalueprec = ref('false')
|
|
|
|
|
const countryname = ref('')
|
|
|
|
|
const visueditor = ref(false)
|
2022-01-03 21:53:41 +01:00
|
|
|
const visuhtml = ref(false)
|
2021-10-28 00:37:48 +02:00
|
|
|
const showeditor = ref(false)
|
2021-09-16 21:08:02 +02:00
|
|
|
|
2022-11-11 18:16:28 +01:00
|
|
|
const myImgGall = ref([{}] as IImgGallery[])
|
2021-11-04 16:02:14 +01:00
|
|
|
|
2022-12-10 02:01:26 +01:00
|
|
|
const $router = useRouter()
|
|
|
|
|
|
2024-07-31 15:02:30 +02:00
|
|
|
const loaded = ref(false)
|
|
|
|
|
|
2025-04-11 18:49:42 +02:00
|
|
|
const popupEditRef = ref(null)
|
|
|
|
|
|
2025-02-03 17:18:33 +01:00
|
|
|
const addstrrequired = ref('')
|
|
|
|
|
|
2022-11-17 08:10:43 +01:00
|
|
|
const col = ref(<IColGridTable>{
|
2022-05-27 01:33:39 +02:00
|
|
|
name: 'test',
|
|
|
|
|
fieldtype: 0,
|
|
|
|
|
showWhen: costanti.showWhen.NewRec + costanti.showWhen.InEdit + costanti.showWhen.InView,
|
|
|
|
|
visible: true,
|
2022-07-10 01:24:54 +02:00
|
|
|
maxlength: props.mycol ? props.mycol.maxlength : 0,
|
|
|
|
|
minlength: props.mycol ? props.mycol.minlength : undefined
|
2022-11-17 08:10:43 +01:00
|
|
|
})
|
2021-11-04 16:02:14 +01:00
|
|
|
|
|
|
|
|
const { setValDb, getValDb } = MixinBase()
|
|
|
|
|
const { getMyUsername } = MixinUsers()
|
|
|
|
|
|
2022-02-21 13:12:04 +01:00
|
|
|
const myrealrow = toRef(props, 'row')
|
|
|
|
|
|
2021-12-02 10:12:57 +01:00
|
|
|
watch(() => props.row, (newval, oldval) => {
|
|
|
|
|
refresh()
|
|
|
|
|
})
|
|
|
|
|
|
2022-11-28 14:00:15 +01:00
|
|
|
watch(() => props.rec, (newval, oldval) => {
|
|
|
|
|
refresh()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const myrow = ref(<any>null)
|
2024-03-02 22:53:35 +01:00
|
|
|
const mypath = ref('')
|
2022-02-21 13:12:04 +01:00
|
|
|
|
2022-11-29 00:16:25 +01:00
|
|
|
/* const myrow = computed(() => {
|
|
|
|
|
return props.rec && props.isrec ? props.rec : props.row
|
|
|
|
|
})
|
|
|
|
|
*/
|
2021-11-04 16:02:14 +01:00
|
|
|
function crea() {
|
2024-09-18 13:11:56 +02:00
|
|
|
// console.log('crea', isFieldDb(), 'props.mycol', props.mycol)
|
2021-11-04 16:02:14 +01:00
|
|
|
|
2022-11-28 14:00:15 +01:00
|
|
|
if (props.mycol && props.mycol.name && props.mycol.name !== 'test') {
|
2023-04-17 00:11:45 +02:00
|
|
|
col.value = { ...props.mycol }
|
2021-11-04 16:02:14 +01:00
|
|
|
} else {
|
2022-11-28 14:00:15 +01:00
|
|
|
if (col.value.name === 'test') {
|
|
|
|
|
col.value.name = props.field
|
|
|
|
|
if (props.subfield) {
|
|
|
|
|
col.value.name += '.' + props.subfield
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-11-17 08:10:43 +01:00
|
|
|
col.value.jointable = props.jointable
|
|
|
|
|
if (props.filter)
|
|
|
|
|
col.value.filter = props.filter
|
|
|
|
|
col.value.fieldtype = props.type
|
|
|
|
|
|
|
|
|
|
if (props.type === costanti.FieldType.image) {
|
|
|
|
|
myImgGall.value = [{
|
|
|
|
|
_id: '',
|
|
|
|
|
imagefile: myvalue.value,
|
2024-09-17 17:38:57 +02:00
|
|
|
vers_img: 1,
|
2022-11-17 08:10:43 +01:00
|
|
|
alt: 'img',
|
|
|
|
|
}]
|
|
|
|
|
} else if (props.type === costanti.FieldType.imgcard) {
|
|
|
|
|
myImgGall.value = [myvalue.value]
|
|
|
|
|
}
|
2022-02-05 23:28:01 +01:00
|
|
|
|
2022-11-28 14:00:15 +01:00
|
|
|
// console.log('* col', col.value);
|
2022-11-17 08:10:43 +01:00
|
|
|
}
|
2022-02-05 23:28:01 +01:00
|
|
|
|
2022-11-17 08:10:43 +01:00
|
|
|
if (props.type) {
|
|
|
|
|
col.value.fieldtype = props.type
|
|
|
|
|
}
|
2022-02-05 23:28:01 +01:00
|
|
|
|
2022-11-17 08:10:43 +01:00
|
|
|
if (props.isrec) {
|
|
|
|
|
} else {
|
|
|
|
|
if (isFieldDb()) {
|
|
|
|
|
myvalue.value = getValDb(props.field, props.serv, '', props.table, props.subfield, props.id, props.idmain, props.indrec, props.mysubsubkey, props.specialField)
|
2022-02-05 23:28:01 +01:00
|
|
|
} else {
|
2022-11-17 08:10:43 +01:00
|
|
|
if (props.mycol && props.mycol.name)
|
|
|
|
|
col.value = { ...props.mycol }
|
2022-02-05 23:28:01 +01:00
|
|
|
}
|
2021-11-04 16:02:14 +01:00
|
|
|
}
|
|
|
|
|
|
2025-02-03 17:18:33 +01:00
|
|
|
addstrrequired.value = col.value.required ? '* ' : ''
|
|
|
|
|
|
2024-09-18 13:11:56 +02:00
|
|
|
// console.log('popupedit myvalue.value: ', myvalue.value)
|
2024-09-17 18:50:05 +02:00
|
|
|
|
2022-11-28 14:00:15 +01:00
|
|
|
if (props.tablesel) {
|
|
|
|
|
// let obj = tools.getParamsByTable(props.table)
|
|
|
|
|
// console.log('OBJ:', obj)
|
|
|
|
|
if (true) {
|
|
|
|
|
|
2022-11-29 17:35:41 +01:00
|
|
|
// console.log(' CAMPO', props.field + '.' + props.subfield)
|
2025-03-01 14:14:43 +01:00
|
|
|
const myval = tools.getLabelFooterByRow(myrow.value, props.field + '.' + props.subfield, props.table)
|
2022-11-28 14:00:15 +01:00
|
|
|
if (myval)
|
|
|
|
|
myvalue.value = myval
|
2022-11-29 17:35:41 +01:00
|
|
|
// console.log(' RECORD INPUT', myrow.value)
|
|
|
|
|
// console.log(' VALORE OUTPUT: ', myvalue.value)
|
2022-11-28 14:00:15 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-02 22:53:35 +01:00
|
|
|
if (props.path) {
|
|
|
|
|
mypath.value = props.path
|
|
|
|
|
} else {
|
2025-03-01 14:14:43 +01:00
|
|
|
if (tools.existProp(col.value, 'path'))
|
2024-03-02 22:53:35 +01:00
|
|
|
mypath.value = col.value.path ? col.value.path : ''
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-04 16:02:14 +01:00
|
|
|
// console.log('CMyFieldDb crea', myvalue)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
watch(() => props.id, (newval, oldval) => {
|
|
|
|
|
crea()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
2022-05-27 01:33:39 +02:00
|
|
|
function isFieldDb() {
|
2022-11-17 08:10:43 +01:00
|
|
|
// return props.type !== 0
|
|
|
|
|
return props.fielddb
|
2021-11-04 16:02:14 +01:00
|
|
|
}
|
|
|
|
|
|
2021-09-16 21:08:02 +02:00
|
|
|
function isviewfield() {
|
|
|
|
|
return props.view === 'field'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function changeval(newval: any) {
|
2022-09-20 11:14:08 +02:00
|
|
|
// console.log('changeval update:row', newval)
|
2022-02-08 23:06:22 +01:00
|
|
|
if (!props.isrec) {
|
|
|
|
|
emit('update:row', props.row)
|
|
|
|
|
}
|
2021-12-02 10:12:57 +01:00
|
|
|
if (props.isInModif)
|
|
|
|
|
OpenEdit()
|
2021-09-16 21:08:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getrealval(newval: any) {
|
2021-11-04 16:02:14 +01:00
|
|
|
if (col.value.fieldtype === costanti.FieldType.hours) {
|
2021-09-16 21:08:02 +02:00
|
|
|
newval = newval.value
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-28 00:57:28 +01:00
|
|
|
async function addNewValue(value: any) {
|
2022-11-28 14:00:15 +01:00
|
|
|
// console.log('addNewValue', value, col.value)
|
2022-01-28 00:57:28 +01:00
|
|
|
|
|
|
|
|
if (col.value.allowNewValue && col.value.jointable) {
|
2025-03-01 14:14:43 +01:00
|
|
|
const myrec: any = {}
|
2022-01-28 00:57:28 +01:00
|
|
|
|
2025-03-01 14:14:43 +01:00
|
|
|
const mylabel = fieldsTable.getLabelByTable(col.value.jointable)
|
2022-01-28 00:57:28 +01:00
|
|
|
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
|
|
|
|
|
}
|
|
|
|
|
|
2024-07-31 15:02:30 +02:00
|
|
|
function changeValRecCoordAddr(newval: any) {
|
|
|
|
|
// console.log('changeValRecCoordAddr', newval, 'myrow', myrow.value[col.value.name])
|
|
|
|
|
if (!myrow.value[col.value.name]) {
|
|
|
|
|
myrow.value[col.value.name] = {}
|
|
|
|
|
}
|
|
|
|
|
if (newval.coordinates && newval.coordinates.lat) {
|
|
|
|
|
newval.coordinates.lat = tools.convertToDecimal6(newval.coordinates.lat)
|
|
|
|
|
newval.coordinates.lng = tools.convertToDecimal6(newval.coordinates.lng)
|
|
|
|
|
}
|
|
|
|
|
// console.log('newval...', newval)
|
|
|
|
|
return changevalRecOrig(newval)
|
|
|
|
|
}
|
2021-09-16 21:08:02 +02:00
|
|
|
function changevalRec(newval: any) {
|
2025-01-14 18:34:58 +01:00
|
|
|
return changevalRecOrig(newval, props.subfield)
|
2024-07-31 15:02:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function changevalRecOrig(newval: any, subcol: string = '') {
|
2025-04-11 18:49:42 +02:00
|
|
|
console.log('changevalRec', newval)
|
2023-06-07 17:25:14 +02:00
|
|
|
// if (!props.insertMode || (props.insertMode && col.value.fieldtype !== costanti.FieldType.multioption)) {
|
|
|
|
|
if (col.value && col.value.allowchar === costanti.ALLOWCHAR_CODE) {
|
2024-02-28 17:04:34 +01:00
|
|
|
newval = tools.removespaces_slash(newval)
|
2023-06-07 17:25:14 +02:00
|
|
|
}
|
|
|
|
|
// console.log('popuppedit: changevalRec', newval, 'COLName', col.value.name)
|
2022-08-30 17:00:32 +02:00
|
|
|
|
2023-06-07 17:25:14 +02:00
|
|
|
// console.log('row', props.row, 'col', props.mycol, 'newval', newval)
|
|
|
|
|
// console.log('row[col.value.name]', props.row[col.value.name])
|
|
|
|
|
if (props.type === costanti.FieldType.image) {
|
|
|
|
|
// console.log('image', newval)
|
|
|
|
|
}
|
2022-11-28 14:00:15 +01:00
|
|
|
|
2024-02-28 17:04:34 +01:00
|
|
|
if (props.notAllowAtChar) {
|
|
|
|
|
newval = tools.rimuoviAtPrimoCarattere(newval)
|
|
|
|
|
}
|
|
|
|
|
|
2024-07-31 15:02:30 +02:00
|
|
|
if (subcol) {
|
2025-03-01 14:14:43 +01:00
|
|
|
const arrcol = col.value.name.split('.')
|
2025-01-14 18:34:58 +01:00
|
|
|
if (arrcol.length > 0) {
|
|
|
|
|
const primo = arrcol[0]
|
|
|
|
|
let sec = null
|
|
|
|
|
if (arrcol.length > 1)
|
|
|
|
|
sec = arrcol[1]
|
|
|
|
|
if (sec) {
|
|
|
|
|
if (!myrow.value[primo]) {
|
|
|
|
|
myrow.value[primo] = {}
|
|
|
|
|
}
|
|
|
|
|
myrow.value[primo][sec] = newval
|
|
|
|
|
} else {
|
|
|
|
|
myrow.value[primo] = newval
|
|
|
|
|
}
|
|
|
|
|
/*if (!myrow.value[col.value.name]) {
|
|
|
|
|
myrow.value[col.value.name] = {}
|
|
|
|
|
}
|
|
|
|
|
myrow.value[col.value.name][subcol] = newval*/
|
|
|
|
|
// console.log('myrow.value[col.value.name]', myrow.value[col.value.name])
|
2024-07-31 15:02:30 +02:00
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
myrow.value[col.value.name] = newval
|
|
|
|
|
}
|
2022-02-04 23:48:53 +01:00
|
|
|
|
2023-06-07 17:25:14 +02:00
|
|
|
// console.log('changevalRec update:row', myrow.value)
|
|
|
|
|
// emit('update:row', myrow.value)
|
|
|
|
|
emit('update_col', col.value.name, newval)
|
|
|
|
|
if (props.isInModif)
|
|
|
|
|
OpenEdit()
|
|
|
|
|
|
2025-04-11 18:49:42 +02:00
|
|
|
emit('save', newval)
|
2023-06-07 17:25:14 +02:00
|
|
|
|
|
|
|
|
// }
|
2021-09-16 21:08:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function changevalRecHours(newval: any) {
|
2021-11-04 16:02:14 +01:00
|
|
|
if (col.value.fieldtype === costanti.FieldType.hours) {
|
2021-09-16 21:08:02 +02:00
|
|
|
newval = newval.value
|
|
|
|
|
}
|
|
|
|
|
changevalRec(newval)
|
|
|
|
|
|
|
|
|
|
myvalue.value = newval
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function updatedata() {
|
|
|
|
|
mounted()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function mounted() {
|
2025-04-04 18:15:14 +02:00
|
|
|
// console.log('mounted CMyPopupEdit')
|
2024-09-06 19:57:17 +02:00
|
|
|
|
2021-12-02 10:12:57 +01:00
|
|
|
|
2022-11-29 00:16:25 +01:00
|
|
|
myrow.value = props.rec && props.isrec ? { ...props.rec } : { ...props.row }
|
2022-11-28 14:00:15 +01:00
|
|
|
|
2022-01-28 00:57:28 +01:00
|
|
|
try {
|
2022-02-21 13:12:04 +01:00
|
|
|
|
2024-12-17 17:56:03 +01:00
|
|
|
// console.log('mounted', 'isFieldDb()', myrow.value, 'sub', props.subfield, 'field', props.field)
|
2022-02-05 23:28:01 +01:00
|
|
|
if (isFieldDb() && !props.isrec) {
|
2022-11-28 14:00:15 +01:00
|
|
|
// console.log(' . none...')
|
2021-11-04 16:02:14 +01:00
|
|
|
} else {
|
2022-01-28 00:57:28 +01:00
|
|
|
if (props.subfield !== '') {
|
2022-02-21 13:12:04 +01:00
|
|
|
if (myrow.value[props.field] === undefined) {
|
2022-01-28 00:57:28 +01:00
|
|
|
myrow.value[props.field] = {}
|
|
|
|
|
myvalue.value = ''
|
|
|
|
|
} else {
|
|
|
|
|
myvalue.value = myrow.value[props.field][props.subfield]
|
|
|
|
|
}
|
|
|
|
|
} else {
|
2024-12-09 12:32:19 +01:00
|
|
|
let miorecord = myrow.value
|
|
|
|
|
if (props.table === 'arrvariazioni') {
|
|
|
|
|
miorecord = myrow.value.arrvariazioni[0]
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-28 00:57:28 +01:00
|
|
|
if (props.field !== '')
|
2024-12-09 12:32:19 +01:00
|
|
|
myvalue.value = miorecord[props.field]
|
2022-01-28 00:57:28 +01:00
|
|
|
else {
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
myvalue.value = myrow.value
|
|
|
|
|
}
|
2021-11-04 16:02:14 +01:00
|
|
|
}
|
2024-09-18 13:11:56 +02:00
|
|
|
// console.log('props.field', props.field, 'props.subfield', props.subfield, 'myvalue: ', myvalue)
|
2021-09-16 21:08:02 +02:00
|
|
|
}
|
2022-01-28 00:57:28 +01:00
|
|
|
} catch (e) {
|
|
|
|
|
|
2021-09-16 21:08:02 +02:00
|
|
|
}
|
|
|
|
|
|
2021-12-02 10:12:57 +01:00
|
|
|
// console.log('popupedit: myvalue.value', myvalue.value)
|
|
|
|
|
|
2021-10-28 00:37:48 +02:00
|
|
|
// console.log('myvalue.value', myvalue.value)
|
2021-09-16 21:08:02 +02:00
|
|
|
myvalueprec.value = myvalue.value
|
|
|
|
|
|
2025-04-04 18:15:14 +02:00
|
|
|
|
2022-11-17 08:10:43 +01:00
|
|
|
crea()
|
|
|
|
|
|
2024-07-31 15:02:30 +02:00
|
|
|
if (!loaded.value) {
|
|
|
|
|
|
|
|
|
|
if (col.value.fieldtype === costanti.FieldType.listimages) {
|
|
|
|
|
if (myvalue.value === '' || myvalue.value === undefined) {
|
|
|
|
|
// console.log('set default myvalue.value ')
|
|
|
|
|
myvalue.value = {
|
|
|
|
|
title: 'Galleria',
|
|
|
|
|
directory: 'none',
|
|
|
|
|
list: []
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else if (col.value.fieldtype === costanti.FieldType.listobj) {
|
|
|
|
|
if (myvalue.value === '' || myvalue.value === undefined) {
|
|
|
|
|
// console.log('set default myvalue.value ')
|
|
|
|
|
myvalue.value = [{
|
|
|
|
|
type: 0, // Letto matrimoniale / letto singolo / divano-letto / almaca / a terra sul tappeto (per sacco a pelo)
|
|
|
|
|
location: 0, // in camera privata / in camera condivisa / in soggiorno / in camper / in tenda / in giardino / all'aperto
|
|
|
|
|
num: 0,
|
|
|
|
|
}]
|
|
|
|
|
}
|
|
|
|
|
} else if (col.value.fieldtype === costanti.FieldType.coordinates) {
|
|
|
|
|
if (myvalue.value === '' || myvalue.value === undefined) {
|
|
|
|
|
// console.log('set default myvalue.value ')
|
|
|
|
|
myvalue.value = {
|
|
|
|
|
address: '',
|
|
|
|
|
coordinates: [0, 0]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!myvalue.value.address) {
|
|
|
|
|
myvalue.value.address = ''
|
|
|
|
|
}
|
|
|
|
|
if (!myvalue.value.coordinates) {
|
|
|
|
|
myvalue.value.coordinates = [0, 0]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
loaded.value = true
|
|
|
|
|
|
2021-09-16 21:08:02 +02:00
|
|
|
// console.log('myvalueprec', myvalueprec)
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-02 10:12:57 +01:00
|
|
|
function refresh() {
|
|
|
|
|
mounted()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2021-09-16 21:08:02 +02:00
|
|
|
function OpenEdit() {
|
|
|
|
|
// console.log('OpenEdit')
|
|
|
|
|
emit('show')
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-08 13:19:35 +02:00
|
|
|
function OpenEditDateToday() {
|
|
|
|
|
// console.log('OpenEdit')
|
|
|
|
|
myvalue.value = new Date()
|
|
|
|
|
emit('show')
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-04 16:02:14 +01:00
|
|
|
/*function getval() {
|
2021-09-16 21:08:02 +02:00
|
|
|
let myval: any = 'false'
|
|
|
|
|
|
|
|
|
|
if ((props.subfield !== '') && (props.subfield !== '')) {
|
|
|
|
|
if (myrow.value[props.field] === undefined) {
|
|
|
|
|
myrow.value[props.field] = {}
|
|
|
|
|
myval = ''
|
|
|
|
|
} else {
|
|
|
|
|
myval = myrow.value[props.field][props.subfield]
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (props.field !== '')
|
|
|
|
|
myval = myrow.value[props.field]
|
|
|
|
|
else
|
|
|
|
|
myval = myrow.value
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return myval
|
2021-11-04 16:02:14 +01:00
|
|
|
}*/
|
2021-09-16 21:08:02 +02:00
|
|
|
|
2024-12-09 12:32:19 +01:00
|
|
|
async function SaveValueInt(newVal: any, valinitial: any) {
|
2021-09-16 21:08:02 +02:00
|
|
|
|
2023-06-07 17:25:14 +02:00
|
|
|
console.log('SaveValueInt', newVal, valinitial)
|
2021-09-16 21:08:02 +02:00
|
|
|
|
2022-11-29 00:16:25 +01:00
|
|
|
if (props.tablesel) {
|
|
|
|
|
if (true) {
|
|
|
|
|
|
2025-03-01 14:14:43 +01:00
|
|
|
const mystrcol = '_id'
|
2022-11-29 00:16:25 +01:00
|
|
|
const mycol = fieldsTable.getColByTable(props.tablesel, mystrcol);
|
|
|
|
|
|
|
|
|
|
if (mycol) {
|
|
|
|
|
if (newVal)
|
|
|
|
|
newVal = newVal[mystrcol]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-02-28 17:04:34 +01:00
|
|
|
if (props.notAllowAtChar) {
|
|
|
|
|
newVal = tools.rimuoviAtPrimoCarattere(newVal)
|
|
|
|
|
myvalue.value = newVal
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
console.log('newVal', newVal)
|
2022-11-29 00:16:25 +01:00
|
|
|
|
2021-11-04 16:02:14 +01:00
|
|
|
if (isFieldDb()) {
|
2024-12-09 12:32:19 +01:00
|
|
|
await savefield(newVal, valinitial, $q)
|
2021-09-16 21:08:02 +02:00
|
|
|
} else {
|
2021-11-04 16:02:14 +01:00
|
|
|
// Update value in table memory
|
|
|
|
|
if (props.subfield !== '') {
|
|
|
|
|
if (myrow.value[props.field] === undefined)
|
|
|
|
|
myrow.value[props.field] = {}
|
|
|
|
|
myrow.value[props.field][props.subfield] = newVal
|
|
|
|
|
} else {
|
|
|
|
|
if (props.field !== '')
|
|
|
|
|
myrow.value[props.field] = newVal
|
2022-02-21 13:12:04 +01:00
|
|
|
else {
|
|
|
|
|
if (!props.isrec) {
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
myrealrow.value = newVal
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
2021-11-04 16:02:14 +01:00
|
|
|
}
|
2021-09-16 21:08:02 +02:00
|
|
|
}
|
2022-11-29 00:16:25 +01:00
|
|
|
|
2025-04-04 18:15:14 +02:00
|
|
|
console.log('SaveValueInt', newVal, valinitial)
|
|
|
|
|
|
2022-11-23 10:27:36 +01:00
|
|
|
emit('save', newVal, valinitial)
|
2021-11-04 16:02:14 +01:00
|
|
|
}
|
2021-09-16 21:08:02 +02:00
|
|
|
|
2022-11-29 00:16:25 +01:00
|
|
|
|
2024-12-09 12:32:19 +01:00
|
|
|
async function savefield(value: any, initialval: any, myq: any) {
|
2022-02-24 19:13:06 +01:00
|
|
|
if (!props.insertMode) {
|
|
|
|
|
myvalue.value = value
|
2024-12-09 12:32:19 +01:00
|
|
|
return tools.saveInDBForTypes(myq, props.field, myvalue.value, props.type, props.serv, props.table, props.subfield, props.id, props.indrec, props.mysubsubkey, props.specialField)
|
2022-02-24 19:13:06 +01:00
|
|
|
}
|
2021-09-16 21:08:02 +02:00
|
|
|
}
|
|
|
|
|
|
2021-11-04 16:02:14 +01:00
|
|
|
|
2021-09-16 21:08:02 +02:00
|
|
|
function annulla(val: any) {
|
|
|
|
|
emit('annulla', true)
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-04 16:02:14 +01:00
|
|
|
function savefieldboolean(value: any) {
|
|
|
|
|
if (myvalue.value === undefined)
|
|
|
|
|
myvalue.value = 'true'
|
|
|
|
|
else
|
|
|
|
|
myvalue.value = value
|
|
|
|
|
|
2024-09-17 17:38:57 +02:00
|
|
|
tools.saveInDBForTypes($q, props.field, myvalue, props.type, props.serv, props.table, props.subfield, props.id, props.indrec, props.mysubsubkey, props.specialField)
|
2021-11-04 16:02:14 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2021-09-16 21:08:02 +02:00
|
|
|
function Savedb(newVal: any, valinitial: any) {
|
2023-04-17 00:11:45 +02:00
|
|
|
// console.log('Savedb', newVal)
|
2021-09-16 21:08:02 +02:00
|
|
|
|
2021-11-04 16:02:14 +01:00
|
|
|
if (col.value.fieldtype === costanti.FieldType.boolean) {
|
2021-09-16 21:08:02 +02:00
|
|
|
// console.log('myvalue', myvalue, newVal, myvalueprec)
|
|
|
|
|
if (myvalueprec.value === undefined) {
|
|
|
|
|
newVal = true
|
|
|
|
|
myvalueprec.value = myvalue.value
|
|
|
|
|
myvalue.value = newVal
|
2021-10-01 19:42:21 +02:00
|
|
|
|
2021-09-16 21:08:02 +02:00
|
|
|
}
|
|
|
|
|
// console.log('DOPO myvalue', myvalue, newVal, myvalueprec)
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-17 18:50:05 +02:00
|
|
|
console.log('Savedb: type', col.value.fieldtype)
|
|
|
|
|
|
2021-11-04 16:02:14 +01:00
|
|
|
if (col.value.fieldtype === costanti.FieldType.image) {
|
|
|
|
|
console.log('newVal.imagefile', newVal)
|
2024-09-17 18:50:05 +02:00
|
|
|
myvalue.value = tools.getImgFileToSaveByFilename(newVal)
|
2022-11-17 08:10:43 +01:00
|
|
|
} else if (col.value.fieldtype === costanti.FieldType.imgcard) {
|
|
|
|
|
console.log('newVal.imagefile', newVal)
|
|
|
|
|
myvalue.value = newVal
|
2024-03-02 22:53:35 +01:00
|
|
|
} else if (col.value.fieldtype === costanti.FieldType.image_and_filename) {
|
2025-03-01 14:14:43 +01:00
|
|
|
newVal = tools.getDirUpload() + mypath.value + newVal
|
2024-03-02 22:53:35 +01:00
|
|
|
console.log('newVal.imagefile', newVal)
|
|
|
|
|
myvalue.value = newVal
|
2021-11-04 16:02:14 +01:00
|
|
|
}
|
|
|
|
|
|
2022-05-06 19:51:33 +02:00
|
|
|
if (col.value.fieldtype === costanti.FieldType.listobj) {
|
|
|
|
|
myvalue.value.accomodation = newVal
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-16 21:08:02 +02:00
|
|
|
// console.log('Savedb', newVal)
|
|
|
|
|
|
2021-11-04 16:02:14 +01:00
|
|
|
emit('showandsave', props.row, props.mycol, newVal, valinitial)
|
2021-09-16 21:08:02 +02:00
|
|
|
visueditor.value = false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function visuValByType(val: any, col: IColGridTable, row: any) {
|
|
|
|
|
if (col === undefined || row === undefined)
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
// let val = ''
|
2021-11-04 16:02:14 +01:00
|
|
|
// if (col.subfield !== '') {
|
|
|
|
|
// if (row[col.field] === undefined)
|
|
|
|
|
// row[col.field] = {}
|
2021-09-16 21:08:02 +02:00
|
|
|
//
|
2021-11-04 16:02:14 +01:00
|
|
|
// val = row[col.field][col.subfield]
|
2021-09-16 21:08:02 +02:00
|
|
|
// } else {
|
2021-11-04 16:02:14 +01:00
|
|
|
// val = row[col.field]
|
2021-09-16 21:08:02 +02:00
|
|
|
// }
|
|
|
|
|
//
|
2021-11-04 16:02:14 +01:00
|
|
|
if (col.fieldtype === costanti.FieldType.date) {
|
2021-09-16 21:08:02 +02:00
|
|
|
if (val === undefined) {
|
|
|
|
|
return '[]'
|
|
|
|
|
} else {
|
|
|
|
|
return tools.getstrDateTime(val)
|
|
|
|
|
}
|
2021-11-04 16:02:14 +01:00
|
|
|
} else if (col.fieldtype === costanti.FieldType.onlydate) {
|
2021-09-16 21:08:02 +02:00
|
|
|
if (val === undefined) {
|
|
|
|
|
return '[]'
|
|
|
|
|
} else {
|
|
|
|
|
return tools.getstrDate(val)
|
|
|
|
|
}
|
2021-11-04 16:02:14 +01:00
|
|
|
} else if (col.fieldtype === costanti.FieldType.boolean) {
|
2021-09-16 21:08:02 +02:00
|
|
|
return (val) ? t('dialog.yes') : t('dialog.no')
|
2021-11-04 16:02:14 +01:00
|
|
|
} else if (col.fieldtype === costanti.FieldType.binary) {
|
2021-09-16 21:08:02 +02:00
|
|
|
if (val === undefined)
|
|
|
|
|
return '[---]'
|
|
|
|
|
else
|
|
|
|
|
return globalStore.getArrStrByValueBinary(col, val)
|
2022-12-07 18:16:23 +01:00
|
|
|
} else if ((col.fieldtype === costanti.FieldType.select) || (col.fieldtype === costanti.FieldType.option)) {
|
2021-09-16 21:08:02 +02:00
|
|
|
if (val === undefined)
|
|
|
|
|
return '[---]'
|
|
|
|
|
else
|
|
|
|
|
return globalStore.getValueByTable(col, val)
|
2022-01-20 00:38:49 +01:00
|
|
|
} else if ((col.fieldtype === costanti.FieldType.nationality) || (col.fieldtype === costanti.FieldType.select_by_server) || (col.fieldtype === costanti.FieldType.multiselect_by_server)) {
|
2021-12-21 01:26:29 +01:00
|
|
|
if (!val)
|
|
|
|
|
return '[---]'
|
|
|
|
|
else
|
|
|
|
|
return val
|
|
|
|
|
} else if (col.fieldtype === costanti.FieldType.intcode) {
|
|
|
|
|
if (!val)
|
|
|
|
|
return '[---]'
|
|
|
|
|
else
|
|
|
|
|
return val
|
2021-11-04 16:02:14 +01:00
|
|
|
} else if (col.fieldtype === costanti.FieldType.multiselect) {
|
2021-09-16 21:08:02 +02:00
|
|
|
if (val === undefined)
|
|
|
|
|
return '[---]'
|
|
|
|
|
else
|
|
|
|
|
return globalStore.getMultiValueByTable(col, val)
|
2021-11-04 16:02:14 +01:00
|
|
|
} else if (col.fieldtype === costanti.FieldType.multioption) {
|
|
|
|
|
if (val === undefined)
|
|
|
|
|
return '[---]'
|
|
|
|
|
else
|
|
|
|
|
return globalStore.getMultiValueByTable(col, val)
|
|
|
|
|
} else if (col.fieldtype === costanti.FieldType.password) {
|
|
|
|
|
if (val === undefined)
|
|
|
|
|
return '[---]'
|
|
|
|
|
else
|
|
|
|
|
return '***************'
|
2021-09-16 21:08:02 +02:00
|
|
|
} else {
|
2021-12-17 18:30:18 +01:00
|
|
|
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 ''
|
2021-09-16 21:08:02 +02:00
|
|
|
} else {
|
|
|
|
|
let mystr = ''
|
2022-01-03 21:53:41 +01:00
|
|
|
let mylink = ''
|
|
|
|
|
|
|
|
|
|
if (col.link)
|
|
|
|
|
mylink = col.link.replace(col.name, val)
|
|
|
|
|
if (col.tipovisu === costanti.TipoVisu.LINK && col.link) {
|
2022-05-27 01:33:39 +02:00
|
|
|
return "<a href='" + mylink + "'>" + val + '</a>'
|
2022-01-03 21:53:41 +01:00
|
|
|
} else if (col.tipovisu === costanti.TipoVisu.BUTTON && col.link) {
|
|
|
|
|
return ''
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2021-09-16 21:08:02 +02:00
|
|
|
if (props.showall) {
|
|
|
|
|
return val
|
|
|
|
|
} else {
|
|
|
|
|
mystr = tools.firstchars(val, tools.MAX_CHARACTERS)
|
|
|
|
|
}
|
|
|
|
|
if (val) {
|
|
|
|
|
if (val.length > tools.MAX_CHARACTERS)
|
|
|
|
|
mystr += '...'
|
|
|
|
|
} else {
|
|
|
|
|
return val
|
|
|
|
|
}
|
|
|
|
|
return mystr
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-11 18:16:28 +01:00
|
|
|
function getclassCol(mycol: any) {
|
|
|
|
|
if (mycol) {
|
2024-01-13 16:21:19 +01:00
|
|
|
let myclstr = (mycol.disable || isviewfield()) ? '' : (props.canEdit ? 'colmodif' : '')
|
2022-11-11 18:16:28 +01:00
|
|
|
myclstr += ((mycol.fieldtype === costanti.FieldType.date) || (mycol.fieldtype === costanti.FieldType.onlydate)) ? ' coldate flex flex-container' : ''
|
2021-09-16 21:08:02 +02:00
|
|
|
|
2022-11-11 18:16:28 +01:00
|
|
|
return myclstr
|
2021-09-16 21:08:02 +02:00
|
|
|
} else {
|
|
|
|
|
return ''
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-10-01 19:42:21 +02:00
|
|
|
|
2021-11-04 16:02:14 +01:00
|
|
|
function mycl() {
|
|
|
|
|
if (props.disable) {
|
|
|
|
|
return 'cldisable'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-29 00:16:25 +01:00
|
|
|
function selectcountry({ name, iso2, dialCode }: { name: string, iso2: string, dialCode: string }) {
|
2021-09-16 21:08:02 +02:00
|
|
|
// console.log(name, iso2, dialCode)
|
|
|
|
|
myvalueprec.value = myvalue.value
|
|
|
|
|
myvalue.value = iso2
|
|
|
|
|
countryname.value = name
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function intcode_change(coderec: any) {
|
|
|
|
|
myvalueprec.value = myvalue.value
|
|
|
|
|
myvalue.value = '+' + coderec.dialCode
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function onInput(phone: any, phoneObject: any, input: any) {
|
|
|
|
|
if (phoneObject?.formatted) {
|
|
|
|
|
myvalue.value = phoneObject.formatted
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-10-28 00:37:48 +02:00
|
|
|
|
2021-11-04 16:02:14 +01:00
|
|
|
function uploaded(info: any) {
|
|
|
|
|
|
|
|
|
|
if (info.files) {
|
2024-09-17 17:38:57 +02:00
|
|
|
if (info.files[0].name.imagefile) {
|
|
|
|
|
myvalue.value = tools.geturlrelativeprofile() + '/' + getMyUsername() + '/' + info.files[0].name.imagefile
|
|
|
|
|
} else {
|
|
|
|
|
myvalue.value = tools.geturlrelativeprofile() + '/' + getMyUsername() + '/' + info.files[0].name
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-04 16:02:14 +01:00
|
|
|
console.log('uploaded', myvalue.value)
|
|
|
|
|
savefield(myvalue.value, '', $q)
|
|
|
|
|
}
|
|
|
|
|
// info.files[0].name
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function removephoto() {
|
|
|
|
|
myvalue.value = ''
|
|
|
|
|
SaveValueInt(myvalue.value, '')
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-03 22:47:53 +01:00
|
|
|
function noPopupeditByCol(mycol: IColGridTable) {
|
|
|
|
|
return (mycol.fieldtype !== costanti.FieldType.html
|
|
|
|
|
&& mycol.fieldtype !== costanti.FieldType.image
|
2022-11-17 08:10:43 +01:00
|
|
|
&& mycol.fieldtype !== costanti.FieldType.imgcard
|
2021-12-03 22:47:53 +01:00
|
|
|
&& mycol.fieldtype !== costanti.FieldType.listimages
|
2022-05-05 23:56:23 +02:00
|
|
|
&& mycol.fieldtype !== costanti.FieldType.listobj
|
2021-12-03 22:47:53 +01:00
|
|
|
&& mycol.fieldtype !== costanti.FieldType.number
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-23 23:25:19 +01:00
|
|
|
function getTitleEditor(col: IColGridTable, row: any) {
|
|
|
|
|
|
|
|
|
|
let title = ''
|
2025-03-01 14:14:43 +01:00
|
|
|
if (col.field_extra1) {
|
2022-01-23 23:25:19 +01:00
|
|
|
try {
|
2025-03-01 14:14:43 +01:00
|
|
|
title = tools.getValue(row, col.field_extra1, col.subfield_extra1)
|
2022-05-27 01:33:39 +02:00
|
|
|
} catch (e) {
|
|
|
|
|
}
|
2022-01-23 23:25:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return title
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-10 02:01:26 +01:00
|
|
|
function gotoPage(link: string) {
|
|
|
|
|
$router.push(link)
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-29 17:35:41 +01:00
|
|
|
function nameKeydown(e: any, col: any) {
|
|
|
|
|
if (col.allowchar === costanti.ALLOWCHAR_CODE) {
|
2022-02-04 23:48:53 +01:00
|
|
|
|
2022-11-29 17:35:41 +01:00
|
|
|
if (/^\W$/.test(e.key)) {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-11-17 08:10:43 +01:00
|
|
|
|
2025-04-11 18:49:42 +02:00
|
|
|
function handleCancel() {
|
|
|
|
|
// Gestisci la chiusura del q-popup-edit
|
|
|
|
|
console.log("Chiusura di q-popup-edit");
|
|
|
|
|
}
|
|
|
|
|
function handleKeydown(event) {
|
|
|
|
|
// Interrompi la propagazione del tasto ESC
|
|
|
|
|
if (event.key === "Escape") {
|
|
|
|
|
event.stopPropagation();
|
|
|
|
|
console.log("Tasto ESC intercettato e bloccato");
|
|
|
|
|
|
|
|
|
|
popupEditRef.value.hide();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-29 17:35:41 +01:00
|
|
|
onBeforeMount(mounted)
|
2021-11-04 16:02:14 +01:00
|
|
|
|
2025-04-04 18:15:14 +02:00
|
|
|
|
2021-09-16 21:08:02 +02:00
|
|
|
return {
|
|
|
|
|
myvalue,
|
|
|
|
|
countryname,
|
|
|
|
|
visueditor,
|
2022-01-03 21:53:41 +01:00
|
|
|
visuhtml,
|
2021-09-16 21:08:02 +02:00
|
|
|
showeditor,
|
|
|
|
|
isviewfield,
|
|
|
|
|
changeval,
|
|
|
|
|
changevalRec,
|
2022-01-28 00:57:28 +01:00
|
|
|
addNewValue,
|
2021-09-16 21:08:02 +02:00
|
|
|
changevalRecHours,
|
|
|
|
|
updatedata,
|
|
|
|
|
OpenEdit,
|
2022-05-08 13:19:35 +02:00
|
|
|
OpenEditDateToday,
|
2021-09-16 21:08:02 +02:00
|
|
|
SaveValueInt,
|
|
|
|
|
annulla,
|
|
|
|
|
Savedb,
|
|
|
|
|
visuValByType,
|
|
|
|
|
getclassCol,
|
|
|
|
|
selectcountry,
|
|
|
|
|
intcode_change,
|
|
|
|
|
tools,
|
2021-09-19 02:59:24 +02:00
|
|
|
costanti,
|
2021-09-16 21:08:02 +02:00
|
|
|
fieldsTable,
|
|
|
|
|
onInput,
|
2021-10-01 03:08:43 +02:00
|
|
|
globalStore,
|
2022-01-26 01:31:07 +01:00
|
|
|
userStore,
|
2021-11-04 16:02:14 +01:00
|
|
|
removephoto,
|
|
|
|
|
isFieldDb,
|
|
|
|
|
col,
|
|
|
|
|
myImgGall,
|
2021-12-03 22:47:53 +01:00
|
|
|
noPopupeditByCol,
|
2022-01-23 23:25:19 +01:00
|
|
|
getTitleEditor,
|
2022-11-18 18:54:30 +01:00
|
|
|
myrow,
|
2022-11-23 10:27:36 +01:00
|
|
|
shared_consts,
|
2022-11-29 17:35:41 +01:00
|
|
|
nameKeydown,
|
2022-12-10 02:01:26 +01:00
|
|
|
gotoPage,
|
2024-03-02 22:53:35 +01:00
|
|
|
mypath,
|
2024-07-31 15:02:30 +02:00
|
|
|
changeValRecCoordAddr,
|
2025-02-03 17:18:33 +01:00
|
|
|
addstrrequired,
|
2025-04-11 18:49:42 +02:00
|
|
|
t,
|
|
|
|
|
handleKeydown,
|
|
|
|
|
handleCancel,
|
|
|
|
|
popupEditRef,
|
2021-09-16 21:08:02 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|