From 4b65400d50fc8c46e68161854c024e4c3723c754 Mon Sep 17 00:00:00 2001 From: Surya Paolo Date: Sun, 29 Jun 2025 18:33:20 +0200 Subject: [PATCH] - inserito il componente per scegliere il colore e la trasparenza, dello sfondo della pagina introduttiva - corretto i margini del testo e la dimensione del font. --- src/components/CMyPopupEdit/CMyPopupEdit.ts | 16 + src/components/CMyPopupEdit/CMyPopupEdit.vue | 412 +++++++++-- src/components/CPickColor/CPickColor.scss | 3 + src/components/CPickColor/CPickColor.ts | 101 +++ src/components/CPickColor/CPickColor.vue | 63 ++ src/components/CPickColor/index.ts | 1 + src/statics/lang/it.js | 1 + src/store/Modules/costanti.ts | 2 +- src/store/Modules/fieldsTable.ts | 2 +- src/store/Modules/tools.ts | 713 +++++++++++++++---- src/views/ecommerce/catalogo/catalogo.scss | 8 +- src/views/ecommerce/catalogo/catalogo.ts | 7 +- src/views/ecommerce/catalogo/catalogo.vue | 129 +++- 13 files changed, 1247 insertions(+), 211 deletions(-) create mode 100755 src/components/CPickColor/CPickColor.scss create mode 100755 src/components/CPickColor/CPickColor.ts create mode 100755 src/components/CPickColor/CPickColor.vue create mode 100755 src/components/CPickColor/index.ts diff --git a/src/components/CMyPopupEdit/CMyPopupEdit.ts b/src/components/CMyPopupEdit/CMyPopupEdit.ts index d20dcb77..38dc9659 100755 --- a/src/components/CMyPopupEdit/CMyPopupEdit.ts +++ b/src/components/CMyPopupEdit/CMyPopupEdit.ts @@ -17,6 +17,7 @@ import { CInput } from '../CInput' import { CMyEditor } from '../CMyEditor' import { CMyEditorAI } from '../CMyEditorAI' import { CGallery } from '../CGallery' +import { CPickColor } from '../CPickColor' import { CSelectImage } from '../CSelectImage' import { CAccomodation } from '../CAccomodation' import { tools } from '@tools' @@ -222,6 +223,7 @@ export default defineComponent({ components: { CMyChipList, CDateTime, CDate, CMyToggleList, CMySelect, CMyEditor, CGallery, CMyEditorAI, CCurrencyValue, CLabel, CAccomodation, CSelectImage, CMapEditAddressByCoord, CInput, + CPickColor, }, setup(props, { emit }) { const $q = useQuasar() @@ -236,14 +238,20 @@ export default defineComponent({ const visuhtml = ref(false) const showeditor = ref(false) + const hoverPreview = ref(false) + const myImgGall = ref([{}] as IImgGallery[]) const $router = useRouter() const loaded = ref(false) + const myColor = ref('#FF00AA55'); // Colore con trasparenza iniziale + const popupEditRef = ref(null) + const colorPicker = ref(null); + const addstrrequired = ref('') const col = ref({ @@ -982,6 +990,10 @@ export default defineComponent({ changevalRec(payload); } + function openColorPicker() { + // Apre la finestra del picker + colorPicker.value.openDialog(); + } return { myvalue, @@ -1030,6 +1042,10 @@ export default defineComponent({ copyToClipboard, updateValidazione, handleShowAndSave, + openColorPicker, + colorPicker, + myColor, + hoverPreview, } } }) diff --git a/src/components/CMyPopupEdit/CMyPopupEdit.vue b/src/components/CMyPopupEdit/CMyPopupEdit.vue index 68b6b3a1..4f71ca04 100755 --- a/src/components/CMyPopupEdit/CMyPopupEdit.vue +++ b/src/components/CMyPopupEdit/CMyPopupEdit.vue @@ -4,7 +4,11 @@ v-if=" tools.checkIfShowField( col, - insertMode ? tools.TIPOVIS_NEW_RECORD : isInModif ? tools.TIPOVIS_EDIT_RECORD : tools.TIPOVIS_SHOW_RECORD, + insertMode + ? tools.TIPOVIS_NEW_RECORD + : isInModif + ? tools.TIPOVIS_EDIT_RECORD + : tools.TIPOVIS_SHOW_RECORD, visulabel, myvalue ) @@ -32,7 +36,8 @@ v-model="myvalue" :label="title" :disable=" - (disable && col.name !== 'profile.saw_zoom_presentation') || (!isInModif && !canModify && !canEdit) + (disable && col.name !== 'profile.saw_zoom_presentation') || + (!isInModif && !canModify && !canEdit) " @update:model-value="Savedb" > @@ -79,7 +84,8 @@ {{ t(col.extrafield) }} @@ -103,19 +109,28 @@ v-else-if=" !col.extrafield || (col.extrafield && - (col.tipovisu !== costanti.TipoVisu.LINK || (col.tipovisu === costanti.TipoVisu.LINK && myvalue))) + (col.tipovisu !== costanti.TipoVisu.LINK || + (col.tipovisu === costanti.TipoVisu.LINK && myvalue))) " class="q-ma-xs chip_shadow" >
@@ -143,7 +158,9 @@ {{ tools.getNameToShow(row, col) }} - {{ tools.getUserNameOnlyIfToShow(row, col) }} + {{ + tools.getUserNameOnlyIfToShow(row, col) + }}
@@ -217,7 +242,7 @@
- (Utente: {{ myvalue.username }} - in Data: {{ tools.getstrDateTime(myvalue.data) }}) + (Utente: {{ myvalue.username }} - in Data: + {{ tools.getstrDateTime(myvalue.data) }})
@@ -253,7 +281,61 @@
-
+
+
+ +

+ {{ col.visulabel ? addstrrequired + t(col.label_trans) : col.label }}: +

+ + +
+ +
+ {{ myvalue }} +
+ + +
+ + + +
+
+ +
@@ -357,13 +443,22 @@ @update:model-value="changeValRecCoordAddr" >
-
+
@@ -674,7 +800,14 @@ :pickup="pickup" :optval="fieldsTable.getKeyByTable(col.jointable)" :optlab="fieldsTable.getLabelByTable(col.jointable)" - :options="globalStore.getTableJoinByName(col.jointable, col.addall, col.addnone, col.filter)" + :options=" + globalStore.getTableJoinByName( + col.jointable, + col.addall, + col.addnone, + col.filter + ) + " :useinput="false" :addstrrequired="addstrrequired" > @@ -737,10 +870,19 @@
- {{ col.label ? col.label : t(col.label_trans) }}: + + {{ col.label ? col.label : t(col.label_trans) }}: +
@@ -879,7 +1052,9 @@ :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 : ''" + :tablesel=" + col.fieldtype === costanti.FieldType.select_by_server ? tablesel : '' + " @update:value="changevalRec" @update:model-value="Savedb" :newvaluefunc="addNewValue" @@ -889,7 +1064,14 @@ :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)" + :options=" + globalStore.getTableJoinByName( + col.jointable, + col.addall, + col.addnone, + col.filter + ) + " :useinput="col.allowNewValue" :addstrrequired="addstrrequired" :dense="dense" @@ -915,7 +1097,14 @@ :labelifblank="canEdit ? 'Selezionare' : ''" :filter_table="col.filter_table" :filter_field="col.filter_field" - :options="globalStore.getTableJoinByName(col.jointable, col.addall, col.addnone, col.filter)" + :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)" @@ -944,7 +1133,14 @@ color="primary" :optval="fieldsTable.getKeyByTable(col.jointable)" :optlab="fieldsTable.getLabelByTable(col.jointable)" - :options="globalStore.getTableJoinByName(col.jointable, col.addall, col.addnone, col.filter)" + :options=" + globalStore.getTableJoinByName( + col.jointable, + col.addall, + col.addnone, + col.filter + ) + " :sola_lettura="!isInModif" :useinput="isInModif" :addstrrequired="addstrrequired" @@ -952,7 +1148,12 @@ >
-
+
@@ -1164,7 +1386,9 @@ v-model="scope.value.esito" type="radio" :icon=" - [costanti.VALIDATO.NO, costanti.VALIDATO.TO_RESOLV].includes(myvalue.esito) + [costanti.VALIDATO.NO, costanti.VALIDATO.TO_RESOLV].includes( + myvalue.esito + ) ? 'fas fa-question-circle' : 'fas fa-check-circle' " @@ -1194,7 +1418,10 @@
@@ -1312,25 +1551,39 @@
-
+
@@ -1591,10 +1881,18 @@ > { + const hexOpacity = Math.round((opacity.value / 100) * 255).toString(16).padStart(2, '0'); + return `${selectedColor.value}${hexOpacity}`; + }); + + // Funzione per aggiornare il colore con la trasparenza + const updateColor = () => { + const newColor = getnewcolor.value + emit('update:modelValue', newColor); // Emesso come nuovo valore di `v-model` + }; + + // Apri la finestra di dialogo + const openDialog = () => { + showDialog.value = true; + }; + + // Chiudi la finestra di dialogo senza fare modifiche + const cancel = () => { + showDialog.value = false; + }; + + // Conferma la selezione e chiude la finestra + const confirm = () => { + showDialog.value = false; + updateColor(); // Aggiorna il colore e la trasparenza + }; + + // Se il valore di `modelValue` cambia dall'esterno, aggiorna il colore + // Se il valore di `modelValue` cambia dall'esterno, aggiorna il colore + watch( + () => props.modelValue, + (newValue) => { + selectedColor.value = newValue.substring(0, 7); + opacity.value = Math.round(parseInt(newValue.substring(7, 9), 16) / 2.55); // Ricalcola la trasparenza correttamente + } + ); + + + onMounted(() => { + opacity.value = Math.round(parseInt(props.modelValue.substring(7, 9), 16) / 2.55); + }); + // Funzione per ottenere il colore con trasparenza + + return { + showDialog, + selectedColor, + opacity, + openDialog, + cancel, + confirm, + updateColor, + tools, + getnewcolor, + }; + }, +}); diff --git a/src/components/CPickColor/CPickColor.vue b/src/components/CPickColor/CPickColor.vue new file mode 100755 index 00000000..5244a036 --- /dev/null +++ b/src/components/CPickColor/CPickColor.vue @@ -0,0 +1,63 @@ + + + + + diff --git a/src/components/CPickColor/index.ts b/src/components/CPickColor/index.ts new file mode 100755 index 00000000..0e1213d9 --- /dev/null +++ b/src/components/CPickColor/index.ts @@ -0,0 +1 @@ +export {default as CPickColor} from './CPickColor.vue' diff --git a/src/statics/lang/it.js b/src/statics/lang/it.js index f416a7ce..af2327cf 100755 --- a/src/statics/lang/it.js +++ b/src/statics/lang/it.js @@ -2062,6 +2062,7 @@ const msg_it = { img_intro: 'Copertina introduttiva', img_bordata_stampa: 'Immagine di sfondo (per STAMPA)', img_intro_stampa: 'Copertina introduttiva (per STAMPA)', + impostazioni_intestazione: 'Impostazioni testo introduttivo', pagina_introduttiva_sfondo_nero: 'Pagina intro a sfondo nero', backcolor: 'Colore di Sfondo Pagina Introduttiva', isCatalogoGenerale: 'Fa parte del Catalogo Generale', diff --git a/src/store/Modules/costanti.ts b/src/store/Modules/costanti.ts index d233e46c..580ecd11 100755 --- a/src/store/Modules/costanti.ts +++ b/src/store/Modules/costanti.ts @@ -489,7 +489,7 @@ export const costanti = { op_andor: 19000, editor_nohtml: 20000, verifica: 21000, - + pickcolor: 22000, }, TypeMov: { diff --git a/src/store/Modules/fieldsTable.ts b/src/store/Modules/fieldsTable.ts index dced7f7b..3a3a0873 100755 --- a/src/store/Modules/fieldsTable.ts +++ b/src/store/Modules/fieldsTable.ts @@ -242,7 +242,7 @@ export const colTableCatalogList = [ AddCol({ name: 'descr_introduttiva', label_trans: 'cataloglist.descr_introduttiva', fieldtype: costanti.FieldType.html, maxlength: 1300 }), AddCol({ name: 'pagina_introduttiva_sfondo_nero', label_trans: 'cataloglist.pagina_introduttiva_sfondo_nero', fieldtype: costanti.FieldType.boolean }), - AddCol({ name: 'backcolor', label_trans: 'cataloglist.backcolor', fieldtype: costanti.FieldType.string }), + AddCol({ name: 'backcolor', label_trans: 'cataloglist.backcolor', fieldtype: costanti.FieldType.pickcolor }), AddCol({ name: 'img_bordata', diff --git a/src/store/Modules/tools.ts b/src/store/Modules/tools.ts index 658306db..fd546906 100644 --- a/src/store/Modules/tools.ts +++ b/src/store/Modules/tools.ts @@ -57,7 +57,15 @@ import { fieldsTable } from '@store/Modules/fieldsTable'; import { lists } from '@store/Modules/lists'; import { costanti } from '@store/Modules/costanti'; -import { copyToClipboard, date, Screen, useQuasar, colors, Cookies, scroll } from 'quasar'; +import { + copyToClipboard, + date, + Screen, + useQuasar, + colors, + Cookies, + scroll, +} from 'quasar'; const { getScrollTarget, setVerticalScrollPosition } = scroll; import { func_tools, toolsext } from '@store/Modules/toolsext'; @@ -412,8 +420,14 @@ export const tools = { SelectListFormatPDF: [ { label: 'a4 (210x297) (mm) 793x1121 px', value: [210, 297] }, - { label: 'STAMPA con Bordi: 22.53 x 31.26 96 DPI (in mm) 852x1181 px', value: [225.3, 312.6] }, - { label: 'STAMPA MODIF: 22.533 x 31.23 96 DPI (in mm) 852x1181 px', value: [225.33, 312.23] }, + { + label: 'STAMPA con Bordi: 22.53 x 31.26 96 DPI (in mm) 852x1181 px', + value: [225.3, 312.6], + }, + { + label: 'STAMPA MODIF: 22.533 x 31.23 96 DPI (in mm) 852x1181 px', + value: [225.33, 312.23], + }, ], SelectListScalePDF: [ @@ -2291,7 +2305,12 @@ export const tools = { return index >= 0 && index < myarr.length; }, - async swapGeneralElem(nametable: string, myarr: any, itemdragend: any, listFieldsToChange: any) { + async swapGeneralElem( + nametable: string, + myarr: any, + itemdragend: any, + listFieldsToChange: any + ) { const arrprec = [...myarr]; if (itemdragend.field === 'priority') { @@ -2384,7 +2403,12 @@ export const tools = { if (findelem !== myarr[i].pos) { myarr[i].modified = true; - await ApiTables.table_ModifyRecord(nametable, myarr[i], listFieldsToChange, 'pos'); + await ApiTables.table_ModifyRecord( + nametable, + myarr[i], + listFieldsToChange, + 'pos' + ); } } } @@ -2402,7 +2426,12 @@ export const tools = { if (findelem !== myarr[i].pos) { myarr[i].modified = true; - await ApiTables.table_ModifyRecord(nametable, myarr[i], listFieldsToChange, 'pos'); + await ApiTables.table_ModifyRecord( + nametable, + myarr[i], + listFieldsToChange, + 'pos' + ); } } } @@ -2590,7 +2619,12 @@ export const tools = { return myarr.find((elem: any) => elem.id_prev === id); }, - getLastFirstElemPriority(myarr: any, priority: number, atfirst: boolean, escludiId: string) { + getLastFirstElemPriority( + myarr: any, + priority: number, + atfirst: boolean, + escludiId: string + ) { if (myarr === null) { return -1; } @@ -2719,7 +2753,13 @@ export const tools = { return visu; }, - executefunc(mythisq: any, table: string, func: number, par: IParamDialog, mythis?: any) { + executefunc( + mythisq: any, + table: string, + func: number, + par: IParamDialog, + mythis?: any + ) { const globalStore = useGlobalStore(); const calendarStore = useCalendarStore(); //T_TOLTO @@ -2733,7 +2773,10 @@ export const tools = { }) .then((ris: any) => { if (ris) { - this.showPositiveNotif(mythisq, t('cal.canceledbooking') + ' "' + par.param3 + '"'); + this.showPositiveNotif( + mythisq, + t('cal.canceledbooking') + ' "' + par.param3 + '"' + ); } else { this.showNegativeNotif(mythisq, t('cal.cancelederrorbooking')); } @@ -2746,7 +2789,10 @@ export const tools = { calendarStore.eventlist = calendarStore.eventlist.filter( (event: IEvents) => event._id !== par.param1._id ); - this.showPositiveNotif(mythisq, t('cal.canceledevent') + ' "' + par.param1.title + '"'); + this.showPositiveNotif( + mythisq, + t('cal.canceledevent') + ' "' + par.param1.title + '"' + ); } else { this.showNegativeNotif(mythisq, t('cal.cancelederrorevent')); } @@ -3416,7 +3462,12 @@ export const tools = { } }, - getstrDateTimeEvent($t: any, myevent: IEvents, withhtml: boolean, acapo: boolean = false) { + getstrDateTimeEvent( + $t: any, + myevent: IEvents, + withhtml: boolean, + acapo: boolean = false + ) { let mystr = ''; // is same day? if (this.getstrDate(myevent.dateTimeStart) === this.getstrDate(myevent.dateTimeEnd)) { @@ -3461,7 +3512,10 @@ export const tools = { getstrDateTimeEventSimple(myevent: IEvents) { let mystr = ''; // is same day? - if (this.getstrShortDate(myevent.dateTimeStart) === this.getstrShortDate(myevent.dateTimeEnd)) { + if ( + this.getstrShortDate(myevent.dateTimeStart) === + this.getstrShortDate(myevent.dateTimeEnd) + ) { mystr = `${this.getstrShortDate(myevent.dateTimeStart)} - ${this.getstrTime(myevent.dateTimeStart)}`; } else { @@ -3474,7 +3528,10 @@ export const tools = { getstrDateTimeEventShort(myevent: IEvents) { let mystr = ''; // is same day? - if (this.getstrShortDate(myevent.dateTimeStart) === this.getstrShortDate(myevent.dateTimeEnd)) { + if ( + this.getstrShortDate(myevent.dateTimeStart) === + this.getstrShortDate(myevent.dateTimeEnd) + ) { mystr = `${this.getstrVeryShortDate(myevent.dateTimeStart)} h. ${this.getstrTime(myevent.dateTimeStart)}`; } else { @@ -3671,11 +3728,27 @@ export const tools = { const myday: any = { it: ['Domenica', 'Lunedì', 'Martedì', 'Mercoledì', 'Giovedì', 'Venerdì', 'Sabato'], - enUs: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], + enUs: [ + 'Sunday', + 'Monday', + 'Tuesday', + 'Wednesday', + 'Thursday', + 'Friday', + 'Saturday', + ], fr: ['Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi'], es: ['Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado'], pt: ['Domingo', 'Segunda', 'Terça', 'Quarta', 'Quinta', 'Sexta', 'Sábado'], - de: ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'], + de: [ + 'Sonntag', + 'Montag', + 'Dienstag', + 'Mittwoch', + 'Donnerstag', + 'Freitag', + 'Samstag', + ], si: ['Nedelja', 'Ponedeljek', 'Torek', 'Sreda', 'četrtek', 'Petek', 'Sobota'], }; @@ -3978,7 +4051,10 @@ export const tools = { isUserOnline(user: IUserFields, col: any = null) { try { const dateonline = this.addDays(this.getDateNow(), -1); - return user.lasttimeonline && new Date(user.lasttimeonline).getTime() > dateonline.getTime(); + return ( + user.lasttimeonline && + new Date(user.lasttimeonline).getTime() > dateonline.getTime() + ); } catch (e) { return false; } @@ -4009,7 +4085,8 @@ export const tools = { }, gettitlemain(datamain: ITimeLineMain) { - if (datamain.titlemain[toolsext.getLocale()]) return datamain.titlemain[toolsext.getLocale()]; + if (datamain.titlemain[toolsext.getLocale()]) + return datamain.titlemain[toolsext.getLocale()]; else { return datamain.titlemain[static_data.arrLangUsed[0]]; } @@ -4035,7 +4112,8 @@ export const tools = { }, gettextdescr(data: { [index: string]: any }, numdescr = 'description') { if (data[numdescr]) { - if (data[numdescr][toolsext.getLocale()]) return data[numdescr][toolsext.getLocale()]; + if (data[numdescr][toolsext.getLocale()]) + return data[numdescr][toolsext.getLocale()]; else { return data[numdescr][static_data.arrLangUsed[0]]; } @@ -4284,7 +4362,10 @@ export const tools = { } else if (riscode === serv_constants.RIS_CODE_REC_ALREADY_EXIST_SYMBOL) { this.showNegativeNotif(mythisq, t('reg.err.rec_already_exist_symbol') + ' ' + msg); } else if (riscode === serv_constants.RIS_CODE_REC_DUPLICATED_DESCR_CITY_USER) { - this.showNegativeNotif(mythisq, t('reg.err.rec_duplicated_descr_city_user') + ' ' + msg); + this.showNegativeNotif( + mythisq, + t('reg.err.rec_duplicated_descr_city_user') + ' ' + msg + ); } }, @@ -4370,7 +4451,12 @@ export const tools = { } return s; }, - CancelBookingEvent(mythisq: any, eventparam: IEvents, bookeventid: string, notify: boolean) { + CancelBookingEvent( + mythisq: any, + eventparam: IEvents, + bookeventid: string, + notify: boolean + ) { console.log('CancelBookingEvent ', eventparam); this.askConfirm( mythisq, @@ -4688,7 +4774,8 @@ export const tools = { }, getWssUrl(): string | URL { const myurl = import.meta.env.VITE_APP_URL; - if (myurl) return myurl.replace(/(https?:\/\/[^:]+):\d+/, `$1:3000`).replace(/^http/, 'wss'); + if (myurl) + return myurl.replace(/(https?:\/\/[^:]+):\d+/, `$1:3000`).replace(/^http/, 'wss'); else return ''; }, getheaders() { @@ -4720,7 +4807,8 @@ export const tools = { isChristmasHoliday() { const now = new Date(); return ( - (now.getMonth() === 11 && now.getDate() > 20) || (now.getMonth() === 0 && now.getDate() < 8) + (now.getMonth() === 11 && now.getDate() > 20) || + (now.getMonth() === 0 && now.getDate() < 8) ); }, @@ -4800,7 +4888,9 @@ export const tools = { }, heightgallvideo() { - const h = this.heightgallery(this.getValDb('YT_W', false) / this.getValDb('YT_H', false)); + const h = this.heightgallery( + this.getValDb('YT_W', false) / this.getValDb('YT_H', false) + ); return h; }, @@ -5860,7 +5950,9 @@ export const tools = { if (item.minLength !== undefined) { if (item.minLength.$invalid) { - return t('reg.err.atleast') + ` ${item.minLength.$params.min} ` + t('reg.err.char'); + return ( + t('reg.err.atleast') + ` ${item.minLength.$params.min} ` + t('reg.err.char') + ); } } if (item.complexity !== undefined) { @@ -5974,7 +6066,9 @@ export const tools = { return res.status === PayloadMessageTypes.statusfound; }; - return Axios.get(VALIDATE_USER_URL + '/users/' + this.getEnv('VITE_APP_ID') + '/' + username) + return Axios.get( + VALIDATE_USER_URL + '/users/' + this.getEnv('VITE_APP_ID') + '/' + username + ) .then(onSuccess) .catch((err) => { return false; @@ -5998,7 +6092,14 @@ export const tools = { title: t('db.domanda'), }).onOk(() => { userStore - .setFriendsCmd($q, t, username, usernameDest, shared_consts.FRIENDSCMD.SETFRIEND, null) + .setFriendsCmd( + $q, + t, + username, + usernameDest, + shared_consts.FRIENDSCMD.SETFRIEND, + null + ) .then((res: any) => { if (res) { notifStore.updateNotification = true; @@ -6026,16 +6127,31 @@ export const tools = { title: t('db.domanda'), }).onOk(() => { userStore - .setFriendsCmd($q, t, username, usernameDest, shared_consts.FRIENDSCMD.SETTRUST, value) + .setFriendsCmd( + $q, + t, + username, + usernameDest, + shared_consts.FRIENDSCMD.SETTRUST, + value + ) .then((res: any) => { if (res) { - userStore.my.profile.userstoverify = userStore.my.profile.userstoverify.filter( - (rec: any) => rec.username !== usernameDest - ); + userStore.my.profile.userstoverify = + userStore.my.profile.userstoverify.filter( + (rec: any) => rec.username !== usernameDest + ); if (value) - this.showPositiveNotif($q, t('db.enabled_to_app', { username: usernameDest })); - else this.showNegativeNotif($q, t('db.rejected_to_app', { username: usernameDest })); + this.showPositiveNotif( + $q, + t('db.enabled_to_app', { username: usernameDest }) + ); + else + this.showNegativeNotif( + $q, + t('db.rejected_to_app', { username: usernameDest }) + ); } }); }); @@ -6084,7 +6200,14 @@ export const tools = { title: t('handshake.strettadimano'), }).onOk(() => { userStore - .setFriendsCmd($q, t, username, usernameDest, shared_consts.FRIENDSCMD.SETHANDSHAKE, null) + .setFriendsCmd( + $q, + t, + username, + usernameDest, + shared_consts.FRIENDSCMD.SETHANDSHAKE, + null + ) .then((res: any) => { if (res) { notifStore.updateNotification = true; @@ -6137,7 +6260,14 @@ export const tools = { title: t('db.domanda'), }).onOk(() => { userStore - .setFriendsCmd($q, t, username, usernameDest, shared_consts.FRIENDSCMD.BLOCK_USER, null) + .setFriendsCmd( + $q, + t, + username, + usernameDest, + shared_consts.FRIENDSCMD.BLOCK_USER, + null + ) .then((res: any) => { if (res) { userStore.my.profile.friends = userStore.my.profile.friends.filter( @@ -6159,7 +6289,14 @@ export const tools = { title: t('db.domanda'), }).onOk(() => { userStore - .setFriendsCmd($q, t, username, usernameDest, shared_consts.FRIENDSCMD.UNBLOCK_USER, null) + .setFriendsCmd( + $q, + t, + username, + usernameDest, + shared_consts.FRIENDSCMD.UNBLOCK_USER, + null + ) .then((res: any) => { if (res) { this.showPositiveNotif($q, t('db.unblockedfriend')); @@ -6179,7 +6316,14 @@ export const tools = { title: t('db.domanda'), }).onOk(() => { userStore - .setFriendsCmd($q, t, username, usernameDest, shared_consts.FRIENDSCMD.REPORT_USER, null) + .setFriendsCmd( + $q, + t, + username, + usernameDest, + shared_consts.FRIENDSCMD.REPORT_USER, + null + ) .then((res: any) => { if (res) { this.showPositiveNotif($q, t('db.reporteduser')); @@ -6266,7 +6410,10 @@ export const tools = { notifStore.updateNotification = true; if (res.circuit) { if (userStore.my.profile.mycircuits) - userStore.my.profile.mycircuits = [...userStore.my.profile.mycircuits, res.circuit]; + userStore.my.profile.mycircuits = [ + ...userStore.my.profile.mycircuits, + res.circuit, + ]; else userStore.my.profile.mycircuits = [res]; } this.showPositiveNotif($q, t('db.addedcircuit', { circuitname })); @@ -6305,7 +6452,10 @@ export const tools = { notifStore.updateNotification = true; if (res.circuit) { if (userStore.my.profile.mycircuits) - userStore.my.profile.mycircuits = [...userStore.my.profile.mycircuits, res.circuit]; + userStore.my.profile.mycircuits = [ + ...userStore.my.profile.mycircuits, + res.circuit, + ]; else userStore.my.profile.mycircuits = [res]; } this.showPositiveNotif($q, t('db.addedcircuit', { circuitname })); @@ -6345,7 +6495,10 @@ export const tools = { notifStore.updateNotification = true; if (res.circuit) { if (userStore.my.profile.mycircuits) - userStore.my.profile.mycircuits = [...userStore.my.profile.mycircuits, res.circuit]; + userStore.my.profile.mycircuits = [ + ...userStore.my.profile.mycircuits, + res.circuit, + ]; else userStore.my.profile.mycircuits = [res]; } this.showPositiveNotif($q, t('db.addedfidocircuit', { circuitname })); @@ -6384,7 +6537,10 @@ export const tools = { notifStore.updateNotification = true; if (res.circuit) { if (userStore.my.profile.mycircuits) - userStore.my.profile.mycircuits = [...userStore.my.profile.mycircuits, res.circuit]; + userStore.my.profile.mycircuits = [ + ...userStore.my.profile.mycircuits, + res.circuit, + ]; else userStore.my.profile.mycircuits = [res]; } this.showPositiveNotif($q, t('db.addedfidocircuit', { circuitname })); @@ -6407,7 +6563,14 @@ export const tools = { title: t('db.domanda'), }).onOk(() => { userStore - .setGroupsCmd($q, t, username, groupnameDest, shared_consts.GROUPSCMD.SETGROUP, true) + .setGroupsCmd( + $q, + t, + username, + groupnameDest, + shared_consts.GROUPSCMD.SETGROUP, + true + ) .then((res: any) => { if (res) { notifStore.updateNotification = true; @@ -6502,9 +6665,10 @@ export const tools = { if (res) { notifStore.updateNotification = true; if (username === userStore.my.username) { - userStore.my.profile.asked_groups = userStore.my.profile.asked_groups.filter( - (rec: IGroupShort) => rec.groupname !== groupnameDest - ); + userStore.my.profile.asked_groups = + userStore.my.profile.asked_groups.filter( + (rec: IGroupShort) => rec.groupname !== groupnameDest + ); } this.showPositiveNotif($q, t('db.refusedgroup', { username })); } @@ -6523,7 +6687,14 @@ export const tools = { title: t('db.domanda'), }).onOk(() => { userStore - .setGroupsCmd($q, t, username, usernameDest, shared_consts.GROUPSCMD.BLOCK_GROUP, null) + .setGroupsCmd( + $q, + t, + username, + usernameDest, + shared_consts.GROUPSCMD.BLOCK_GROUP, + null + ) .then((res) => { if (res) { userStore.my.profile.mygroups = userStore.my.profile.mygroups.filter( @@ -6535,7 +6706,12 @@ export const tools = { }); }, - removeFromMyGroups($q: any, username: string, groupnameDest: string, domanda: any = '') { + removeFromMyGroups( + $q: any, + username: string, + groupnameDest: string, + domanda: any = '' + ) { const userStore = useUserStore(); //T_TOLTO @@ -6569,12 +6745,19 @@ export const tools = { }); }, - addtoAdminOfMyGroup($q: any, username: string, groupnameDest: string, domanda: any = '') { + addtoAdminOfMyGroup( + $q: any, + username: string, + groupnameDest: string, + domanda: any = '' + ) { const userStore = useUserStore(); //T_TOLTO $q.dialog({ - message: domanda ? domanda : t('db.domanda_addadminofmygroup', { username, groupnameDest }), + message: domanda + ? domanda + : t('db.domanda_addadminofmygroup', { username, groupnameDest }), ok: { label: t('dialog.yes'), push: true }, cancel: { label: t('dialog.cancel') }, title: t('db.domanda'), @@ -6604,7 +6787,12 @@ export const tools = { }); }, - removeAdminOfMyGroup($q: any, username: string, groupnameDest: string, domanda: any = '') { + removeAdminOfMyGroup( + $q: any, + username: string, + groupnameDest: string, + domanda: any = '' + ) { const userStore = useUserStore(); //T_TOLTO @@ -6646,13 +6834,22 @@ export const tools = { //T_TOLTO $q.dialog({ - message: domanda ? domanda : t('db.domanda_remove_group', { groupname: groupnameDest }), + message: domanda + ? domanda + : t('db.domanda_remove_group', { groupname: groupnameDest }), ok: { label: t('dialog.yes'), push: true }, cancel: { label: t('dialog.cancel') }, title: t('db.domanda'), }).onOk(() => { userStore - .setGroupsCmd($q, t, username, groupnameDest, shared_consts.GROUPSCMD.DELETE_GROUP, null) + .setGroupsCmd( + $q, + t, + username, + groupnameDest, + shared_consts.GROUPSCMD.DELETE_GROUP, + null + ) .then((res) => { if (res) { if (userStore.my.profile.mygroups) { @@ -6689,19 +6886,33 @@ export const tools = { title: t('db.domanda'), }).onOk(() => { userStore - .setFriendsCmd($q, t, username, usernameDest, shared_consts.FRIENDSCMD.REQFRIEND, value) + .setFriendsCmd( + $q, + t, + username, + usernameDest, + shared_consts.FRIENDSCMD.REQFRIEND, + value + ) .then((res: any) => { if (res) { if (value) { // ADD to req Friends userStore.my.profile.asked_friends.push(res); - this.showPositiveNotif($q, t('db.askedtofriend', { username: usernameDest })); + this.showPositiveNotif( + $q, + t('db.askedtofriend', { username: usernameDest }) + ); } else { // REMOVE to req Friends - userStore.my.profile.asked_friends = userStore.my.profile.asked_friends.filter( - (rec: IUserFields) => rec.username !== usernameDest + userStore.my.profile.asked_friends = + userStore.my.profile.asked_friends.filter( + (rec: IUserFields) => rec.username !== usernameDest + ); + this.showPositiveNotif( + $q, + t('db.revoketofriend', { username: usernameDest }) ); - this.showPositiveNotif($q, t('db.revoketofriend', { username: usernameDest })); } } else { this.showNegativeNotif($q, t('db.recfailed')); @@ -6734,15 +6945,28 @@ export const tools = { title: t('db.domanda'), }).onOk(() => { userStore - .setFriendsCmd($q, t, username, usernameDest, shared_consts.FRIENDSCMD.SETHANDSHAKE, value) + .setFriendsCmd( + $q, + t, + username, + usernameDest, + shared_consts.FRIENDSCMD.SETHANDSHAKE, + value + ) .then((res: any) => { if (res) { if (value) { // ADD to req HandShake - this.showPositiveNotif($q, t('db.askedtohandshake', { username: usernameDest })); + this.showPositiveNotif( + $q, + t('db.askedtohandshake', { username: usernameDest }) + ); } else { // REMOVE to req HandShake - this.showPositiveNotif($q, t('db.revoketohandshake', { username: usernameDest })); + this.showPositiveNotif( + $q, + t('db.revoketohandshake', { username: usernameDest }) + ); } } else { this.showNegativeNotif($q, t('db.recfailed')); @@ -6758,7 +6982,14 @@ export const tools = { const username = userStore.my.username; userStore - .setSendCmd($q, t, username, usernameDest, shared_consts.CallFunz.ENTRA_RIS_ITALIA, null) + .setSendCmd( + $q, + t, + username, + usernameDest, + shared_consts.CallFunz.ENTRA_RIS_ITALIA, + null + ) .then((res: any) => { if (res && res.result) { this.updateMyData(res); @@ -6791,19 +7022,33 @@ export const tools = { title: t('db.domanda'), }).onOk(() => { userStore - .setGroupsCmd($q, t, username, groupnameDest, shared_consts.GROUPSCMD.REQGROUP, value) + .setGroupsCmd( + $q, + t, + username, + groupnameDest, + shared_consts.GROUPSCMD.REQGROUP, + value + ) .then((res: any) => { if (res) { if (value) { // ADD to req Friends userStore.my.profile.asked_groups.push(res); - this.showPositiveNotif($q, t('db.askedtogroup', { groupname: groupnameDest })); + this.showPositiveNotif( + $q, + t('db.askedtogroup', { groupname: groupnameDest }) + ); } else { // REMOVE to req Friends - userStore.my.profile.asked_groups = userStore.my.profile.asked_groups.filter( - (rec: IGroupShort) => rec.groupname !== groupnameDest + userStore.my.profile.asked_groups = + userStore.my.profile.asked_groups.filter( + (rec: IGroupShort) => rec.groupname !== groupnameDest + ); + this.showPositiveNotif( + $q, + t('db.revoketogroup', { groupname: groupnameDest }) ); - this.showPositiveNotif($q, t('db.revoketogroup', { groupname: groupnameDest })); } } else { this.showNegativeNotif($q, t('db.recfailed')); @@ -6831,9 +7076,10 @@ export const tools = { ) .then((res) => { if (res) { - userStore.my.profile.asked_friends = userStore.my.profile.asked_friends.filter( - (rec: IUserFields) => rec.username !== usernameDest - ); + userStore.my.profile.asked_friends = + userStore.my.profile.asked_friends.filter( + (rec: IUserFields) => rec.username !== usernameDest + ); this.showPositiveNotif($q, t('db.cancel_req_friend')); } }); @@ -6863,9 +7109,10 @@ export const tools = { .then((res) => { if (res) { if (username === userStore.my.username) { - userStore.my.profile.asked_groups = userStore.my.profile.asked_groups.filter( - (rec: IGroupShort) => rec.groupname !== groupnameDest - ); + userStore.my.profile.asked_groups = + userStore.my.profile.asked_groups.filter( + (rec: IGroupShort) => rec.groupname !== groupnameDest + ); } this.showPositiveNotif($q, t('db.cancel_req_group')); } @@ -7055,9 +7302,10 @@ export const tools = { this.showPositiveNotif($q, msg); } else { // REMOVE to req - userStore.my.profile.asked_circuits = userStore.my.profile.asked_circuits.filter( - (rec: ICircuit) => rec.name !== circuitname - ); + userStore.my.profile.asked_circuits = + userStore.my.profile.asked_circuits.filter( + (rec: ICircuit) => rec.name !== circuitname + ); this.showPositiveNotif($q, t('circuit.revoketo', { circuitname })); } @@ -7084,7 +7332,12 @@ export const tools = { : extrarec.sender; }, - async sendCoinsByCircuit($q: any, $router: any, circuit: ICircuit, sendcoinrec: ISendCoin) { + async sendCoinsByCircuit( + $q: any, + $router: any, + circuit: ICircuit, + sendcoinrec: ISendCoin + ) { const userStore = useUserStore(); const notifStore = useNotifStore(); //T_TOLTO @@ -7181,15 +7434,24 @@ export const tools = { title: t('db.domanda'), }).onOk(() => { userStore - .setCircuitCmd($q, t, username, circuitname, shared_consts.CIRCUITCMD.CANCEL_REQ, null, { - groupname, - }) + .setCircuitCmd( + $q, + t, + username, + circuitname, + shared_consts.CIRCUITCMD.CANCEL_REQ, + null, + { + groupname, + } + ) .then((res) => { if (res && res.result) { if (username === userStore.my.username) { - userStore.my.profile.asked_circuits = userStore.my.profile.asked_circuits.filter( - (rec: ICircuit) => rec.name !== circuitname - ); + userStore.my.profile.asked_circuits = + userStore.my.profile.asked_circuits.filter( + (rec: ICircuit) => rec.name !== circuitname + ); } this.updateMyData(res); this.showPositiveNotif($q, t('circuit.cancel_req', { circuitname })); @@ -7209,16 +7471,25 @@ export const tools = { title: t('db.domanda'), }).onOk(() => { userStore - .setCircuitCmd($q, t, username, circuitname, shared_consts.CIRCUITCMD.REFUSE_REQ, null, { - groupname, - }) + .setCircuitCmd( + $q, + t, + username, + circuitname, + shared_consts.CIRCUITCMD.REFUSE_REQ, + null, + { + groupname, + } + ) .then((res) => { if (res && res.result) { notifStore.updateNotification = true; if (username === userStore.my.username) { - userStore.my.profile.asked_circuits = userStore.my.profile.asked_circuits.filter( - (rec: ICircuit) => rec.name !== circuitname - ); + userStore.my.profile.asked_circuits = + userStore.my.profile.asked_circuits.filter( + (rec: ICircuit) => rec.name !== circuitname + ); } this.showPositiveNotif($q, t('circuit.refusedcircuit', { username })); this.updateMyData(res); @@ -7292,7 +7563,14 @@ export const tools = { title: t('db.domanda'), }).onOk(() => { userStore - .setCircuitCmd($q, t, username, circuitname, shared_consts.CIRCUITCMD.ADDADMIN, null) + .setCircuitCmd( + $q, + t, + username, + circuitname, + shared_consts.CIRCUITCMD.ADDADMIN, + null + ) .then((res) => { if (res && res.result) { const mycircuit = userStore.my.profile.manage_mycircuits.find( @@ -7310,7 +7588,12 @@ export const tools = { }); }, - removeAdminOfCircuit($q: any, username: string, circuitname: string, domanda: any = '') { + removeAdminOfCircuit( + $q: any, + username: string, + circuitname: string, + domanda: any = '' + ) { const userStore = useUserStore(); //T_TOLTO @@ -7323,7 +7606,14 @@ export const tools = { title: t('db.domanda'), }).onOk(() => { userStore - .setCircuitCmd($q, t, username, circuitname, shared_consts.CIRCUITCMD.REMOVEADMIN, null) + .setCircuitCmd( + $q, + t, + username, + circuitname, + shared_consts.CIRCUITCMD.REMOVEADMIN, + null + ) .then((res) => { if (res && res.result) { const mygrp = userStore.my.profile.manage_mycircuits.find( @@ -7352,7 +7642,14 @@ export const tools = { title: t('db.domanda'), }).onOk(() => { userStore - .setCircuitCmd($q, t, username, circuitname, shared_consts.CIRCUITCMD.DELETE, null) + .setCircuitCmd( + $q, + t, + username, + circuitname, + shared_consts.CIRCUITCMD.DELETE, + null + ) .then((res) => { if (res && res.result) { if (userStore.my.profile.manage_mycircuits) { @@ -7431,8 +7728,9 @@ export const tools = { iAmPartOfThisGroup(grp: IMyGroup) { const userStore = useUserStore(); return ( - userStore.my.profile.mygroups.findIndex((rec: IMyGroup) => rec.groupname === grp.groupname) >= - 0 + userStore.my.profile.mygroups.findIndex( + (rec: IMyGroup) => rec.groupname === grp.groupname + ) >= 0 ); }, @@ -7605,7 +7903,12 @@ export const tools = { //T_TOLTO console.log('setcmd', cmd); if (cmd === shared_consts.GROUPSCMD.REMOVE_FROM_MYGROUP) { - this.removeFromMyGroups($q, username, dest, t('db.domanda_exit_fromgroup', { username })); + this.removeFromMyGroups( + $q, + username, + dest, + t('db.domanda_exit_fromgroup', { username }) + ); } else if (cmd === shared_consts.GROUPSCMD.DELETE_GROUP) { this.DeleteGroup($q, username, dest); } else if (cmd === shared_consts.GROUPSCMD.BLOCK_GROUP) { @@ -7806,7 +8109,11 @@ export const tools = { idCity: this.getCitySel(), NumLevel: 0, adType: this.getSelectionByTable('adtypes', costanti.AdType.OFFRO), - pub_to_share: this.getSelectionByTable('pub_to_share', shared_consts.PUBTOSHARE.ALL, true), + pub_to_share: this.getSelectionByTable( + 'pub_to_share', + shared_consts.PUBTOSHARE.ALL, + true + ), photos: [], note: '', //**ADDFIELD_MYSKILL @@ -7836,7 +8143,11 @@ export const tools = { adType: this.getSelectionByTable('adtypes', costanti.AdType.OFFRO), idShipping: this.getSelectionByTable('shippings', []), otherfilters: this.getSelectionByTable('otherfilters', []), - pub_to_share: this.getSelectionByTable('pub_to_share', shared_consts.PUBTOSHARE.ALL, true), + pub_to_share: this.getSelectionByTable( + 'pub_to_share', + shared_consts.PUBTOSHARE.ALL, + true + ), photos: [], note: '', //**ADDFIELD_MYSKILL @@ -7889,8 +8200,10 @@ export const tools = { qta_max_default: 200, fido_scoperto_default_grp: shared_consts.CIRCUIT_PARAMS.SCOPERTO_MIN_GRP, qta_max_default_grp: shared_consts.CIRCUIT_PARAMS.SCOPERTO_MAX_GRP, - fido_scoperto_default_contocom: shared_consts.CIRCUIT_PARAMS.SCOPERTO_MIN_CONTO_COMUNITARIO, - qta_max_default_contocom: shared_consts.CIRCUIT_PARAMS.SCOPERTO_MAX_CONTO_COMUNITARIO, + fido_scoperto_default_contocom: + shared_consts.CIRCUIT_PARAMS.SCOPERTO_MIN_CONTO_COMUNITARIO, + qta_max_default_contocom: + shared_consts.CIRCUIT_PARAMS.SCOPERTO_MAX_CONTO_COMUNITARIO, valuta_per_euro: 1, totTransato: 0, totCircolante: 0, @@ -7916,7 +8229,11 @@ export const tools = { idCity: this.getCitySel(), NumLevel: 0, adType: this.getSelectionByTable('adtypes', costanti.AdType.OFFRO), - pub_to_share: this.getSelectionByTable('pub_to_share', shared_consts.PUBTOSHARE.ALL, true), + pub_to_share: this.getSelectionByTable( + 'pub_to_share', + shared_consts.PUBTOSHARE.ALL, + true + ), photos: [], note: '', organisedBy: this.getSelectionByTable('organisedBy', ''), @@ -7940,7 +8257,11 @@ export const tools = { idContribType: this.getSelectionByTable('contribtypes', []), accomodation: [], idCity: this.getCitySel(), - pub_to_share: this.getSelectionByTable('pub_to_share', shared_consts.PUBTOSHARE.ALL, true), + pub_to_share: this.getSelectionByTable( + 'pub_to_share', + shared_consts.PUBTOSHARE.ALL, + true + ), photos: [], descr: '', note: '', @@ -7949,7 +8270,12 @@ export const tools = { }; }, - getFullFileName(arrimage: IImgGallery[], table: string, username: string, groupname: string) { + getFullFileName( + arrimage: IImgGallery[], + table: string, + username: string, + groupname: string + ) { // console.log('arrimage', arrimage) if (shared_consts.TABLES_DIRECTORY_A_PARTE.includes(table)) { @@ -7959,7 +8285,9 @@ export const tools = { } else { // console.log('username', username, 'table', table) if (arrimage && arrimage.length > 0) { - return this.getDirUpload() + `profile/${username}/${table}/` + arrimage[0]?.imagefile; + return ( + this.getDirUpload() + `profile/${username}/${table}/` + arrimage[0]?.imagefile + ); } else { return ''; } @@ -8000,7 +8328,9 @@ export const tools = { // is Admin ? if (rec.admins) { - const trovato = rec.admins.find((myuser: any) => myuser.username === userStore.my.username); + const trovato = rec.admins.find( + (myuser: any) => myuser.username === userStore.my.username + ); if (trovato) { return !!trovato; } @@ -8026,7 +8356,10 @@ export const tools = { getPathByGroup(grp: any) { return ( - '/' + shared_consts.getDirectoryByTable(shared_consts.TABLES_MYGROUPS) + '/' + grp.groupname + '/' + + shared_consts.getDirectoryByTable(shared_consts.TABLES_MYGROUPS) + + '/' + + grp.groupname ); }, @@ -8236,12 +8569,16 @@ export const tools = { console.log('loadGroupsByUsername ', ris); if (ris) { userStore.my.profile.mygroups = ris.mygroups ? ris.mygroups : []; - userStore.my.profile.list_usersgroup = ris.listUsersGroup ? ris.listUsersGroup : []; + userStore.my.profile.list_usersgroup = ris.listUsersGroup + ? ris.listUsersGroup + : []; userStore.groups = ris.listgroups ? ris.listgroups : []; userStore.my.profile.asked_groups = ris.listSentRequestGroups ? ris.listSentRequestGroups : []; - userStore.my.profile.refused_groups = ris.listRefusedGroups ? ris.listRefusedGroups : []; + userStore.my.profile.refused_groups = ris.listRefusedGroups + ? ris.listRefusedGroups + : []; return [{ userId: userStore.my._id }]; } }); @@ -8265,8 +8602,12 @@ export const tools = { // Others not loaded at the beginning: - userStore.my.profile.asked_circuits = ris.asked_circuits ? ris.asked_circuits : []; - userStore.my.profile.refused_circuits = ris.refused_circuits ? ris.refused_circuits : []; + userStore.my.profile.asked_circuits = ris.asked_circuits + ? ris.asked_circuits + : []; + userStore.my.profile.refused_circuits = ris.refused_circuits + ? ris.refused_circuits + : []; userStore.my.profile.last_my_transactions = ris.last_my_transactions ? ris.last_my_transactions : []; @@ -8335,7 +8676,9 @@ export const tools = { for (const rec of myrec) { mystr += rec.username + sep; mystr += rec.profile.username_telegram + sep; - mystr += rec.profile.firstname_telegram ? rec.profile.firstname_telegram + sep : sep; + mystr += rec.profile.firstname_telegram + ? rec.profile.firstname_telegram + sep + : sep; mystr += rec.profile.lastname_telegram ? rec.profile.lastname_telegram + sep : sep; mystr += rec.email + sep; mystr += (rec.profile.teleg_id ? 'SI' : 'NO') + sep; @@ -8393,7 +8736,8 @@ export const tools = { getArrSector(table: string, rec: any) { if (table === toolsext.TABMYGOODS) return rec.sectorGood; - else if (table === toolsext.TABMYBACHECAS || table === toolsext.TABMYSKILLS) return rec.sector; + else if (table === toolsext.TABMYBACHECAS || table === toolsext.TABMYSKILLS) + return rec.sector; else if (table === toolsext.TABMYGROUPS) return [{ descr: rec.sector }]; else if (table === toolsext.TABMYHOSPS) return []; }, @@ -8640,7 +8984,9 @@ export const tools = { addtourl = '?v=' + reccard.vers_img; } - return this.getDirUpload() + 'pages/' + mypath + '/' + reccard.imagefile + addtourl; + return ( + this.getDirUpload() + 'pages/' + mypath + '/' + reccard.imagefile + addtourl + ); } else return ''; } else if (elem.type === shared_consts.ELEMTYPE.IMAGE) { return this.getDirUpload() + 'pages/' + mypath + '/' + elem.container + addtourl; @@ -8672,7 +9018,8 @@ export const tools = { const globalStore = useGlobalStore(); if (newval) { - if (globalStore.site && globalStore.site.confpages) globalStore.site.confpages.font = newval; + if (globalStore.site && globalStore.site.confpages) + globalStore.site.confpages.font = newval; } for (const myfont of shared_consts.FontsInstalled) { @@ -8707,7 +9054,12 @@ export const tools = { if (field) { const mycol = fieldsTable.getColByTable(tablesel, field); if (mycol) { - console.log('remote_table = ', mycol.remote_table, 'remote_key', mycol.remote_key); + console.log( + 'remote_table = ', + mycol.remote_table, + 'remote_key', + mycol.remote_key + ); console.log('ROW', row); return this.getValueByRemoteField(mycol, row); } @@ -8766,7 +9118,10 @@ export const tools = { let displayMode = 'browser'; const mqStandAlone = '(display-mode: standalone)'; // @ts-ignore - if ((navigator && navigator.standalone) || window.matchMedia(mqStandAlone).matches) { + if ( + (navigator && navigator.standalone) || + window.matchMedia(mqStandAlone).matches + ) { // console.log('navigator.standalone') displayMode = 'standalone'; } @@ -8808,21 +9163,29 @@ export const tools = { }, getStrByParamTypeAccount(paramTypeAccount: string): string { - const myrec = costanti.ParamTypeAccountStr.find((rec: any) => rec.value === paramTypeAccount); + const myrec = costanti.ParamTypeAccountStr.find( + (rec: any) => rec.value === paramTypeAccount + ); return myrec ? translate(myrec.labeltrans) : ''; }, getTypeByParamTypeAccount(paramTypeAccount: string): number { - const myrec = costanti.ParamTypeAccountStr.find((rec: any) => rec.value === paramTypeAccount); + const myrec = costanti.ParamTypeAccountStr.find( + (rec: any) => rec.value === paramTypeAccount + ); return myrec ? myrec.type : 0; }, getFieldByParamTypeAccount(paramTypeAccount: string): string { - const myrec = costanti.ParamTypeAccountStr.find((rec: any) => rec.value === paramTypeAccount); + const myrec = costanti.ParamTypeAccountStr.find( + (rec: any) => rec.value === paramTypeAccount + ); return myrec ? myrec.field : ''; }, getNomeUtenteByRecUser(user: IUserFields) { - return user.name ? user.name + ' ' + (user.surname ? user.surname : '') : user.username; + return user.name + ? user.name + ' ' + (user.surname ? user.surname : '') + : user.username; }, getNomeUtenteEUsernameByRecUser(user: IUserFields) { @@ -8879,7 +9242,11 @@ export const tools = { await userStore.setUserReceiveRIS('', groupname).then((data) => { if (data.code === serv_constants.RIS_CODE_OK) { - this.showPositiveNotif($q, t('circuit.coins_requestedrisgroup', { groupname }), 6000); + this.showPositiveNotif( + $q, + t('circuit.coins_requestedrisgroup', { groupname }), + 6000 + ); } else { this.showNegativeNotif($q, t('db.recfailed')); } @@ -9225,14 +9592,26 @@ export const tools = { }, getUnitsMeasure(unit: number, short: boolean, weight?: number) { - let unitrec = shared_consts.Units_Of_Measure_ListBox.find((rec: any) => rec.value === unit); + let unitrec = shared_consts.Units_Of_Measure_ListBox.find( + (rec: any) => rec.value === unit + ); let mystr = ''; - if (unitrec && unitrec.value === shared_consts.UNITS_OF_MEASURE.CHILI && weight && weight < 1) { + if ( + unitrec && + unitrec.value === shared_consts.UNITS_OF_MEASURE.CHILI && + weight && + weight < 1 + ) { unitrec = shared_consts.Units_Of_Measure_ListBox.find( (rec: any) => rec.value === shared_consts.UNITS_OF_MEASURE.GRAMMI ); } - if (unitrec && unitrec.value === shared_consts.UNITS_OF_MEASURE.LITRI && weight && weight < 1) { + if ( + unitrec && + unitrec.value === shared_consts.UNITS_OF_MEASURE.LITRI && + weight && + weight < 1 + ) { unitrec = shared_consts.Units_Of_Measure_ListBox.find( (rec: any) => rec.value === shared_consts.UNITS_OF_MEASURE.MILLILITRI ); @@ -9242,11 +9621,23 @@ export const tools = { }, getWeightByUnit(unit: number, short: boolean, weight: number | undefined) { - const unitrec = shared_consts.Units_Of_Measure_ListBox.find((rec: any) => rec.value === unit); - if (unitrec && unitrec.value === shared_consts.UNITS_OF_MEASURE.CHILI && weight && weight < 1) { + const unitrec = shared_consts.Units_Of_Measure_ListBox.find( + (rec: any) => rec.value === unit + ); + if ( + unitrec && + unitrec.value === shared_consts.UNITS_OF_MEASURE.CHILI && + weight && + weight < 1 + ) { return weight * 1000; } - if (unitrec && unitrec.value === shared_consts.UNITS_OF_MEASURE.LITRI && weight && weight < 1) { + if ( + unitrec && + unitrec.value === shared_consts.UNITS_OF_MEASURE.LITRI && + weight && + weight < 1 + ) { return weight * 1000; } return weight; @@ -9525,7 +9916,8 @@ export const tools = { else if (versione === shared_consts.PRODUCTTYPE.USATO) // Versione Libro usato str = 'fas fa-book-open'; - else if (versione === shared_consts.PRODUCTTYPE.DOWNLOAD) str = 'fas fa-file-download'; + else if (versione === shared_consts.PRODUCTTYPE.DOWNLOAD) + str = 'fas fa-file-download'; else if (versione === shared_consts.PRODUCTTYPE.DVD) str = 'fas fa-film'; else if (versione === shared_consts.PRODUCTTYPE.PDF) str = 'fas fa-file-pdf'; else if (versione === shared_consts.PRODUCTTYPE.EPUB) @@ -9631,7 +10023,9 @@ export const tools = { }, getLabelAddrec(ind: any) { - return ind >= 0 ? translate('grid.newrecord') + ` ` + costanti.MAINCARDS[ind].strsingolo : ''; + return ind >= 0 + ? translate('grid.newrecord') + ` ` + costanti.MAINCARDS[ind].strsingolo + : ''; }, getCoordinatesToShow(coordinate_gps: any) { @@ -9644,13 +10038,20 @@ export const tools = { } }, - getHostPuntamento(arrDNS: any, tofind: string, paramsulServer: string, type: string): any { + getHostPuntamento( + arrDNS: any, + tofind: string, + paramsulServer: string, + type: string + ): any { let checkDomain = ''; let color = 'red'; let ok = false; try { if (arrDNS) { - const indrec = arrDNS.findIndex((rec: any) => rec.name === tofind && rec.type === type); + const indrec = arrDNS.findIndex( + (rec: any) => rec.name === tofind && rec.type === type + ); if (indrec >= 0) { checkDomain = tofind + ' -> ' + arrDNS[indrec].content; const giusto = paramsulServer === arrDNS[indrec].content; @@ -9695,7 +10096,8 @@ export const tools = { return '/images/noimg.png'; } if (gallerylist) { - if (this.getextfile(gallerylist.imagefile) === 'pdf') return '/images/images/pdf.jpg'; + if (this.getextfile(gallerylist.imagefile) === 'pdf') + return '/images/images/pdf.jpg'; else { if (this.contieneSlash(gallerylist.imagefile)) { return gallerylist.imagefile + addtourl; @@ -9907,7 +10309,9 @@ export const tools = { }, getTitleAnnuncio(table: string) { - const rec = costanti.MAINCARDS.find((rec: any) => rec.showinoptions && rec.table === table); + const rec = costanti.MAINCARDS.find( + (rec: any) => rec.showinoptions && rec.table === table + ); return rec ? rec.strsingolo : ''; }, @@ -10131,7 +10535,11 @@ export const tools = { return myrec; }, - getScaleX(optcatalogo: IOptCatalogo, scheda?: IMyScheda, options?: any): number | undefined { + getScaleX( + optcatalogo: IOptCatalogo, + scheda?: IMyScheda, + options?: any + ): number | undefined { let scalex = 1; if ( optcatalogo.printable && @@ -10156,7 +10564,11 @@ export const tools = { return scalex; }, - getScaleY(optcatalogo: IOptCatalogo, scheda?: IMyScheda, options?: any): number | undefined { + getScaleY( + optcatalogo: IOptCatalogo, + scheda?: IMyScheda, + options?: any + ): number | undefined { let scaley = 1; if ( optcatalogo.printable && @@ -10218,16 +10630,17 @@ export const tools = { optcatalogo.selectedVersionStampabile === shared_consts.PREPARA_PDF.STAMPA ) { let scaledifftrawebeStampax = - optcatalogo.areadistampa.format[0] / optcatalogo.areadistampa.format_printable[0]; + optcatalogo.areadistampa.format[0] / + optcatalogo.areadistampa.format_printable[0]; let scaledifftrawebeStampay = - optcatalogo.areadistampa.format[1] / optcatalogo.areadistampa.format_printable[1]; - + optcatalogo.areadistampa.format[1] / + optcatalogo.areadistampa.format_printable[1]; const myPaddingPag = optcatalogo.dimensioni_def.pagina.size; const numwidth = parseFloat(myPaddingPag.width) || 0; const numheight = parseFloat(myPaddingPag.height) || 0; - const margineX = (((numwidth) * (1/scaledifftrawebeStampax)) - numwidth) / 2; - const marginey = (((numheight) * (1/scaledifftrawebeStampay)) - numheight) / 2; + const margineX = (numwidth * (1 / scaledifftrawebeStampax) - numwidth) / 2; + const marginey = (numheight * (1 / scaledifftrawebeStampay) - numheight) / 2; if (options?.paddingLeft) { size += marginex; @@ -10322,7 +10735,9 @@ export const tools = { // Se l'URL non ha un protocollo, aggiunge "https://" const baseprotocol = this.getProtocol(); const formattedUrl = - url.startsWith('http://') || url.startsWith('https://') ? url : `${baseprotocol}${url}`; + url.startsWith('http://') || url.startsWith('https://') + ? url + : `${baseprotocol}${url}`; // Crea un nuovo oggetto URL a partire dall'input const parsedUrl = new URL(formattedUrl); @@ -10358,7 +10773,7 @@ export const tools = { isCollStampa() { const userStore = useUserStore(); - return (userStore.isGrafico || userStore.isAdmin) + return userStore.isGrafico || userStore.isAdmin; }, isCollaboratore() { @@ -10368,7 +10783,8 @@ export const tools = { userStore.isEditor || userStore.isCommerciale || userStore.isAdmin || - userStore.isManager || userStore.isGrafico + userStore.isManager || + userStore.isGrafico ); }, @@ -10698,15 +11114,24 @@ export const tools = { return this.removeFileExtension(filename) + `_compressed.pdf`; }, - convertTitleToFileName(title: string): string { return title .replace(/ /g, '_') .normalize('NFD') .replace(/[\u0300-\u036f]/g, '') - .replace(/[^a-zA-Z0-9_]/g, '') - } + .replace(/[^a-zA-Z0-9_]/g, ''); + }, + getColorWithTransparency(color: string): string { + const hex = color.slice(1); // Rimuove il simbolo "#" dal colore + const r = parseInt(hex.substring(0, 2), 16); + const g = parseInt(hex.substring(2, 4), 16); + const b = parseInt(hex.substring(4, 6), 16); + const a = parseInt(hex.substring(6, 8), 16) / 255; // Trasformiamo la trasparenza in formato decimale + + // Restituisce il colore con trasparenza in formato rgba + return `rgba(${r}, ${g}, ${b}, ${a})`; + }, // FINE ! diff --git a/src/views/ecommerce/catalogo/catalogo.scss b/src/views/ecommerce/catalogo/catalogo.scss index 498d0add..d7170c17 100755 --- a/src/views/ecommerce/catalogo/catalogo.scss +++ b/src/views/ecommerce/catalogo/catalogo.scss @@ -112,16 +112,20 @@ body { .book-text-up { font-family: 'DINPro', sans-serif; - margin-bottom: calc(5 * var(--scalecatalogy) * 1px); - font-size: calc(20 * var(--scalecatalogx) * 1px); + margin: calc(30 * var(--scalecatalogx) * 1px); + font-size: calc(17 * var(--scalecatalogx) * 1px); height: calc(380 * var(--scalecatalogy) * 1px); line-height: 130%; + font-weight: bold; padding: 8px; border-radius: 20px; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); text-shadow: 1px 1px 2px black; + + overflow: hidden; /* Nasconde il testo che esce dalla height fissa */ + } .book-text-down { diff --git a/src/views/ecommerce/catalogo/catalogo.ts b/src/views/ecommerce/catalogo/catalogo.ts index f1979496..10bedeb0 100755 --- a/src/views/ecommerce/catalogo/catalogo.ts +++ b/src/views/ecommerce/catalogo/catalogo.ts @@ -96,6 +96,8 @@ export default defineComponent({ const rigeneraLibri = ref(false); const search = ref(''); + + const showColorPicker = ref(false); const optauthors = ref([]); const strout = ref(''); @@ -2691,9 +2693,10 @@ export default defineComponent({ updateCatalogoPadre(); } - function updatecatalogmodif(field: string, val: any) { + async function updatecatalogmodif(field: string, val: any) { if (field) { myCatalog.value[field] = val; + await saveCatalog(); } } @@ -2792,6 +2795,8 @@ export default defineComponent({ updatecatalogmodif, tabgen, generaListaTempLibri, + globalStore, + showColorPicker, }; }, }); diff --git a/src/views/ecommerce/catalogo/catalogo.vue b/src/views/ecommerce/catalogo/catalogo.vue index 33464eb9..2a5cafa4 100755 --- a/src/views/ecommerce/catalogo/catalogo.vue +++ b/src/views/ecommerce/catalogo/catalogo.vue @@ -577,7 +577,14 @@ @@ -681,7 +688,14 @@ color="primary" icon="fas fa-file-pdf" :label="`Apri PDF`" - :href="tools.getURLByHostAndFilePath(myCatalog.pdf_online, myCatalog.data_online ? (new Date(myCatalog.data_online)).getTime() : undefined)" + :href=" + tools.getURLByHostAndFilePath( + myCatalog.pdf_online, + myCatalog.data_online + ? new Date(myCatalog.data_online).getTime() + : undefined + ) + " size="md" class="hover-lift" /> @@ -692,7 +706,14 @@ color="primary" icon="download" :label="`Scarica PDF`" - :href="tools.getURLByHostAndFilePath(myCatalog.pdf_online, myCatalog.data_online ? (new Date(myCatalog.data_online)).getTime() : undefined)" + :href=" + tools.getURLByHostAndFilePath( + myCatalog.pdf_online, + myCatalog.data_online + ? new Date(myCatalog.data_online).getTime() + : undefined + ) + " download size="md" class="hover-lift" @@ -764,7 +785,12 @@ icon="fas fa-file-pdf" :label="`Apri PDF`" :href=" - tools.getURLByHostAndFilePath(myCatalog.pdf_online_stampa, myCatalog.data_online_stampa ? (new Date(myCatalog.data_online_stampa)).getTime() : undefined) + tools.getURLByHostAndFilePath( + myCatalog.pdf_online_stampa, + myCatalog.data_online_stampa + ? new Date(myCatalog.data_online_stampa).getTime() + : undefined + ) " size="md" class="hover-lift" @@ -777,7 +803,12 @@ icon="download" :label="`Scarica PDF`" :href=" - tools.getURLByHostAndFilePath(myCatalog.pdf_online_stampa, myCatalog.data_online_stampa ? (new Date(myCatalog.data_online_stampa)).getTime() : undefined) + tools.getURLByHostAndFilePath( + myCatalog.pdf_online_stampa, + myCatalog.data_online_stampa + ? new Date(myCatalog.data_online_stampa).getTime() + : undefined + ) " download size="md" @@ -1214,6 +1245,93 @@ zIndex: '10', // Assicura che il testo sia visibile sopra altri elementi }" > + + + + + +
+ {{ t('cataloglist.impostazioni_intestazione') }} +
+
+ + + + + + + + + + + +
+
+