<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=""
    >
      <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="title ? title : col.label"
                @update:model-value="changevalRec"
              ></q-toggle>
            </div>
            <div v-else>
              <q-toggle
                dark
                color="green"
                v-model="myvalue"
                :label="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) : undefined"
                :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.op_andor">
            <div>
              <q-select
                v-if="isInModif"
                v-model="myvalue"
                :label="t('dialog.condition')"
                :options="[
                  { label: $t('dialog.conditionAND'), value: costanti.OP_ANDOR.OP_AND },
                  { label: $t('dialog.conditionOR'), value: costanti.OP_ANDOR.OP_OR },
                ]"
                emit-value
                map-options
                @update:model-value="changevalRec"
              >
              </q-select>
              <span v-else>
                <div class="text-subtitle2 text-primary text-weight-medium">
                  {{ $t('dialog.condition') }}
                </div>

                <q-chip
                  class="q-ma-md q-pa-sm"
                  :color="myvalue === costanti.OP_ANDOR.OP_AND ? 'red' : 'green'"
                  text-color="white"
                  :icon="myvalue === costanti.OP_ANDOR.OP_AND ? 'fas fa-filter' : 'fas fa-sliders-h'"
                  :label="myvalue === costanti.OP_ANDOR.OP_AND ? $t('dialog.conditionAND') : $t('dialog.conditionOR')"
                ></q-chip>
              </span>
            </div>
          </div>
          <div v-else-if="col.fieldtype === costanti.FieldType.verifica">
            <div>
              <div>
                <q-chip
                dense
                  class="q-ma-xs q-pa-xs"
                  :color="
                    myvalue.esito === costanti.VALIDATO.SI
                      ? 'green'
                      : myvalue.esito === costanti.VALIDATO.TO_RESOLV
                        ? 'red'
                        : 'grey-7'
                  "
                  text-color="white"
                  :icon="
                    myvalue.esito === costanti.VALIDATO.NO
                      ? 'fas fa-question-circle'
                      : myvalue.esito === costanti.VALIDATO.SI
                        ? 'fas fa-check-circle'
                        : 'fas fa-exclamation-circle'
                  "
                  :label="
                    myvalue.esito === costanti.VALIDATO.NO
                      ? $t('validazione.NO')
                      : myvalue.esito === costanti.VALIDATO.SI
                        ? $t('validazione.SI')
                        : $t('validazione.TO_RESOLV')
                  "
                ></q-chip>
              </div>
              <div v-if="myvalue.username">
                <span>(Utente: {{ myvalue.username }} - in Data: {{ tools.getstrDateTime(myvalue.data) }})</span>
              </div>

              <div v-if="myvalue.note">
                <span>Note: {{ myvalue.note }}</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"
                :class="{ 'cursor-pointer': canEdit }"
                :autogrow="col.fieldtype !== costanti.FieldType.crypted"
                :style="$q.screen.lt.sm ? 'min-width: 300px' : 'min-width: 300px'"
                counter
                filled
                :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
                >
                <CLabel
                  :dense="dense"
                  :class_text="{ 'cursor-pointer': canEdit }"
                  :class="{ disabled: disable }"
                  :value="visuValByType(myvalue, col, row)"
                  label=""
                />

                <!--<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">
              <div>
                <CInput
                  v-model="myvalue"
                  :label="
                    col.visulabel ? t(col.label_trans) : visulabel ? addstrrequired + t(col.label_trans) : undefined
                  "
                  :dense="dense"
                  @savedb="Savedb"
                />
              </div>
            </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>
              <CInput
                v-model="myvalue"
                :label="
                  col.visulabel ? t(col.label_trans) : visulabel ? addstrrequired + t(col.label_trans) : undefined
                "
                :dense="dense"
                @savedb="changevalRec"
                :maxlength="col.maxlength ? col.maxlength : undefined"
                autofocus
              />
            </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)
                      : undefined
                "
                :class="{ 'cursor-pointer': canEdit }"
                v-model:value="myvalue"
                :readonly="false"
                :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">
            <div v-if="myvalue">
              <CDateTime
                :label="
                  col.label
                    ? addstrrequired + col.label
                    : col.label_trans
                      ? addstrrequired + t(col.label_trans)
                      : undefined
                "
                :class="{ 'cursor-pointer': canEdit }"
                v-model:value="myvalue"
                :readonly="false"
                :dense="dense"
                :canEdit="canEdit"
                @savetoclose="SaveValueInt"
                @show="OpenEdit"
                view="date"
              >
              </CDateTime>
            </div>
          </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 : undefined"
                :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)"
                :dense="dense"
              ></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 : col?.label_trans ? 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"
                :label="title"
                @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)"
                :dense="dense"
              ></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}}<br><br>
              row: {{row}}<br><br>
              col.jointable {{col.jointable}}<br><br>
              myvalue {{myvalue}}<br><br>
              opt: {{globalStore.getTableJoinByName(col.jointable, col.addall, col.addnone, col.filter)}}<br><br>
              val:  {{fieldsTable.getKeyByTable(col.jointable)}}<br><br>
              lab: {{fieldsTable.getLabelByTable(col.jointable)}}<br><br>-->
              <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)"
                :dense="dense"
              ></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) : undefined"
                  @keyup.enter.stop
                  :showButtons="false"
                  :canModify="canModify"
                  @update:value="changevalRec"
                  @showandsave="Savedb"
                  :maxlength="col.maxlength"
                >
                </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="title"
                        @keyup.enter.stop
                        :canModify="canModify"
                        @showandsave="Savedb"
                        @annulla="visueditor = false"
                        :maxlength="col.maxlength"
                      >
                      </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="changevalRec"
                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
            ref="popupEditRef"
            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="title ? title : col.titlepopupedit"
            buttons
            :label-set="t('dialog.save')"
            :label-cancel="t('dialog.cancel')"
            persistent
            @save="SaveValueInt"
            @show="OpenEdit"
            v-slot="scope"
            @cancel="handleCancel"
          >
            <div v-if="col.fieldtype === costanti.FieldType.boolean">
              <q-checkbox
                v-model="scope.value"
                :label="title ? title : col.titlepopupedit"
              >
              </q-checkbox>
              <span v-html="visuValByType(myvalue, col, row)"></span>
            </div>
            <div v-else-if="col.fieldtype === costanti.FieldType.op_andor">
              <q-select
                v-model="scope.value"
                :label="t('dialog.condition')"
                :options="[
                  { label: 'Filtra se Tutti i criteri sono veri (AND)', value: costanti.OP_ANDOR.OP_AND },
                  { label: 'Filtra se almeno uno dei criteri è vero (OR)', value: costanti.OP_ANDOR.OP_OR },
                ]"
                emit-value
                map-options
                :color="scope.value === costanti.OP_ANDOR.OP_AND ? 'red' : 'green'"
                :icon="scope.value === costanti.OP_ANDOR.OP_AND ? 'fas fa-filter' : 'fas fa-sliders-h'"
                @update:model-value="changevalRec"
              >
              </q-select>
            </div>
            <div v-else-if="col.fieldtype === costanti.FieldType.verifica">
              <div>
                <q-option-group
                  v-model="scope.value.esito"
                  type="radio"
                  :icon="
                    [costanti.VALIDATO.NO, costanti.VALIDATO.TO_RESOLV].includes(myvalue.esito)
                      ? 'fas fa-question-circle'
                      : 'fas fa-check-circle'
                  "
                  :color="
                    myvalue.esito === costanti.VALIDATO.SI
                      ? 'green'
                      : myvalue.esito === costanti.VALIDATO.TO_RESOLV
                        ? 'red'
                        : 'grey-7'
                  "
                  inline
                  :options="[
                    { label: '[Non verificato]', value: costanti.VALIDATO.NO },
                    { label: 'Validato', value: costanti.VALIDATO.SI },
                    { label: 'Da Risolvere', value: costanti.VALIDATO.TO_RESOLV },
                  ]"
                ></q-option-group>
                Username: {{ scope.value.username }}
                <q-input
                  v-model="scope.value.note"
                  type="text"
                  icon="fas fa-sticky-note"
                  label="Nota"
                  :autogrow="true"
                >
                </q-input>
              </div>
            </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) : undefined"
                :autogrow="col.fieldtype !== costanti.FieldType.crypted"
                @keyup.enter.stop
                @keydown="handleKeydown"
                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.editor_nohtml">
              <div
                class="q-pa-md"
                style="min-width: 600px"
              >
                <CMyEditorAI
                  v-model:value="scope.value"
                  :title="col.visulabel ? t(col.label_trans) : visulabel ? addstrrequired + col.label : undefined"
                  @keyup.enter.stop
                  :showButtons="false"
                  :canModify="canModify"
                  :hideTools="true"
                  @update:value="changevalRec"
                  @showandsave="Savedb"
                  :maxlength="col.maxlength"
                >
                </CMyEditorAI>
              </div>
            </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 : undefined"
                >
                </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 : col.label_trans ? t(col.label_trans) : undefined"
                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 : undefined"
                :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
                v-if="scope.value"
                :type_out="col.field_outtype"
                :col="col"
                :row="row"
                :multiple="true"
                :withToggle="true"
                :label="col.label ? col.label : col.label_trans ? t(col.label_trans) : ''"
                :filter_table="col.filter_table"
                :filter_field="col.filter_field"
                v-model:arrvalue="scope.value"
                @update:arrvalue="changevalRec"
                :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)
                      : undefined
                "
                :class="{ 'cursor-pointer': canEdit }"
                v-model:value="myvalue"
                :readonly="false"
                :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"
                :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 : undefined"
                :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) : undefined"
                :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) : undefined"
                  @keyup.enter.stop
                  :showButtons="false"
                  :canModify="canModify"
                  @update:value="changevalRec"
                  @showandsave="Savedb"
                  :maxlength="col.maxlength"
                >
                </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>
