- Se non aggiungo la foto alla competenza, prendo quella del profilo

This commit is contained in:
paoloar77
2022-02-10 23:31:18 +01:00
parent 86635053d7
commit c63ed7e6d3
11 changed files with 104 additions and 40 deletions

View File

@@ -42,14 +42,24 @@ $grayshadow: #555;
width: 100%;
max-width: 300px;
min-width: 200px;
padding: 1rem 1rem;
padding: 0.5rem 0.5rem;
height: 350px;
margin: auto;
}
.my-card-gallery-noModif {
width: 100%;
max-width: 300px;
min-width: 200px;
padding: 1rem 1rem;
height: 220px;
}
.my-card-gallery-view {
width: 100px;
height: 100px;
padding: 0.5rem 0.5rem;
padding: 0.25rem 0.25rem;
margin: auto;
}

View File

@@ -19,6 +19,11 @@ export default defineComponent({
type: Boolean,
required: true,
},
isInModif: {
type: Boolean,
required: false,
default: false,
},
single: {
type: Boolean,
required: false,
@@ -29,6 +34,11 @@ export default defineComponent({
type: String,
required: true,
},
imagebak: {
type: String,
required: false,
default: '',
},
imgGall: {
type: Object as PropType<IImgGallery[] | string | undefined | null>,
required: true,
@@ -184,7 +194,7 @@ export default defineComponent({
}
function getclass() {
return (props.edit || displayGall.value) ? 'my-card-gallery' : 'my-card-gallery-view' + ' text-center'
return (props.edit || displayGall.value) ? (props.isInModif ? 'my-card-gallery' : 'my-card-gallery-noModif') : 'my-card-gallery-view' + ' text-center'
}
function getclimg() {
@@ -247,7 +257,12 @@ export default defineComponent({
}
function getfullname(rec: any) {
return costanti.DIR_UPLOAD + props.directory + '/' + rec.imagefile
if (rec) {
return costanti.DIR_UPLOAD + props.directory + '/' + rec.imagefile
} else {
return props.imagebak
}
}
function copytoclipboard(rec: any) {

View File

@@ -1,8 +1,9 @@
<template>
<!--<div class="q-pa-md items-start " style="display: inline-flex; width: 800px;"> -->
<div v-if="!edit">
<div class="q-pa-md q-gutter-md">
<q-card :class="getclass()" @click="apri">
<div class="q-pa-xs q-gutter-md">
<q-card v-if="getlistimages().length > 0" :class="getclass()" @click="apri">
<div v-for="(mygallery, index) in getlistimages()" :key="index">
<div v-if="index === 0">
<q-img
@@ -16,6 +17,20 @@
</div>
</div>
</q-card>
<div v-if="!isInModif && getlistimages().length <= 0 && imagebak">
<q-card :class="getclass()" @click="ImgFullScreen(mygallery)">
<q-img
:src="imagebak" :class="getclimg()">
</q-img>
</q-card>
</div>
<q-btn
v-if="isInModif"
color="primary" @click="apri"
:label="$t('gallery.select_image')">
</q-btn>
</div>
</div>
<div v-else>
@@ -53,8 +68,8 @@
</div>
</q-img>
<q-field
v-if="canModify"
stack-label
dense
label="Nome File">
@@ -65,6 +80,7 @@
</q-field>
<q-input
v-if="canModify"
v-model="mygallery.description"
dense
:label="$t('proj.longdescr')"
@@ -156,7 +172,8 @@
Foto {{ index + 1 }}
</div>
<q-space></q-space>
<q-btn v-if="canModify" flat round color="red" icon="fas fa-trash-alt" @click="deleteFile(mygallery)"></q-btn>
<q-btn v-if="canModify" flat round color="red" icon="fas fa-trash-alt"
@click="deleteFile(mygallery)"></q-btn>
</q-bar>
<q-card
@@ -178,6 +195,7 @@
</q-img>
<q-card-section>
<q-field
v-if="canModify"
stack-label
dense
label="Nome File">
@@ -187,6 +205,7 @@
</q-field>
<q-input
v-if="canModify"
v-model="mygallery.description"
dense
:label="$t('proj.longdescr')"
@@ -220,6 +239,15 @@
></q-uploader>
</div>
</div>
<div v-if="!isInModif && getlistimages().length <= 0 && imagebak">
<q-card :class="getclass()" @click="ImgFullScreen(mygallery)">
<q-img
:src="imagebak" :class="getclimg()">
</q-img>
</q-card>
</div>
</div>

View File

@@ -65,6 +65,7 @@
:props="props"
class="text-italic text-weight-bold"
>
<span v-if="col && showColCheck(col, tools.TIPOVIS_SHOW_RECORD, true)">
{{ col.label }}
</span>
@@ -266,6 +267,7 @@
<div
v-if="showColCheck(col, tools.TIPOVIS_SHOW_RECORD, true, 1, props.row)" class="tdclass">
<div :class="getclrow(props.row)">
<CMyPopupEdit
:table="mytable"
:canEdit="canEdit"
@@ -353,7 +355,6 @@
<q-card-section class="inset-shadow">
<q-list dense>
<div v-for="col in mycolumns" :key="col.name">
<q-item v-if="showColCheck(col, tools.TIPOVIS_SHOW_RECORD, false, tools.getValue(props.row,col.field, col.subfield))"
:class="clByCol(col)" class="riduci_pad">
@@ -414,7 +415,6 @@
<div
class="q-ma-sm q-pa-sm colmodif col-grow rounded-borders " style="border: 1px solid #bbb"
@click="colclicksel = mycol">
<CMyPopupEdit
:table="mytable"
:canEdit="true"

View File

@@ -107,13 +107,12 @@
</div>
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.listimages" style="text-align: center;">
<p v-if="isInModif">
{{ $t('reg.image') }}:
</p>
<CGallery
:imagebak="col.showpicprofile_ifnotset ? userStore.getImgByProfile(row) : ''"
:title="getTitleGall()"
:directory="getDirectoryGall()"
:imgGall="myvalue"
:isInModif="isInModif"
:edit="isviewfield() && isInModif"
:canModify="canModify && isInModif"
@showandsave="Savedb">
@@ -123,11 +122,13 @@
<div v-if="canEdit">
{{ $t('reg.photo') }}
<CGallery
:imagebak="col.showpicprofile_ifnotset ? userStore.getImgByProfile(row['profile']) : ''"
:title="getTitleGall()"
:directory="getDirectoryGall()"
:imgGall="[{ imagefile: myvalue }]"
:edit="isviewfield()"
:canModify="canModify"
:isInModif="isInModif"
:single="isFieldDb()"
@update:imgGall="changevalRec"
@showandsave="Savedb">