Files
myprojplanet_vite/src/components/CMyPopupEdit/CMyPopupEdit.vue
Surya Paolo 2533da3692 Cataloghi...
2025-02-05 12:13:36 +01:00

1682 lines
60 KiB
Vue
Executable File

<template>
<div :class="getclassCol(col)">
<div
v-if="
tools.checkIfShowField(
col,
insertMode
? tools.TIPOVIS_NEW_RECORD
: isInModif
? tools.TIPOVIS_EDIT_RECORD
: tools.TIPOVIS_SHOW_RECORD,
visulabel,
myvalue
)
"
style="flex-grow: 1"
>
<div :class="{ flex: !isInModif, 'justify-center': justifycenter }">
<div>
<!-- Edit Value -->
<div v-if="col.fieldtype === costanti.FieldType.boolean">
<div v-if="isInModif">
<q-toggle
:disable="!isInModif || col.disable"
dark
color="green"
v-model="myvalue"
:label="col.title ? col.title : col.label"
@update:model-value="changevalRec"
></q-toggle>
</div>
<div v-else>
<q-toggle
dark
color="green"
v-model="myvalue"
:label="col.title"
:disable="
(disable && col.name !== 'profile.saw_zoom_presentation') ||
(!isInModif && !canModify && !canEdit)
"
@update:model-value="Savedb"
></q-toggle>
</div>
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.link">
<div v-if="isInModif">
<q-input
v-bind="$attrs"
v-model="myvalue"
:maxlength="col.maxlength ? col.maxlength : undefined"
:style="$q.screen.lt.sm ? 'min-width: 300px' : ''"
:disable="disable"
:readonly="disable"
:type="`text`"
@keyup.enter.stop
@update:model-value="changevalRec"
autofocus
:label="col.label"
>
</q-input>
</div>
<div v-else>
<div class="q-ma-xs">
<q-btn
v-if="myvalue"
type="a"
rounded
size="md"
:class="{ disabled: disable }"
color="white"
text-color="blue"
:icon="col.icon ? col.icon : `fas fa-globe`"
:href="tools.getlinkstd(myvalue)"
:label="tools.firstchars(myvalue, 40)"
target="_blank"
>
</q-btn>
</div>
</div>
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.username_chip">
<div class="">
<span
v-if="
col.extrafield &&
(col.tipovisu !== costanti.TipoVisu.LINK ||
(col.tipovisu === costanti.TipoVisu.LINK && myvalue))
"
>
<span class="extrafield">{{ $t(col.extrafield) }}</span>
</span>
</div>
<div v-if="canModify">
<q-input
:type="
col.fieldtype === costanti.FieldType.crypted
? 'password'
: 'text'
"
:maxlength="col.maxlength ? col.maxlength : undefined"
:minlength="col.minlength ? col.minlength : undefined"
v-model="myvalue"
@update:model-value="changevalRec"
:label="col.visulabel ? addstrrequired + $t(col.label_trans) : ''"
:autogrow="col.fieldtype !== costanti.FieldType.crypted"
@keyup.enter.stop
autofocus
>
</q-input>
</div>
<div
v-else-if="
!col.extrafield ||
(col.extrafield &&
(col.tipovisu !== costanti.TipoVisu.LINK ||
(col.tipovisu === costanti.TipoVisu.LINK && myvalue)))
"
class="q-ma-xs chip_shadow"
>
<div
v-if="
(col.tipovisu === costanti.TipoVisu.LINK ||
col.tipovisu === costanti.TipoVisu.NONE) &&
myvalue
"
class="full-width"
>
<q-item
clickable
v-ripple
@click="
gotoPage(
col.link
? col.link.replace(col.name, myvalue)
: `/my/username`.replace(col.name, myvalue)
)
"
>
<q-item-section avatar>
<q-avatar round size="48px">
<img :src="userStore.getImgByProfile(row, false, col)" />
<q-badge
v-if="tools.isUserOnline(row, col)"
align="top"
floating
color="green"
>online</q-badge
>
<q-badge
v-if="tools.notisVerifiedByUser(row)"
align="bottom"
floating
color="red"
>Da Ammettere</q-badge
>
</q-avatar>
</q-item-section>
<q-item-section class="">
<q-item-label>{{
tools.getNameToShow(row, col)
}}</q-item-label>
<q-item-label caption>{{
tools.getUserNameOnlyIfToShow(row, col)
}}</q-item-label>
<q-item-label v-if="row.profile && row.profile.resid_province" style="text-align:right;">
({{ row.profile.resid_province }})
</q-item-label>
</q-item-section>
<q-item-section side></q-item-section>
</q-item>
</div>
<q-avatar
v-else-if="
col.tipovisu === costanti.TipoVisu.LINKIMG && myvalue
"
size="60px"
>
<q-img
:src="userStore.getImgUserByRow(row, col)"
:alt="myvalue"
img-class="imgprofile"
height="60px"
/>
</q-avatar>
<q-btn
v-else-if="col.tipovisu === costanti.TipoVisu.BUTTON && myvalue"
rounded
size="sm"
color="primary"
icon="person"
:to="col.link.replace(col.name, myvalue)"
:label="myvalue"
>
</q-btn>
<div v-else>
<span
:class="{ disabled: disable }"
v-html="visuValByType(myvalue, col, row)"
></span>
</div>
</div>
</div>
<div
v-else-if="
col.fieldtype === costanti.FieldType.string ||
col.fieldtype === costanti.FieldType.crypted
"
>
<div
v-if="isInModif"
:class="{ flex: !isInModif, 'q-mb-sm': true }"
>
<q-input
v-bind="$attrs"
v-model="myvalue"
:autogrow="col.fieldtype !== costanti.FieldType.crypted"
:style="$q.screen.lt.sm ? 'min-width: 300px' : ''"
counter
:maxlength="col.maxlength ? col.maxlength : undefined"
:disable="disable"
:readonly="disable"
:type="
col.fieldtype === costanti.FieldType.crypted
? `password`
: `text`
"
@keydown="nameKeydown($event, col)"
@keyup.enter.stop
@update:model-value="changevalRec"
autofocus
:rules="[val => (!!val || !col.required) || 'Campo richiesto']"
:label="col.visulabel ? addstrrequired + $t(col.label_trans) : col.label"
>
</q-input>
<q-field v-if="col.showLinkResult && myvalue">
Diventerà: {{ tools.generateURL(col.showLinkResult, myvalue) }}
</q-field>
</div>
<div
v-else-if="col.tipovisu === costanti.TipoVisu.TESTO_BORDATO"
:class="{ flex: !isInModif }"
>
<CLabel
v-bind="$attrs"
:value="myvalue"
:label="$t(col.label_trans)"
/>
</div>
<div v-else>
<q-btn
v-if="col.tipovisu === costanti.TipoVisu.LINK && myvalue"
type="a"
rounded
size="md"
:class="{ disabled: disable }"
color="white"
text-color="blue"
:icon="`img:` + userStore.getImgUserByUsername(myvalue)"
:to="
col.link
? col.link.replace(col.name, myvalue)
: `/my/username`.replace(col.name, myvalue)
"
:label="myvalue"
>
</q-btn>
<q-avatar
v-else-if="
col.tipovisu === costanti.TipoVisu.LINKIMG && myvalue
"
size="60px"
>
<q-img
:src="userStore.getImgUserByRow(row, col)"
:alt="myvalue"
img-class="imgprofile"
height="60px"
/>
</q-avatar>
<q-btn
v-else-if="col.tipovisu === costanti.TipoVisu.BUTTON && myvalue"
rounded
size="sm"
color="primary"
icon="person"
:to="col.link.replace(col.name, myvalue)"
:label="myvalue"
>
</q-btn>
<span v-else>
<span v-if="notAllowAtChar" class="text-h7">@</span>
<span
:class="{ disabled: disable }"
v-html="visuValByType(myvalue, col, row)"
></span>
</span>
</div>
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.coordinates">
<CMapEditAddressByCoord
:visuMappa="false"
:editaddress="true"
v-model:model-value="myvalue"
@update:model-value="changeValRecCoordAddr"
></CMapEditAddressByCoord>
</div>
<div
v-else-if="
col.fieldtype === costanti.FieldType.number ||
col.fieldtype === costanti.FieldType.currency
"
>
<div v-if="canEdit || isInModif">
<q-input
v-bind="$attrs"
debounce="1000"
v-model="myvalue"
:maxlength="col.maxlength ? col.maxlength : undefined"
@update:model-value="Savedb"
:label="
col.visulabel
? $t(col.label_trans)
: (visulabel
? addstrrequired + $t(col.label_trans)
: '')
"
type="number"
autofocus
>
</q-input>
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.currency">
<CCurrencyValue
:symbol="tools.getSymbolByCircuit(row)"
:color="tools.getColorByCircuit(row)"
v-model="myvalue"
:label="$t(col.label_trans)"
>
</CCurrencyValue>
</div>
<div v-else>
<span v-html="visuValByType(myvalue, col, row)"></span>
</div>
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.hours">
<div v-if="isFieldDb()">
<CMySelect
:type_out="col.field_outtype"
label="Ore"
v-model:value="myvalue"
@update:value="changevalRec"
optval="_id"
optlab="label"
:useinput="false"
:col="col"
:row="row"
:options="tools.SelectHours"
:addstrrequired="addstrrequired"
>
</CMySelect>
</div>
<div v-else>
<q-input
v-model="myvalue"
type="number"
:maxlength="col.maxlength ? col.maxlength : undefined"
@update:value="changevalRec"
autofocus
>
</q-input>
</div>
</div>
<div
v-else-if="col.fieldtype === costanti.FieldType.listimages"
style="text-align: center"
>
<span class="text-h7 text-weight-bold row justify-center">
{{ $t(col.label_trans) }}
</span>
<CGallery
:imagebak="
col.showpicprofile_ifnotset
? userStore.getImgByProfile(row, true) === ''
? costanti.NESSUN_IMMAGINE
: userStore.getImgByProfile(row, true)
: ''
"
:title="tools.getTitleGall(table)"
:directory="tools.getDirectoryGall(myrow, table, mypath)"
:imgGall="
myvalue && myvalue.imagefile ? myvalue.imagefile : myvalue
"
:isInModif="isInModif"
:edit="isviewfield() && isInModif"
:canModify="canModify && isInModif"
@showandsave="Savedb"
>
</CGallery>
</div>
<div
v-else-if="col.fieldtype === costanti.FieldType.listobj"
style="text-align: center"
>
<CAccomodation
:mylist="myvalue"
:isInModif="isInModif"
:edit="isviewfield() && isInModif"
:canModify="canModify && isInModif"
@showandsave="Savedb"
>
</CAccomodation>
</div>
<div
v-else-if="col.fieldtype === costanti.FieldType.image"
style="text-align: center"
>
<div v-if="canEdit">
<span class="text-h7 text-weight-bold row justify-center">
{{ $t(col.label_trans ? col.label_trans : '') }}
</span>
<CGallery
:imagebak="
col.showpicprofile_ifnotset
? userStore.getImgByProfile(row['profile'], true)
: ''
"
:title="tools.getTitleGall(table)"
:directory="tools.getDirectoryGall(myrow, table, mypath)"
:imgGall="
myvalue && myvalue.imagefile
? [myvalue]
: [{ imagefile: myvalue, vers_img: 1 }]
"
:edit="isviewfield()"
:canModify="canModify"
:isInModif="isInModif"
:single="true"
@update:imgGall="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="
col.showpicprofile_ifnotset
? userStore.getImgByProfile(row['profile'], true)
: '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>
</div>
</div>
<div
v-else-if="col.fieldtype === costanti.FieldType.image_and_filename"
>
<div v-if="canEdit">
{{ $t('reg.photo') }}
<q-input
v-model="myvalue"
@update:value="changevalRec"
@update:model-value="Savedb"
:maxlength="col.maxlength ? col.maxlength : undefined"
autofocus
>
</q-input>
<CGallery
:imagebak="
col.showpicprofile_ifnotset
? userStore.getImgByProfile(row['profile'], true)
: ''
"
:title="tools.getTitleGall(table)"
:directory="tools.getDirectoryGall(myrow, table, mypath)"
:imgGall="
myvalue && myvalue.imagefile
? [myvalue]
: [{ imagefile: myvalue, vers_img: 1 }]
"
:edit="isviewfield()"
:canModify="canModify"
:isInModif="isInModif"
:single="true"
@update:imgGall="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="
col.showpicprofile_ifnotset
? userStore.getImgByProfile(row['profile'], true)
: '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>
</div>
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.imgcard">
<div v-if="canEdit">
{{ $t('reg.photo') }}
<CSelectImage
v-bind="$attrs"
:imagebak="
col.showpicprofile_ifnotset
? userStore.getImgByProfile(row['profile'], true)
: ''
"
:title="tools.getTitleGall(table)"
:directory="tools.getDirectoryGall(myrow, table, mypath)"
:imgGall="
myvalue && myvalue.imagefile ? [myvalue.imagefile] : [myvalue]
"
:edit="isviewfield()"
:canModify="canModify"
:isInModif="isInModif"
@update:imgGall="changevalRec"
@showandsave="Savedb"
>
</CSelectImage>
</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="
col.showpicprofile_ifnotset
? userStore.getImgByProfile(row['profile'], true)
: '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>
</div>
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.nationality">
<div
v-if="isInModif"
class="justify-center q-gutter-sm clgutter q-mt-sm"
>
<CMySelect
:type_out="col.field_outtype"
:col="col"
:row="row"
:label="col.label ? col.label : $t(col.label_trans)"
v-model:value="myvalue"
@update:value="changevalRec"
:tablesel="tablesel"
:pickup="pickup"
:optval="fieldsTable.getKeyByTable(col.jointable)"
:optlab="fieldsTable.getLabelByTable(col.jointable)"
:options="
globalStore.getTableJoinByName(
col.jointable,
col.addall,
col.addnone,
col.filter
)
"
:useinput="false"
:addstrrequired="addstrrequired"
>
</CMySelect>
</div>
<div v-else>
<span v-html="visuValByType(myvalue, col, row)"></span>
</div>
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.intcode">
<div
v-if="isInModif"
class="justify-center q-gutter-sm clgutter q-mt-sm"
>
<CMySelect
:type_out="col.field_outtype"
:col="col"
:row="row"
:label="col.label ? col.label : $t(col.label_trans)"
v-model:value="myvalue"
@update:value="changevalRec"
:tablesel="tablesel"
:pickup="pickup"
:optval="fieldsTable.getKeyByTable(col.jointable)"
:optlab="fieldsTable.getLabelByTable(col.jointable)"
:options="
globalStore.getTableJoinByName(
col.jointable,
col.addall,
col.addnone,
col.filter
)
"
:useinput="false"
:addstrrequired="addstrrequired"
>
</CMySelect>
</div>
<div v-else>
<span v-html="visuValByType(myvalue, col, row)"></span>
</div>
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.date">
<div v-if="myvalue">
<CDateTime
:label="
col.label
? addstrrequired + col.label
: col.label_trans
? (addstrrequired + $t(col.label_trans))
: ''
"
:class="{ 'cursor-pointer': canEdit }"
v-model:value="myvalue"
:readonly="false"
:minuteinterval="minuteinterval"
:dense="dense"
:canEdit="canEdit"
@savetoclose="SaveValueInt"
@show="OpenEdit"
>
</CDateTime>
</div>
<div v-else-if="canEdit">
<q-btn
:dense="dense"
color="primary"
@click="OpenEditDateToday"
icon="fas fa-calendar-day"
/>
</div>
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.onlydate">
<CDateTime
:label="col.label ? (addstrrequired + col.label) : (addstrrequired + $t(col.label_trans))"
:class="{ 'cursor-pointer': canEdit }"
:valueDate="myvalue"
v-model:value="myvalue"
:readonly="false"
:minuteinterval="minuteinterval"
:dense="dense"
:canEdit="canEdit"
@savetoclose="SaveValueInt"
@show="OpenEdit"
view="date"
>
</CDateTime>
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.binary">
<div v-if="isInModif">
<span v-if="insertMode">
{{ col.label ? col.label : $t(col.label_trans) }}:
</span>
<CMyToggleList
:label="col.titlepopupedit ? col.titlepopupedit : ''"
:options="
globalStore.getTableJoinByName(
col.jointable,
col.addall,
col.addnone,
col.filter
)
"
v-model:value="myvalue"
@update:value="changevalRec"
:optval="fieldsTable.getKeyByTable(col.jointable)"
:optlab="fieldsTable.getLabelByTable(col.jointable)"
>
</CMyToggleList>
</div>
<div v-else>
<CMyChipList
:rec="row"
:type="costanti.FieldType.binary"
:value="myvalue"
@update:value="changevalRec"
:options="
globalStore.getTableJoinByName(
col.jointable,
col.addall,
col.addnone,
col.filter
)
"
:optval="fieldsTable.getKeyByTable(col.jointable)"
:optlab="fieldsTable.getLabelByTable(col.jointable)"
:opticon="fieldsTable.getIconByTable(col.jointable)"
></CMyChipList>
</div>
</div>
<!-- Show Value -->
<div v-else-if="col.fieldtype === costanti.FieldType.multiselect">
<div v-if="isInModif">
<CMySelect
:type_out="col.field_outtype"
:col="col"
:row="row"
:multiple="true"
:withToggle="true"
:label="col.label ? col.label : $t(col.label_trans)"
:filter_table="col.filter_table"
:filter_field="col.filter_field"
:value_extra="value_extra"
v-model:arrvalue="myvalue"
@update:arrvalue="changevalRec"
:addall="false"
:addnone="false"
label-color="primary"
class="combowidth"
color="primary"
:optval="fieldsTable.getKeyByTable(col.jointable)"
:optlab="fieldsTable.getLabelByTable(col.jointable)"
:options="
globalStore.getTableJoinByName(
col.jointable,
col.addall,
col.addnone,
col.filter
)
"
:sola_lettura="!isInModif"
:useinput="col.allowNewValue"
:newvaluefunc="addNewValue"
:addstrrequired="addstrrequired"
:dense="dense"
>
</CMySelect>
<!--<q-select
:behavior="$q.platform.is.ios === true ? 'dialog' : 'menu'"
v-model="myvalue"
rounded
outlined
multiple
dense
options-dense
:display-value="fieldsTable.getTitleByTable(col.jointable)"
emit-value
map-options
:options="globalStore.getTableJoinByName(col.jointable, col.addall, col.addnone, col.filter)"
class="combowidth"
:option-value="fieldsTable.getKeyByTable(col.jointable)"
@update:model-value="changevalRec">
<template v-slot:option="{ itemProps, opt, selected, toggleOption }">
<q-item v-bind="itemProps">
<q-item-section>
<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-item-section>
</q-item>
</template>
</q-select>-->
</div>
<div v-else>
<CMyChipList
:rec="row"
:type="col.fieldtype"
:type_out="col.field_outtype"
@update:value="changevalRec"
:value="myvalue"
:options="
globalStore.getTableJoinByName(
col.jointable,
col.addall,
col.addnone,
col.filter
)
"
:optval="fieldsTable.getKeyByTable(col.jointable)"
:optlab="fieldsTable.getLabelByTable(col.jointable)"
:opticon="fieldsTable.getIconByTable(col.jointable)"
></CMyChipList>
</div>
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.color">
<div v-if="myvalue" :style="`color: text-${myvalue};`">
{{ myvalue }}
</div>
<div v-else>(Scegli)</div>
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.multioption">
<q-option-group
v-model="myvalue"
:inline="col.inline"
:type="col.typeobj"
:label="col.label ? col.label : $t(col.label_trans)"
@update:model-value="changevalRec"
:options="globalStore.getTableJoinLabelValueByName(col)"
></q-option-group>
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.option">
<q-option-group
v-model="myvalue"
type="toggle"
@update:model-value="changevalRec"
:options="
globalStore.getTableJoinByName(
col.jointable,
col.addall,
col.addnone,
col.filter
)
"
></q-option-group>
</div>
<div
v-else-if="
col.fieldtype === costanti.FieldType.select ||
col.fieldtype === costanti.FieldType.select_by_server
"
>
<div v-if="isInModif">
<CMySelect
:type_out="col.field_outtype"
:col="col"
:row="row"
:label="col.label ? col.label : $t(col.label_trans)"
v-model:value="myvalue"
:pickup="col.fieldtype === costanti.FieldType.select_by_server"
:tablesel="
col.fieldtype === costanti.FieldType.select_by_server
? tablesel
: ''
"
@update:value="changevalRec"
@update:model-value="Savedb"
:newvaluefunc="addNewValue"
:filter_table="col.filter_table"
:addnone="col.addnone"
:filter_field="col.filter_field"
:value_extra="value_extra"
:optval="fieldsTable.getKeyByTable(col.jointable)"
:optlab="fieldsTable.getLabelByTable(col.jointable)"
:options="
globalStore.getTableJoinByName(
col.jointable,
col.addall,
col.addnone,
col.filter
)
"
:useinput="col.allowNewValue"
:addstrrequired="addstrrequired"
:dense="dense"
>
</CMySelect>
</div>
<div v-else>
<!--
rec: {{rec}}
row: {{row}}
col.jointable {{col.jointable}}
myvalue {{myvalue}}
opt: {{globalStore.getTableJoinByName(col.jointable, col.addall, col.addnone, col.filter)}}
val: {{fieldsTable.getKeyByTable(col.jointable)}}
lab: {{fieldsTable.getLabelByTable(col.jointable)}}-->
<CMyChipList
:rec="row"
myclass="text-center"
:type="col.fieldtype"
:type_out="col.field_outtype"
@update:value="changevalRec"
v-model:value="myvalue"
:labelifblank="canEdit ? 'Selezionare' : ''"
:filter_table="col.filter_table"
:filter_field="col.filter_field"
:options="
globalStore.getTableJoinByName(
col.jointable,
col.addall,
col.addnone,
col.filter
)
"
:optval="fieldsTable.getKeyByTable(col.jointable)"
:optlab="fieldsTable.getLabelByTable(col.jointable)"
:opticon="fieldsTable.getIconByTable(col.jointable)"
></CMyChipList>
</div>
</div>
<div
v-else-if="
col.fieldtype === costanti.FieldType.multiselect_by_server
"
>
<CMySelect
:type_out="col.field_outtype"
:col="col"
:row="row"
:multiselect_by_server="true"
:label="col.label ? col.label : $t(col.label_trans)"
v-model:arrvalue="myvalue"
@update:arrvalue="changevalRec"
:addall="false"
:addnone="false"
:tablesel="col.tablesel"
:pickup="true"
:filter_table="col.filter_table"
:filter_field="col.filter_field"
:value_extra="value_extra"
label-color="primary"
class="combowidth"
color="primary"
:optval="fieldsTable.getKeyByTable(col.jointable)"
:optlab="fieldsTable.getLabelByTable(col.jointable)"
:options="
globalStore.getTableJoinByName(
col.jointable,
col.addall,
col.addnone,
col.filter
)
"
:sola_lettura="!isInModif"
:useinput="isInModif"
:addstrrequired="addstrrequired"
:dense="dense"
>
</CMySelect>
</div>
<div
v-else-if="
col.fieldtype === costanti.FieldType.star5 ||
col.fieldtype === costanti.FieldType.star3
"
>
<div v-if="isInModif">
<CMySelect
:type_out="col.field_outtype"
:col="col"
:row="row"
:label="col.label ? col.label : $t(col.label_trans)"
v-model:value="myvalue"
@update:value="changevalRec"
:filter_table="col.filter_table"
:filter_field="col.filter_field"
:value_extra="value_extra"
:optval="fieldsTable.getKeyByTable(col.jointable)"
:optlab="fieldsTable.getLabelByTable(col.jointable)"
:options="
globalStore.getTableJoinByName(
col.jointable,
col.addall,
col.addnone,
col.filter
)
"
:useinput="false"
:addstrrequired="addstrrequired"
:dense="dense"
>
</CMySelect>
</div>
<div v-else>
<q-rating
:model-value="`${myvalue}` - 1"
@update:model-value="changevalRec"
size="1.5rem"
:color="tools.getColByLevel(myvalue)"
icon="star_border"
icon-selected="star"
:max="col.fieldtype === costanti.FieldType.star5 ? 5 : 3"
:readonly="true"
/>
</div>
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.html">
<div v-if="isInModif">
<q-bar
v-if="isInModif"
:dense="dense"
class="bg-primary text-white"
>
<span v-if="col.label_trans">{{ $t(col.label_trans) }}</span
><span v-else> {{ $t('event.testo_di_spiegazione') }}: </span>
<q-space />
</q-bar>
<div v-if="!isFieldDb()">
<CMyEditor
v-model:value="myvalue"
:title="!isInModif ? getTitleEditor(col, row) : ''"
@keyup.enter.stop
:showButtons="false"
:canModify="canModify"
@update:value="changevalRec"
@showandsave="Savedb"
>
</CMyEditor>
</div>
</div>
<div v-else>
<div class="row justify-evenly">
<q-btn
v-if="myvalue"
class="q-mx-md"
icon="fas fa-info"
color="primary"
text-color="white"
round
@click="visuhtml = true"
>
</q-btn>
<q-btn
v-if="myvalue && col.field_extra1"
icon="far fa-file-alt"
:label="col.titlepopupedit"
color="primary"
text-color="white"
:to="tools.getToByCol(col)"
>
</q-btn>
</div>
<div
v-html="visuValByType(myvalue, col, row)"
@click="visueditor = true"
></div>
<div v-if="!isFieldDb()">
<q-dialog v-model="visuhtml" full-height full-width>
<q-card>
<q-bar :dense="dense" class="bg-primary text-white">
<span> {{ getTitleEditor(col, row) }} </span>
<q-space />
<q-btn
flat
round
color="white"
icon="close"
v-close-popup
></q-btn>
</q-bar>
<q-card-section class="inset-shadow">
<q-card class="dialog_card">
<div v-html="myvalue" class="wrap_anywhere"></div>
</q-card>
</q-card-section>
</q-card>
</q-dialog>
<q-dialog
v-model="visueditor"
no-backdrop-dismiss
persistent
full-height
full-width
>
<q-card class="dialog_card">
<q-card-section>
<CMyEditor
v-if="visueditor"
v-model:value="myvalue"
:title="col.title"
@keyup.enter.stop
:canModify="canModify"
@showandsave="Savedb"
@annulla="visueditor = false"
>
</CMyEditor>
</q-card-section>
</q-card>
</q-dialog>
</div>
</div>
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.password">
<div v-if="isInModif">
<q-input
v-model="myvalue"
@update:model-value="changevalRec"
:maxlength="col.maxlength ? col.maxlength : undefined"
type="password"
@keyup.enter="scope.set"
autofocus
>
</q-input>
</div>
<div v-else>
<span v-html="visuValByType(myvalue, col, row)"></span>
</div>
</div>
<div v-else>
<span v-html="visuValByType(myvalue, col, row)"></span>
</div>
<q-popup-edit
v-if="!isInModif && canEdit && noPopupeditByCol(col)"
v-model="myvalue"
:disable="
col.disable ||
disable ||
col.fieldtype === costanti.FieldType.image_and_filename
"
:readonly="col.disable || disable"
:title="col.title ? col.title : col.titlepopupedit"
buttons
:label-set="$t('dialog.save')"
:label-cancel="$t('dialog.cancel')"
persistent
@save="SaveValueInt"
@show="OpenEdit"
v-slot="scope"
>
<div v-if="col.fieldtype === costanti.FieldType.boolean">
<q-checkbox
v-model="scope.value"
:label="col.title ? col.title : col.titlepopupedit"
>
</q-checkbox>
<span v-html="visuValByType(myvalue, col, row)"></span>
</div>
<div
v-else-if="
col.fieldtype === costanti.FieldType.string ||
col.fieldtype === costanti.FieldType.crypted
"
>
<q-input
v-bind="$attrs"
counter
:type="
col.fieldtype === costanti.FieldType.crypted
? 'password'
: 'text'
"
:maxlength="col.maxlength ? col.maxlength : undefined"
:minlength="col.minlength ? col.minlength : undefined"
v-model="scope.value"
:label="col.visulabel ? (addstrrequired + $t(col.label_trans)) : ''"
:autogrow="col.fieldtype !== costanti.FieldType.crypted"
@keyup.enter.stop
autofocus
:rules="[val => (!!val || !col.required) || 'Campo richiesto']"
>
<template v-if="notAllowAtChar" v-slot:prepend>
<span class="text-h7 text-blue">@</span>
</template>
</q-input>
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.number">
<div v-if="visulabel">
<q-input
v-model="scope.value"
type="number"
debounce="1000"
:maxlength="col.maxlength ? col.maxlength : undefined"
autofocus
:label="
col.visulabel
? $t(col.label_trans)
: visulabel
? (addstrrequired + col.label)
: ''
"
>
</q-input>
</div>
<div v-else>
<span v-html="visuValByType(myvalue, col, row)"></span>
</div>
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.currency">
<CCurrencyValue
:symbol="tools.getSymbolByCircuit(row)"
:color="tools.getColorByCircuit(row)"
v-model="scope.value"
:label="$t(col.label_trans)"
>
</CCurrencyValue>
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.coordinates">
<CMapEditAddressByCoord
:visuMappa="false"
:editaddress="true"
v-model:model-value="scope.value"
@update:model-value="changeValRec"
></CMapEditAddressByCoord>
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.hours">
<div v-if="visulabel">
<q-input
v-model="myvalue"
type="number"
:maxlength="col.maxlength ? col.maxlength : undefined"
autofocus
@update:model-value="changevalRec"
style="max-width: 100px"
:label="col.label ? col.label : $t(col.label_trans)"
>
</q-input>
</div>
<div v-if="isFieldDb()">
<CMySelect
:type_out="col.field_outtype"
:col="col"
:row="row"
label="Ore"
v-model:value="myvalue"
optval="value"
optlab="label"
:dense="false"
:use-input="false"
@changeval="changevalRecHours"
style="max-width: 100px"
:options="tools.SelectHours"
:addstrrequired="addstrrequired"
>
</CMySelect>
</div>
<div v-else>
<q-input
v-model="scope.value"
type="number"
:maxlength="col.maxlength ? col.maxlength : undefined"
autofocus
>
</q-input>
</div>
</div>
<div
v-else-if="
col.fieldtype === costanti.FieldType.select ||
col.fieldtype === costanti.FieldType.select_by_server
"
>
<CMySelect
:type_out="col.field_outtype"
:col="col"
:row="row"
:label="col.label ? col.label : $t(col.label_trans)"
v-model:value="scope.value"
:pickup="col.fieldtype === costanti.FieldType.select_by_server"
:addnone="col.addnone"
:tablesel="
col.fieldtype === costanti.FieldType.select_by_server
? tablesel
: ''
"
:filter_table="col.filter_table"
:filter_field="col.filter_field"
:value_extra="value_extra"
:newvaluefunc="addNewValue"
:optval="fieldsTable.getKeyByTable(col.jointable)"
:optlab="fieldsTable.getLabelByTable(col.jointable)"
:options="
globalStore.getTableJoinByName(
col.jointable,
col.addall,
col.addnone,
col.filter
)
"
:useinput="col.allowNewValue"
:addstrrequired="addstrrequired"
:dense="dense"
>
</CMySelect>
</div>
<div
v-else-if="
col.fieldtype === costanti.FieldType.multiselect_by_server
"
>
<CMySelect
:type_out="col.field_outtype"
:col="col"
:row="row"
:multiselect_by_server="true"
:label="col.label ? col.label : $t(col.label_trans)"
v-model:arrvalue="scope.value"
@update:arrvalue="changevalRec"
:addall="false"
:addnone="false"
:tablesel="tablesel"
:filter_table="col.filter_table"
:filter_field="col.filter_field"
:value_extra="value_extra"
:pickup="true"
label-color="primary"
class="combowidth"
color="primary"
:optval="fieldsTable.getKeyByTable(col.jointable)"
:optlab="fieldsTable.getLabelByTable(col.jointable)"
:options="
globalStore.getTableJoinByName(
col.jointable,
col.addall,
col.addnone,
col.filter
)
"
:useinput="true"
:addstrrequired="addstrrequired"
:dense="dense"
>
</CMySelect>
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.multiselect">
<CMySelect
:type_out="col.field_outtype"
:col="col"
:row="row"
:multiple="true"
:withToggle="true"
:label="col.label ? col.label : $t(col.label_trans)"
:filter_table="col.filter_table"
:filter_field="col.filter_field"
:value_extra="value_extra"
v-model:arrvalue="scope.value"
@update:arrvalue="changevalRec"
:addall="false"
:addnone="false"
label-color="primary"
class="combowidth"
color="primary"
:optval="fieldsTable.getKeyByTable(col.jointable)"
:optlab="fieldsTable.getLabelByTable(col.jointable)"
:options="
globalStore.getTableJoinByName(
col.jointable,
col.addall,
col.addnone,
col.filter
)
"
:sola_lettura="!isInModif"
:useinput="col.allowNewValue"
:newvaluefunc="addNewValue"
:addstrrequired="addstrrequired"
:dense="dense"
>
</CMySelect>
<!--
<q-select
:behavior="$q.platform.is.ios === true ? 'dialog' : 'menu'"
v-model="scope.value"
rounded
outlined
multiple
dense
options-dense
:display-value="fieldsTable.getTitleByTable(col.jointable)"
emit-value
map-options
:options="
globalStore.getTableJoinByName(
col.jointable,
col.addall,
col.addnone,
col.filter
)
"
class="combowidth"
:useinput="col.allowNewValue"
:newvaluefunc="addNewValue"
:option-value="fieldsTable.getKeyByTable(col.jointable)"
@update:model-value="changeval"
>
<template
v-slot:option="{ itemProps, opt, selected, toggleOption }"
>
<q-item v-bind="itemProps">
<q-item-section>
<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-item-section>
</q-item>
</template>
</q-select>-->
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.nationality">
<div class="justify-center q-gutter-sm clgutter q-mt-sm">
<CMySelect
:type_out="col.field_outtype"
:col="col"
:row="row"
:label="col.label ? col.label : $t(col.label_trans)"
v-model:value="scope.value"
@update:value="changevalRec"
:tablesel="tablesel"
:filter_table="col.filter_table"
:filter_field="col.filter_field"
:value_extra="value_extra"
:pickup="pickup"
:optval="fieldsTable.getKeyByTable(tablesel)"
:optlab="fieldsTable.getLabelByTable(tablesel)"
:options="[]"
:useinput="false"
:addstrrequired="addstrrequired"
:dense="dense"
>
</CMySelect>
</div>
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.intcode">
<div class="justify-center q-gutter-sm clgutter q-mt-sm">
<CMySelect
:type_out="col.field_outtype"
:col="col"
:row="row"
:label="col.label ? col.label : $t(col.label_trans)"
v-model:value="scope.value"
@update:value="changevalRec"
:tablesel="tablesel"
:pickup="pickup"
:optval="fieldsTable.getKeyByTable(tablesel)"
:optlab="fieldsTable.getLabelByTable(tablesel)"
:options="[]"
:useinput="false"
:addstrrequired="addstrrequired"
>
</CMySelect>
</div>
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.date">
<CDateTime
:label="
col.label
? (addstrrequired + col.label)
: (col.label_trans
? (addstrrequired + $t(col.label_trans))
: '')
"
:class="{ 'cursor-pointer': canEdit }"
v-model:value="myvalue"
:readonly="false"
:minuteinterval="minuteinterval"
:dense="dense"
:canEdit="canEdit"
@savetoclose="SaveValueInt"
@show="OpenEdit"
>
</CDateTime>
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.onlydate">
<CDateTime
:label="col.label ? addstrrequired + col.label : (addstrrequired + $t(col.label_trans))"
:class="{ 'cursor-pointer': canEdit }"
:valueDate="myvalue"
v-model:value="myvalue"
:readonly="false"
:minuteinterval="minuteinterval"
:dense="dense"
:canEdit="canEdit"
@savetoclose="SaveValueInt"
@show="OpenEdit"
view="date"
>
</CDateTime>
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.binary">
<CMyToggleList
:label="col.titlepopupedit ? col.titlepopupedit : ''"
:options="
globalStore.getTableJoinByName(
col.jointable,
col.addall,
col.addnone,
col.filter
)
"
v-model:value="scope.value"
:optval="fieldsTable.getKeyByTable(col.jointable)"
:optlab="fieldsTable.getLabelByTable(col.jointable)"
>
</CMyToggleList>
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.username_chip">
<q-input
:type="
col.fieldtype === costanti.FieldType.crypted
? 'password'
: 'text'
"
:maxlength="col.maxlength ? col.maxlength : undefined"
:minlength="col.minlength ? col.minlength : undefined"
v-model="scope.value"
:label="col.visulabel ? (addstrrequired + $t(col.label_trans)) : ''"
:autogrow="col.fieldtype !== costanti.FieldType.crypted"
@keyup.enter.stop
autofocus
>
</q-input>
</div>
<div
v-else-if="
col.fieldtype === costanti.FieldType.star5 ||
col.fieldtype === costanti.FieldType.star3
"
>
<CMySelect
:type_out="col.field_outtype"
:col="col"
:row="row"
:label="col.label ? col.label : $t(col.label_trans)"
v-model:value="scope.value"
:optval="fieldsTable.getKeyByTable(col.jointable)"
:optlab="fieldsTable.getLabelByTable(col.jointable)"
:options="
globalStore.getTableJoinByName(
col.jointable,
col.addall,
col.addnone,
col.filter
)
"
:useinput="false"
:addstrrequired="addstrrequired"
>
</CMySelect>
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.password">
<q-input
v-model="scope.value"
:maxlength="col.maxlength ? col.maxlength : undefined"
:minlength="col.minlength ? col.minlength : undefined"
type="password"
@keyup.enter="scope.set"
autofocus
>
</q-input>
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.html">
<div v-if="!isFieldDb()">
<CMyEditor
v-model:value="myvalue"
:title="!isInModif ? getTitleEditor(col, row) : ''"
@keyup.enter.stop
:showButtons="false"
:canModify="canModify"
@update:value="changevalRec"
@showandsave="Savedb"
>
</CMyEditor>
</div>
</div>
<div
v-else-if="
col.fieldtype === costanti.FieldType.image_and_filename
"
>
<div v-if="canEdit">
{{ $t('reg.photo') }}
<q-input
v-model="myvalue"
@update:value="changevalRec"
:maxlength="col.maxlength ? col.maxlength : undefined"
autofocus
>
</q-input>
<CGallery
:imagebak="
col.showpicprofile_ifnotset
? userStore.getImgByProfile(row['profile'], true)
: ''
"
:title="tools.getTitleGall(table)"
:directory="tools.getDirectoryGall(myrow, table, mypath)"
:imgGall="
myvalue && myvalue.imagefile
? [myvalue]
: [{ imagefile: myvalue, vers_img: 1 }]
"
:edit="isviewfield()"
:canModify="canModify"
:isInModif="isInModif"
:single="true"
@update:imgGall="changevalRec"
@showandsave="Savedb"
>
</CGallery>
</div>
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.color">
<q-select
:behavior="$q.platform.is.ios === true ? 'dialog' : 'menu'"
rounded
style="min-width: 150px"
outlined
v-model="scope.value"
:options="shared_consts.LISTBESTCOLORS"
@update:model-value="changevalRec"
:dense="dense"
label="Colore:"
emit-value
map-options
>
</q-select>
</div>
</q-popup-edit>
</div>
</div>
</div>
</div>
</template>
<script lang="ts" src="./CMyPopupEdit.ts">
</script>
<style lang="scss" scoped>
@import './CMyPopupEdit.scss';
</style>