- CGallery MyFieldDB

This commit is contained in:
Paolo Arena
2021-11-04 16:02:14 +01:00
parent 57cda99f9c
commit ae62860d51
24 changed files with 397 additions and 343 deletions

View File

@@ -4,7 +4,7 @@ function geturl() {
if (miaurl.includes('localhost')) {
return 'http://localhost:8084/'
}
return 'https://mandalasolidale.freeplanet.app/'
return ''
}
function getidtrack() {

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 254 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 255 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

View File

@@ -14,6 +14,11 @@ export default defineComponent({
type: Boolean,
required: true,
},
single: {
type: Boolean,
required: false,
default: false,
},
title: String,
directory: {
type: String,
@@ -72,14 +77,14 @@ export default defineComponent({
}
function getnumimages() {
if (gallerylist.value && gallerylist.value)
if (gallerylist.value)
return gallerylist.value.length
else
return 0
}
function getlistimages() {
if (gallerylist.value && gallerylist.value)
if (gallerylist.value)
return gallerylist.value.slice().sort((a: any, b: any) => a.order! - b.order!)
else
return null
@@ -179,6 +184,7 @@ export default defineComponent({
// e.target.appendChild(draggedEl)
e.target.classList.remove('drag-enter')
save()
}
}
@@ -210,7 +216,8 @@ export default defineComponent({
gallerylist.value.push({ imagefile: file.name, order: getlastord() })
}
save()
if (!props.single)
save()
}
}
@@ -219,6 +226,7 @@ export default defineComponent({
}
function deleted(rec: any) {
console.log('deleted', rec.imagefile)
// console.table(mylistimages)
if (gallerylist.value) {
@@ -231,7 +239,11 @@ export default defineComponent({
// console.table(mylistimages)
save()
console.log('single', props.single)
if (!props.single) {
save()
}
}
}
@@ -246,25 +258,41 @@ export default defineComponent({
async function deleteFile(rec: any)
{
console.log('deleteFile....')
const filename = getfullname(rec)
// Delete File on server:
const ris = await globalStore.DeleteFile({ filename })
console.log('ris', ris)
if (ris)
deleted(rec)
}
function save() {
emit('showandsave', gallerylist.value)
if (gallerylist.value.length > 0) {
if (!props.single) {
emit('showandsave', gallerylist.value)
} else {
emit('showandsave', gallerylist.value[0].imagefile)
}
}
}
function close() {
save()
}
function getsrcimg(gallerylistery: any) {
if (tools.getextfile(gallerylistery.imagefile) === 'pdf')
return 'images/images/pdf.jpg'
else
return 'upload/' + props.directory + '/' + gallerylistery.imagefile
if (gallerylistery) {
if (tools.getextfile(gallerylistery.imagefile) === 'pdf')
return 'images/images/pdf.jpg'
else
return 'upload/' + props.directory + '/' + gallerylistery.imagefile
} else {
return 'images/noimg.png';
}
}
function getParamDir() {
@@ -273,7 +301,7 @@ export default defineComponent({
function getUrl() {
const myurl = tools.geturlupload() + getParamDir()
console.log('myurl', myurl)
// console.log('myurl', myurl)
return myurl
}
@@ -301,6 +329,7 @@ export default defineComponent({
save,
maximizedToggle,
getUrl,
close,
}
}
})

View File

@@ -23,6 +23,7 @@
<div class=" row">
<!--<q-draggable-rows
v-model="order">-->
<div v-for="(mygallery, index) in getlistimages()" :key="index">
<div
class="q-pa-sm q-gutter-sm"
@@ -115,7 +116,7 @@
<q-btn dense flat icon="crop_square" @click="maximizedToggle = true" :disable="maximizedToggle">
<q-tooltip v-if="!maximizedToggle" class="bg-white text-primary">Maximize</q-tooltip>
</q-btn>
<q-btn dense flat icon="close" v-close-popup>
<q-btn dense flat icon="close" v-close-popup @click="close">
<q-tooltip class="bg-white text-primary">Close</q-tooltip>
</q-btn>
</q-bar>
@@ -126,6 +127,7 @@
<q-card-section class="q-pt-none">
<div class=" row">
<div v-for="(mygallery, index) in getlistimages()" :key="index">
<div
class="q-pa-sm q-gutter-sm"

View File

@@ -140,7 +140,7 @@
:table="prop_mytable"
:canEdit="canEdit"
:disable="disabilita()"
:col="col"
:mycol="col"
v-model:row="props.row"
:field="col.field"
:subfield="col.subfield"
@@ -205,7 +205,7 @@
:canEdit="true"
:disable="disabilita()"
view="field"
:col="mycol"
:mycol="mycol"
:showall="true"
:row="rowclicksel"
:field="mycol.field"
@@ -239,7 +239,7 @@
<CMyPopupEdit
:table="prop_mytable"
:canEdit="true"
:col="col"
:mycol="col"
v-model:row="newRecord"
:field="col.field"
:subfield="col.subfield"

View File

@@ -1,21 +1,12 @@
import { defineComponent, PropType, ref, watch } from 'vue'
import { useQuasar } from 'quasar'
import { useI18n } from '@/boot/i18n'
import { useUserStore } from '@store/UserStore'
import { useGlobalStore } from '@store/globalStore'
import { IColGridTable } from 'model'
import { fieldsTable } from '@store/Modules/fieldsTable'
import { tools } from '@store/Modules/tools'
import { toolsext } from '@store/Modules/toolsext'
import { costanti } from '@costanti'
import MixinBase from '../../mixins/mixin-base'
import MixinUsers from '../../mixins/mixin-users'
import { CMyEditor } from '@/components/CMyEditor'
import { CMySelect } from '@/components/CMySelect'
import { CMyChipList } from '@/components/CMyChipList'
import { CMyToggleList } from '@/components/CMyToggleList'
import { CDateTime } from '@/components/CDateTime'
import { CGallery } from '@/components/CGallery'
import { CMyPopupEdit } from '@/components/CMyPopupEdit'
import { IColGridTable } from 'model'
export default defineComponent({
@@ -84,184 +75,22 @@ export default defineComponent({
default: '',
},
},
components: { CMyEditor, CMySelect, CMyChipList, CMyToggleList, CDateTime, CGallery },
components: { CMyPopupEdit },
setup(props, { emit }) {
const $q = useQuasar()
const { t } = useI18n()
const globalStore = useGlobalStore()
const myvalue = ref('')
const col: IColGridTable = { name: 'test' }
const canEdit = ref(true)
const countryname = ref('')
const { setValDb, getValDb } = MixinBase()
const { getMyUsername } = MixinUsers()
function crea() {
myvalue.value = getValDb(props.mykey, props.serv, '', props.table, props.mysubkey, props.id, props.idmain)
col.jointable = props.jointable
col.fieldtype = props.type
col.label = props.title
// console.log('CMyFieldDb crea', myvalue)
}
watch(() => props.id, (newval, oldval) => {
crea()
})
function getclassCol(col: any) {
if (col) {
let mycl = (props.disable || col.disable) ? '' : 'colmodif '
mycl += ((col.fieldtype === costanti.FieldType.date) || (col.fieldtype === costanti.FieldType.onlydate)) ? ' coldate flex flex-container ' : ''
return mycl
} else {
return ''
}
}
function visuValByType(val: any) {
if (col.fieldtype === costanti.FieldType.date) {
if (val === undefined) {
return '[]'
} else {
return tools.getstrDateTime(val)
}
} else if (col.fieldtype === costanti.FieldType.onlydate) {
if (val === undefined) {
return '[]'
} else {
return tools.getstrDate(val)
}
} else if (col.fieldtype === costanti.FieldType.boolean) {
return (val) ? t('dialog.yes') : t('dialog.no')
} else if (col.fieldtype === costanti.FieldType.binary) {
if (val === undefined)
return '[---]'
else
return globalStore.getArrStrByValueBinary(col, val)
} else if (col.fieldtype === costanti.FieldType.select) {
if (val === undefined)
return '[---]'
else
return globalStore.getValueByTable(col, val)
} else if (col.fieldtype === costanti.FieldType.multiselect) {
if (val === undefined)
return '[---]'
else
return globalStore.getMultiValueByTable(col, val)
} 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 '***************'
} else {
if (val === undefined)
return ' <span class="text-grey">(' + t('reg.select') + ')</span> '
else if (val === '') {
return ' <span class="text-grey">(' + t('reg.select') + ')</span> '
} else {
let mystr = tools.firstchars(val, 5000)
if (val) {
if (val.length > 5000)
mystr += '...'
} else {
return val
}
return mystr
}
}
}
function mycl() {
if (props.disable) {
return 'cldisable'
}
}
function myvalprinted() {
return visuValByType(myvalue.value)
}
function savefield(value: any, initialval: any, myq: any) {
myvalue.value = value
setValDb(myq, props.mykey, myvalue.value, props.type, props.serv, props.table, props.mysubkey, props.id, props.indrec, props.mysubsubkey)
}
function savefieldboolean(value: any) {
if (myvalue.value === undefined)
myvalue.value = 'true'
else
myvalue.value = value
setValDb($q, props.mykey, myvalue, props.type, props.serv, props.table, props.mysubkey, props.id, props.indrec, props.mysubsubkey)
}
function selectcountry({ name, iso2, dialCode }: { name: string, iso2: string, dialCode: string }) {
// console.log(name, iso2, dialCode)
myvalue.value = iso2
countryname.value = name
}
function intcode_change(coderec: any) {
myvalue.value = '+' + coderec.dialCode
}
function onInput(phone: any, phoneObject: any, input: any) {
if (phoneObject?.formatted) {
myvalue.value = phoneObject.formatted
}
}
function uploaded(info: any) {
if (info.files) {
myvalue.value = tools.geturlrelativeprofile()+ '/' + getMyUsername() + '/' + info.files[0].name
console.log('uploaded', myvalue.value)
savefield(myvalue.value, '', $q)
}
// info.files[0].name
}
function removephoto() {
myvalue.value = ''
savefield(myvalue.value, '', $q)
}
crea()
const col = ref(<IColGridTable> { name: 'test' })
const row = ref({})
return {
mycl,
intcode_change,
selectcountry,
savefieldboolean,
savefield,
myvalprinted,
getclassCol,
canEdit,
myvalue,
col,
countryname,
onInput,
tools,
costanti,
myq: $q,
fieldsTable,
globalStore,
uploaded,
getMyUsername,
removephoto,
col,
row,
}
},
})

View File

@@ -19,6 +19,38 @@
</template>
</q-field>
</div>
<div :class="` q-ma-sm q-pa-sm col-grow rounded-borders `" style="border: 1px solid #bbb">
<CMyPopupEdit
:title="title"
:field="mykey"
:subfield="mysubkey"
:mysubsubkey="mysubsubkey"
:indrec="indrec"
:type="type"
:serv="serv"
:disable="disable"
:jointable="jointable"
:table="table"
:myimg="myimg"
:id="id"
:idmain="idmain"
:canEdit="true"
:mycol="col"
v-model:row="row"
minuteinterval="1"
>
</CMyPopupEdit>
</div>
<!--
@save="SaveValue"
@show="selItem(props.row, col)"
@showandsave="showandsel"
<div :class="getclassCol(col) + ` q-ma-sm q-pa-sm col-grow rounded-borders `" style="border: 1px solid #bbb">
<div v-if="type === costanti.FieldType.date">
<CDateTime
@@ -53,7 +85,6 @@
:optlab="fieldsTable.getLabelByTable(col.jointable)"
:opticon="fieldsTable.getIconByTable(col.jointable)"></CMyChipList>
</div>
<!-- Show Value -->
<div v-else-if="type === costanti.FieldType.nationality">
<q-input
input-class="cursor-pointer text-center"
@@ -65,14 +96,6 @@
>
<div class="hidden">
<!--<vue-country-code
:defaultCountry="myvalue"
:disabledFetchingCountry="true"
@onSelect="selectcountry"
:preferredCountries="tools.getprefCountries"
:dropdownOptions="{ disabledDialCode: true }">
</vue-country-code>-->
</div>
</q-input>
@@ -222,14 +245,6 @@
<template v-slot:prepend>
<div style="font-size: 1rem;">
<!--<vue-country-code
:defaultCountry="myvalue"
:disabledFetchingCountry="true"
@onSelect="selectcountry"
:preferredCountries="tools.getprefCountries"
:dropdownOptions="{ disabledDialCode: true }">
</vue-country-code>-->
</div>
</template>
</q-input>
@@ -241,17 +256,6 @@
<div v-else-if="col.fieldtype === costanti.FieldType.intcode">
<div class="justify-center q-gutter-sm clgutter q-mt-sm">
<!--<vue-tel-input
@country-changed="intcode_change"
:value="myvalue"
@update:model-value="onInput"
:disabledFetchingCountry="true"
:preferredCountries="tools.getprefCountries"
:placeholder="$t('reg.cell')"
:enabledCountryCode="true"
inputClasses="clCell"
wrapperClasses="clCellCode">
</vue-tel-input>-->
<div style="height: 180px;">
</div>
@@ -268,25 +272,6 @@
:isarray="true">
</CMyToggleList>
<!--
<q-select
v-model="scope.value"
rounded
dense
outlined
multiple
options-dense
:display-value="fieldsTable.getTitleByTable(col.jointable)"
emit-value
map-options
:options="globalStore.getTableJoinByName(col.jointable)"
:option-label="fieldsTable.getLabelByTable(col.jointable)"
:option-value="fieldsTable.getKeyByTable(col.jointable)"
style="min-width: 150px"
>
</q-select>
-->
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.multioption">
</div>
@@ -316,7 +301,8 @@
color="blue" icon="fas fa-trash-alt" size="sm"
@click="removephoto"></q-btn>
</div>
</div>
</div>-->
</div>
</div>
</template>

View File

@@ -1,9 +1,9 @@
import { defineComponent, onMounted, ref, toRef } from 'vue'
import { defineComponent, onMounted, PropType, ref, toRef, watch } from 'vue'
import { useI18n } from '@src/boot/i18n'
import { useUserStore } from '@store/UserStore'
import { useGlobalStore } from '@store/globalStore'
import { useQuasar } from 'quasar'
import { IColGridTable } from 'model'
import { IColGridTable, IImgGallery } from 'model'
import { CMyChipList } from '../CMyChipList'
import { CDate } from '../CDate'
import { CDateTime } from '../CDateTime'
@@ -15,16 +15,23 @@ import { tools } from '@store/Modules/tools'
import { costanti } from '@costanti'
import { fieldsTable } from '@store/Modules/fieldsTable'
import MixinBase from '@/mixins/mixin-base'
import MixinUsers from '@/mixins/mixin-users'
export default defineComponent({
name: 'CMyPopupEdit',
props: {
title: {
type: String,
required: false,
default: '',
},
row: {
type: Object,
required: true,
},
col: {
type: Object,
mycol: {
type: Object as PropType<IColGridTable>,
required: true,
},
canEdit: {
@@ -42,6 +49,26 @@ export default defineComponent({
required: false,
default: '',
},
mysubsubkey: {
type: String,
required: false,
default: '',
},
serv: {
type: Boolean,
required: false,
default: false,
},
indrec: {
type: Number,
required: false,
default: -1,
},
type: {
type: Number,
required: false,
default: 0,
},
showall: {
type: Boolean,
required: false,
@@ -67,11 +94,31 @@ export default defineComponent({
required: false,
default: false,
},
jointable: {
type: String,
required: false,
default: '',
},
table: {
type: String,
required: false,
default: '',
},
myimg: {
type: String,
required: false,
default: '',
},
id: {
type: String,
required: false,
default: '',
},
idmain: {
type: String,
required: false,
default: '',
},
},
components: { CMyChipList, CDateTime, CDate, CMyToggleList, CMySelect, CMyEditor, CGallery },
setup(props, { emit }) {
@@ -86,8 +133,59 @@ export default defineComponent({
const visueditor = ref(false)
const showeditor = ref(false)
const myImgGall = ref(<IImgGallery[]>[{}])
const col = ref(<IColGridTable> { name: 'test', fieldtype: 0 })
const myrow = toRef(props, 'row')
const { setValDb, getValDb } = MixinBase()
const { getMyUsername } = MixinUsers()
function crea() {
if (isFieldDb()) {
// mykey -> field
// mysubkey -> subfield
// table -> table
// serv -> serv
// id -> id
// idmain -> idmain
// console.table(props)
myvalue.value = getValDb(props.field, props.serv, '', props.table, props.subfield, props.id, props.idmain)
// console.log('myvalue.value', myvalue.value)
col.value.jointable = props.jointable
col.value.fieldtype = props.type
col.value.label = props.title
if (props.type === costanti.FieldType.image) {
myImgGall.value = [{
_id: '',
imagefile: myvalue.value,
order: 1,
alt: 'img',
}]
}
console.log('col', col.value);
} else {
col.value = {...props.mycol}
}
// console.log('CMyFieldDb crea', myvalue)
}
watch(() => props.id, (newval, oldval) => {
crea()
})
function isFieldDb(){
return props.type !== 0
}
function isviewfield() {
return props.view === 'field'
}
@@ -98,21 +196,21 @@ export default defineComponent({
}
function getrealval(newval: any) {
if (props.col.fieldtype === costanti.FieldType.hours) {
if (col.value.fieldtype === costanti.FieldType.hours) {
newval = newval.value
}
}
function changevalRec(newval: any) {
// console.log('row', props.row, 'col', props.col, 'newval', newval)
// console.log('row[col.name]', props.row[props.col.name])
myrow.value[props.col.name] = newval
// console.log('row', props.row, 'col', props.mycol, 'newval', newval)
// console.log('row[col.value.name]', props.row[col.value.name])
myrow.value[col.value.name] = newval
// console.log('changevalRec update:row', newval)
emit('update:row', props.row)
}
function changevalRecHours(newval: any) {
if (props.col.fieldtype === costanti.FieldType.hours) {
if (col.value.fieldtype === costanti.FieldType.hours) {
newval = newval.value
}
changevalRec(newval)
@@ -126,23 +224,27 @@ export default defineComponent({
function mounted() {
// console.log('mounted')
if (props.subfield !== '') {
if (props.row[props.field] === undefined) {
myrow.value[props.field] = {}
myvalue.value = ''
} else {
myvalue.value = myrow.value[props.field][props.subfield]
}
if (isFieldDb()) {
} else {
if (props.field !== '')
myvalue.value = myrow.value[props.field]
else {
// @ts-ignore
myvalue.value = myrow.value
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 {
if (props.field !== '')
myvalue.value = myrow.value[props.field]
else {
// @ts-ignore
myvalue.value = myrow.value
}
}
}
if (props.col.fieldtype === costanti.FieldType.listimages) {
if (col.value.fieldtype === costanti.FieldType.listimages) {
if (myvalue.value === '' || myvalue.value === undefined) {
console.log('set default myvalue.value ')
myvalue.value = {
@@ -159,7 +261,6 @@ export default defineComponent({
}
}
}
// console.log('myvalue.value', myvalue.value)
myvalueprec.value = myvalue.value
@@ -171,7 +272,7 @@ export default defineComponent({
emit('show')
}
function getval() {
/*function getval() {
let myval: any = 'false'
if ((props.subfield !== '') && (props.subfield !== '')) {
@@ -189,34 +290,54 @@ export default defineComponent({
}
return myval
}
}*/
function SaveValueInt(newVal: any, valinitial: any) {
// console.log('SaveValueInt', newVal, valinitial)
// 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
if (isFieldDb()) {
savefield(newVal, valinitial, $q);
} else {
if (props.field !== '')
myrow.value[props.field] = newVal
else
myrow.value = newVal
}
// 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
else
myrow.value = newVal
}
emit('save', newVal, valinitial)
emit('save', newVal, valinitial)
}
}
function savefield(value: any, initialval: any, myq: any) {
myvalue.value = value
setValDb(myq, props.field, myvalue.value, props.type, props.serv, props.table, props.subfield, props.id, props.indrec, props.mysubsubkey)
}
function annulla(val: any) {
emit('annulla', true)
}
function savefieldboolean(value: any) {
if (myvalue.value === undefined)
myvalue.value = 'true'
else
myvalue.value = value
setValDb($q, props.field, myvalue, props.type, props.serv, props.table, props.subfield, props.id, props.indrec, props.mysubsubkey)
}
function Savedb(newVal: any, valinitial: any) {
if (props.col.fieldtype === costanti.FieldType.boolean) {
if (col.value.fieldtype === costanti.FieldType.boolean) {
// console.log('myvalue', myvalue, newVal, myvalueprec)
if (myvalueprec.value === undefined) {
newVal = true
@@ -227,9 +348,14 @@ export default defineComponent({
// console.log('DOPO myvalue', myvalue, newVal, myvalueprec)
}
if (col.value.fieldtype === costanti.FieldType.image) {
console.log('newVal.imagefile', newVal)
myvalue.value = newVal
}
// console.log('Savedb', newVal)
emit('showandsave', props.row, props.col, newVal, valinitial)
emit('showandsave', props.row, props.mycol, newVal, valinitial)
visueditor.value = false
}
@@ -238,49 +364,59 @@ export default defineComponent({
return
// let val = ''
// if (props.col.subfield !== '') {
// if (row[props.col.field] === undefined)
// row[props.col.field] = {}
// if (col.subfield !== '') {
// if (row[col.field] === undefined)
// row[col.field] = {}
//
// val = row[props.col.field][props.col.subfield]
// val = row[col.field][col.subfield]
// } else {
// val = row[props.col.field]
// val = row[col.field]
// }
//
if (props.col.fieldtype === costanti.FieldType.date) {
if (col.fieldtype === costanti.FieldType.date) {
if (val === undefined) {
return '[]'
} else {
return tools.getstrDateTime(val)
}
} else if (props.col.fieldtype === costanti.FieldType.onlydate) {
} else if (col.fieldtype === costanti.FieldType.onlydate) {
if (val === undefined) {
return '[]'
} else {
return tools.getstrDate(val)
}
} else if (props.col.fieldtype === costanti.FieldType.boolean) {
} else if (col.fieldtype === costanti.FieldType.boolean) {
return (val) ? t('dialog.yes') : t('dialog.no')
} else if (props.col.fieldtype === costanti.FieldType.binary) {
} else if (col.fieldtype === costanti.FieldType.binary) {
if (val === undefined)
return '[---]'
else
return globalStore.getArrStrByValueBinary(col, val)
} else if (props.col.fieldtype === costanti.FieldType.select) {
} else if (col.fieldtype === costanti.FieldType.select) {
if (val === undefined)
return '[---]'
else
return globalStore.getValueByTable(col, val)
} else if (props.col.fieldtype === costanti.FieldType.multiselect) {
} else if (col.fieldtype === costanti.FieldType.multiselect) {
if (val === undefined)
return '[---]'
else
return globalStore.getMultiValueByTable(col, val)
} 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 '***************'
} else {
if (val === undefined || val === null)
return '[]'
return ' <span class="text-grey">(' + t('reg.select') + ')</span> '
else if (val === '') {
return '[]'
return ' <span class="text-grey">(' + t('reg.select') + ')</span> '
} else {
let mystr = ''
if (props.showall) {
@@ -300,13 +436,13 @@ export default defineComponent({
}
function visInNewRec(col: any) {
return !props.col.notShowInNewRec
return !col.notShowInNewRec
}
function getclassCol(col: any) {
if (col) {
let mycl = (props.col.disable || isviewfield()) ? '' : 'colmodif'
mycl += ((props.col.fieldtype === costanti.FieldType.date) || (props.col.fieldtype === costanti.FieldType.onlydate)) ? ' coldate flex flex-container' : ''
let mycl = (col.disable || isviewfield()) ? '' : 'colmodif'
mycl += ((col.fieldtype === costanti.FieldType.date) || (col.fieldtype === costanti.FieldType.onlydate)) ? ' coldate flex flex-container' : ''
return mycl
} else {
@@ -314,6 +450,12 @@ export default defineComponent({
}
}
function mycl() {
if (props.disable) {
return 'cldisable'
}
}
function selectcountry({ name, iso2, dialCode }: {name: string, iso2: string, dialCode: string}) {
// console.log(name, iso2, dialCode)
myvalueprec.value = myvalue.value
@@ -333,19 +475,44 @@ export default defineComponent({
}
function getTitleGall() {
return fieldsTable.getTitleImgByTable(props.table);
if (fieldsTable.tableForUsers.includes(props.table)) {
return 'Profilo'
} else {
return fieldsTable.getTitleImgByTable(props.table);
}
}
function getDirectoryGall() {
if (fieldsTable.tableForUsers.includes(props.table)) {
return 'profile/' + userStore.my.username + '/' + props.table
}else if (props.table === 'users') {
return 'profile/' + userStore.my.username
} else {
return props.table
}
}
function uploaded(info: any) {
if (info.files) {
myvalue.value = tools.geturlrelativeprofile()+ '/' + getMyUsername() + '/' + info.files[0].name
console.log('uploaded', myvalue.value)
savefield(myvalue.value, '', $q)
}
// info.files[0].name
}
function removephoto() {
myvalue.value = ''
SaveValueInt(myvalue.value, '')
}
onMounted(mounted)
crea()
return {
myvalue,
countryname,
@@ -357,7 +524,6 @@ export default defineComponent({
changevalRecHours,
updatedata,
OpenEdit,
getval,
SaveValueInt,
annulla,
Savedb,
@@ -373,6 +539,10 @@ export default defineComponent({
globalStore,
getTitleGall,
getDirectoryGall,
removephoto,
isFieldDb,
col,
myImgGall,
}
}
})

View File

@@ -83,7 +83,7 @@
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.listimages">
Galleria:
gall1:
<CGallery
v-if="myvalue"
:title="getTitleGall()"
@@ -96,16 +96,43 @@
</CGallery>
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.image">
<div v-if="canEdit">
gall2:
<CGallery
v-if="myvalue"
:title="getTitleGall()"
:directory="getDirectoryGall()"
:imgGall="myvalue" :edit="isviewfield()"
:single="isFieldDb()"
@update:model-value="changevalRec"
@showandsave="Savedb">
<CGallery
v-if="myvalue"
:title="getTitleGall()"
:directory="getDirectoryGall()"
:imgGall="myvalue" :edit="isviewfield()"
@update:model-value="changevalRec"
@showandsave="Savedb">
</CGallery>
</div>
<div v-else>
<div v-if="myvalue" class="text-center">
<q-img
:src="myvalue"
class="text-center"
style="height: 100px; width: 100px;"
alt="foto">
</q-img>
</div>
<div v-else class="text-center">
<q-img
src="images/noimg-user.svg"
class="text-center"
style="height: 100px; width: 100px;"
alt="nessuna immagine">
</q-img>
</div>
<q-btn
v-if="myvalue"
label="Rimuovi Foto"
color="blue" icon="fas fa-trash-alt" size="sm"
@click="removephoto"></q-btn>
</CGallery>
</div>
</div>
<div v-if="col.fieldtype === costanti.FieldType.binary">
<CMyChipList
@@ -149,13 +176,13 @@
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.html">
<div v-html="visuValByType(myvalue, col, row)" @click="visueditor = true">
</div>
</div>
</div>
</div>
<div v-else>
<div v-if="col.fieldtype === costanti.FieldType.listimages">
gall3:
<CGallery
v-if="myvalue"
:title="getTitleGall()"
@@ -166,11 +193,13 @@
</CGallery>
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.image">
gall4:
<CGallery
v-if="myvalue"
:title="getTitleGall()"
:directory="getDirectoryGall()"
:imgGall="myvalue" :edit="isviewfield()"
:single="isFieldDb()"
:imgGall="myImgGall" :edit="isviewfield()"
@showandsave="Savedb">
</CGallery>
@@ -255,28 +284,25 @@
@update:model-value="Savedb"></q-toggle>
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.html">
<div v-html="visuValByType(myvalue, col, row)" @click="visueditor = true">
<div v-if="isFieldDb()">
<div v-html="visuValByType(myvalue, col, row)" @click="visueditor = true"></div>
</div>
<div v-else>
<q-dialog v-model="visueditor" no-backdrop-dismiss persistent full-height full-width>
<q-card :style="`min-width: `+ tools.myheight_dialog() + `px;`">
<q-card-section>
<CMyEditor
v-if="visueditor" v-model:value="myvalue" :title="col.title" @keyup.enter.stop
@showandsave="Savedb" @annulla="visueditor=false">
</CMyEditor>
</q-card-section>
</q-card>
</q-dialog>
</div>
</div>
<div v-else>
{{ visuValByType(myvalue, col, row) }}
</div>
<div v-if="col.fieldtype === costanti.FieldType.html">
<q-dialog v-model="visueditor" no-backdrop-dismiss persistent full-height full-width>
<q-card :style="`min-width: `+ tools.myheight_dialog() + `px;`">
<q-card-section>
<CMyEditor
v-if="visueditor" v-model:value="myvalue" :title="col.title" @keyup.enter.stop
@showandsave="Savedb" @annulla="visueditor=false">
</CMyEditor>
</q-card-section>
</q-card>
</q-dialog>
<span v-html="visuValByType(myvalue, col, row)"></span>
</div>
<q-popup-edit
@@ -293,7 +319,7 @@
<div v-if="col.fieldtype === costanti.FieldType.boolean">
<q-checkbox v-model="scope.value" :label="col.title">
</q-checkbox>
{{ visuValByType(myvalue, col, row) }}
<span v-html="visuValByType(myvalue, col, row)"></span>
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.string">
<q-input
@@ -321,11 +347,21 @@
</q-input>
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.hours">
<q-input
v-model="scope.value" type="number"
autofocus>
<div v-if="isFieldDb()">
<CMySelect
label="Ore" v-model:value="myvalue"
optval="_id" optlab="label"
:useinput="false"
:options="tools.SelectHours">
</CMySelect>
</div>
<div v-else>
<q-input
v-model="scope.value" type="number"
autofocus>
</q-input>
</q-input>
</div>
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.binary">
@@ -354,6 +390,8 @@
:readonly="true"
rounded dense
debounce="1000"
@keyup.enter="scope.set"
:label="title"
>
<template v-slot:prepend>
@@ -376,16 +414,16 @@
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.intcode">
<!-- <vue-tel-input
@country-changed="intcode_change"
:value="scope.value"
@update:model-value="oninput"
:placeholder="$t('reg.cell')"
:enabledCountryCode="true"
inputClasses="clCell"
wrapperClasses="clCellCode">
</vue-tel-input>
-->
<!-- <vue-tel-input
@country-changed="intcode_change"
:value="scope.value"
@update:model-value="oninput"
:placeholder="$t('reg.cell')"
:enabledCountryCode="true"
inputClasses="clCell"
wrapperClasses="clCellCode">
</vue-tel-input>
-->
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.multiselect">
@@ -412,7 +450,7 @@
<q-item-label>{{ opt[fieldsTable.getLabelByTable(col.jointable)] }}</q-item-label>
</q-item-section>
<q-item-section side>
<q-toggle :model-value="selected" @update:model-value="toggleOption(opt)" />
<q-toggle :model-value="selected" @update:model-value="toggleOption(opt)"/>
</q-item-section>
</q-item>
</template>

View File

@@ -1234,7 +1234,7 @@ export const fieldsTable = {
],
tableForUsers: [
'myskills'
'myskills',
],
tablesList: [