- 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">

View File

@@ -876,7 +876,7 @@ $heightBtn: 100%;
.myimg-view {
border-radius: 5px !important;
height: 80px;
height: 90px;
}
.dialog_card{

View File

@@ -522,6 +522,7 @@ export interface IColGridTable {
field_extra1?: string
subfield_extra1?: string
allowNewValue?: boolean
showpicprofile_ifnotset?: boolean
}
export interface ITableRec {

View File

@@ -155,35 +155,39 @@ export default defineComponent({
if (sector)
sector = sector.replace('\'', '\\\'')
idSector = findidSector(sector)
if (!idSector) {
idSector = createSector(sector)
if (sector) {
idSector = findidSector(sector)
if (!idSector) {
idSector = createSector(sector)
// sectors
strsectors += '{ \n'
strsectors += ' _id:' + idSector + ','
strsectors += ' descr:\'' + sector + '\','
strsectors += '}, \n'
}
// sectors
strsectors += '{ \n'
strsectors += ' _id:' + idSector + ','
strsectors += ' descr:\'' + sector + '\','
strsectors += '}, \n'
}
idSkill = findidSkill(skill)
if (!idSkill) {
idSkill = createSkill(skill)
if (skill !== '') {
idSkill = findidSkill(skill)
if (!idSkill) {
idSkill = createSkill(skill)
// skills
strskills += '{ \n'
strsectors += ' _id:' + idSkill + ','
strskills += ' idSector: [' + idSector + '],'
strskills += ' descr:\'' + skill + '\','
strskills += '}, \n'
}
// skills
strskills += '{ \n'
strsectors += ' _id:' + idSkill + ','
strskills += ' idSector: [' + idSector + '],'
strskills += ' descr:\'' + skill + '\','
strskills += '}, \n'
}
}
if (sotto_cat !== '') {
// subskills
strsubskills += '{ \n'
strsubskills += ' idSkill: ' + idSkill + ','
strsubskills += ' descr:\'' + sotto_cat + '\','
strsubskills += '}, \n'
if (sotto_cat !== '') {
// subskills
strsubskills += '{ \n'
strsubskills += ' idSkill: ' + idSkill + ','
strsubskills += ' descr:\'' + sotto_cat + '\','
strsubskills += '}, \n'
}
}
indrecsub++

View File

@@ -21,6 +21,7 @@ const msg_it = {
title: 'Titolo',
directory: 'Directory',
list: 'Lista',
select_image: 'Scegli un\'Immagine',
},
profile: {
chisei: 'Chi Sei? Raccontaci di te:',

View File

@@ -60,6 +60,7 @@ function AddCol(params: IColGridTable) {
field_extra1: (params.field_extra1 === undefined) ? '' : params.field_extra1,
subfield_extra1: (params.subfield_extra1 === undefined) ? '' : params.subfield_extra1,
allowNewValue: (params.allowNewValue === undefined) ? false : params.allowNewValue,
showpicprofile_ifnotset: (params.showpicprofile_ifnotset === undefined) ? false : params.showpicprofile_ifnotset,
visible: (params.visible === undefined) ? true : params.visible,
icon: (params.icon === undefined) ? '' : params.icon,
action: (params.action === undefined) ? '' : params.action,
@@ -531,7 +532,9 @@ export const colmySkills = [
label_trans: 'skill.photos',
fieldtype: costanti.FieldType.listimages,
jointable: '',
showWhen: costanti.showWhen.NewRec + costanti.showWhen.InPage + costanti.showWhen.InEdit + costanti.showWhen.InView_OnlyifExist,
showpicprofile_ifnotset: true,
showWhen: costanti.showWhen.NewRec + costanti.showWhen.InPage + costanti.showWhen.InEdit + costanti.showWhen.InView,
visible: true,
}),
AddCol({
name: 'idSector',

View File

@@ -115,6 +115,7 @@
mykey="profile"
mysubkey="biografia"
maxlength="300"
hint="Scrivi chi sei e quale percorso formativo hai fatto"
:showall="true"
:type="costanti.FieldType.string">
</CMyFieldDb>