- Aggiornati margini.

- Cataloghi: Export ed Import di una pagine ed i suoi elementi !
This commit is contained in:
Surya Paolo
2024-12-13 18:10:04 +01:00
parent 29c59588c7
commit 8baf1e99f0
39 changed files with 752 additions and 141 deletions

View File

@@ -3,7 +3,7 @@ SERVICE_WORKER_FILE="service-worker.js"
APP_ID="18" APP_ID="18"
DIRECTORY_LOCAL=newfreeplanet DIRECTORY_LOCAL=newfreeplanet
DIRECTORY_SERVER=/var/www/freeplanet_serverside DIRECTORY_SERVER=/var/www/freeplanet_serverside
SERVERDIR_WEBSITE="/var/www/test.gruppomacro.app" SERVERDIR_WEBSITE="/var/www/gruppomacro.app"
SERVERPW_WEBSITE=pwdadmin@1AOK SERVERPW_WEBSITE=pwdadmin@1AOK
APP_URL="https://gruppomacro.app" APP_URL="https://gruppomacro.app"
URL_FACEBOOK="" URL_FACEBOOK=""

View File

@@ -34,11 +34,21 @@ export default defineComponent({
required: false, required: false,
default: 2, default: 2,
}, },
show_at_right: {
type: Boolean,
required: false,
default: false,
},
height: { height: {
type: Number, type: Number,
required: false, required: false,
default: 100, default: 100,
}, },
gap: {
type: Number,
required: false,
default: 0,
},
fontsize: { fontsize: {
type: Number, type: Number,
required: false, required: false,

View File

@@ -1,6 +1,6 @@
<template> <template>
<div class="row barcode-container"> <div class="row barcode-container" :style="{ marginTop: gap ? gap : '0'}">
<div class="text-center" :style="`font-size: ${fontsize}px`"> <div v-if="text" class="text-center" :style="`font-size: ${fontsize}px`">
{{ text }} {{ text }}
</div> </div>
<img :style="`width:${width}px !important;`" :id="`C${value}`"/> <img :style="`width:${width}px !important;`" :id="`C${value}`"/>

View File

@@ -385,3 +385,12 @@ $grigioscuro: rgb(120, 120, 120);
padding: 10px; padding: 10px;
vertical-align: middle; vertical-align: middle;
} }
.flex-details_and_barcode {
display: flex; /* Rende il div un container flex per allineare i contenuti */
align-items: center; /* Allineamento verticale al centro */
padding-top: calc(5 * var(--scalecatalog) * 1px);
justify-content: space-between !important;
flex-grow: 0; /* Opzionale: permette agli elementi di crescere uniformemente */
}

View File

@@ -9,6 +9,7 @@ import { CCardState } from '../CCardState'
import { CCopyBtn } from '../CCopyBtn' import { CCopyBtn } from '../CCopyBtn'
import { CMyValueDb } from '../CMyValueDb' import { CMyValueDb } from '../CMyValueDb'
import { CPrice } from '../CPrice' import { CPrice } from '../CPrice'
import { CText } from '../CText'
import { CLabel } from '@src/components/CLabel' import { CLabel } from '@src/components/CLabel'
import { CBarCode } from '../CBarCode' import { CBarCode } from '../CBarCode'
@@ -73,7 +74,10 @@ export default defineComponent({
}), }),
}, },
}, },
components: { CTitleBanner, CCardState, CCopyBtn, CMyValueDb, VuePdfApp, CPrice, CBarCode, CLabel }, components: {
CTitleBanner, CCardState, CCopyBtn, CMyValueDb, VuePdfApp, CPrice, CBarCode, CLabel,
CText
},
setup(props, { emit }) { setup(props, { emit }) {
const $q = useQuasar() const $q = useQuasar()
const { t } = useI18n() const { t } = useI18n()
@@ -151,6 +155,13 @@ export default defineComponent({
props.scheda!.testo_right! props.scheda!.testo_right!
) )
}) })
const getTesto_Right_attaccato = computed(() => {
return products.replaceKeyWordsByProduct(
optcatalogo.value,
myproduct.value!,
props.scheda!.testo_right_attaccato!
)
})
const getTesto_Debug = computed(() => { const getTesto_Debug = computed(() => {
return products.replaceKeyWordsByProduct( return products.replaceKeyWordsByProduct(
optcatalogo.value, optcatalogo.value,
@@ -657,6 +668,7 @@ export default defineComponent({
modifOn, modifOn,
modifProd, modifProd,
getTesto_Right, getTesto_Right,
getTesto_Right_attaccato,
getTesto_Bottom, getTesto_Bottom,
getTesto_Debug, getTesto_Debug,
getScale, getScale,

View File

@@ -40,25 +40,18 @@
</q-page-sticky> </q-page-sticky>
<q-card-section> <q-card-section>
<!-- per immagine di ombra -->
<div <div
v-if="scheda.testo_right && scheda.testo_right?.font" v-if="scheda.testo_right_attaccato || scheda.testo_right"
:class="[ :class="[
'flex', // Classi comuni 'flex', // Classi comuni
'image-container', 'image-container',
{ 'shadow-2': options.in_3d && !optcatalogo.pdf }, // Classe condizionale { 'shadow-2': options.in_3d && !optcatalogo.pdf }, // Classe condizionale
scheda.testo_right.font?.posiz_text === scheda.testo_right_attaccato.font?.posiz_text ===
costanti.POSIZ_TESTO.IN_BASSO costanti.POSIZ_TESTO.IN_BASSO
? 'flex-col' ? ''
: 'flex-row', // Layout flessibile : 'flex flex-row', // Layout flessibile
]" ]"
:style="{ :style="{
justifyContent:
scheda.testo_right.font?.posiz_text ===
costanti.POSIZ_TESTO.IN_BASSO
? 'center'
: 'flex-start',
alignItems: 'stretch', // Cambiato in 'stretch' per occupare l'altezza
gap: gap:
tools.adjustSize( tools.adjustSize(
optcatalogo, optcatalogo,
@@ -75,7 +68,7 @@
), ),
}" }"
> >
<div style="position: relative; display: inline-block"> <div>
<a :href="myproduct.productInfo.link_macro" target="_blank"> <a :href="myproduct.productInfo.link_macro" target="_blank">
<q-img <q-img
v-if="myproduct.productInfo" v-if="myproduct.productInfo"
@@ -139,46 +132,127 @@
> >
</q-btn> </q-btn>
</div> </div>
<!-- Testo associato all'immagine -->
<div <!-- Testo sotto all'immagine -->
:style="{ <CText
width: :rectext="scheda.testo_right_attaccato"
scheda.testo_right.font?.posiz_text === :myproduct="myproduct"
costanti.POSIZ_TESTO.IN_BASSO :optcatalogo="optcatalogo"
? '100%' :scheda="scheda"
: scheda.testo_right.font?.perc_text ?? '50%',
marginTop:
scheda.testo_right.font?.posiz_text ===
costanti.POSIZ_TESTO.IN_BASSO
? '0.5rem'
: '0',
}"
> >
<div <div
v-if="scheda.testo_right && scheda.testo_right" v-if="
scheda.testo_right_attaccato.font?.posiz_text !==
costanti.POSIZ_TESTO.IN_BASSO
"
:style="{ :style="{
'--scalecatalog': tools.getScale(optcatalogo), alignSelf:
'line-height': scheda.testo_right.font?.line_height, scheda.testo_right_attaccato.font?.posiz_text ===
height: '100%', costanti.POSIZ_TESTO.IN_BASSO
display: 'flex', ? ''
flexDirection: 'column', : 'end',
marginTop:
scheda.testo_right_attaccato.font?.posiz_text ===
costanti.POSIZ_TESTO.IN_BASSO
? 'auto'
: '0',
}" }"
> >
<div <CText
v-html="getTesto_Right" :rectext="scheda.testo_right"
style=" :myproduct="myproduct"
display: flex; :optcatalogo="optcatalogo"
flex-direction: column; :show_at_right="scheda.barcode.show_at_right"
justify-content: space-between; >
height: 100%; <div class="row no-wrap items-center">
" <div v-if="scheda.barcode && scheda.barcode.show">
></div> <CBarCode
<div class="row"> :value="myproduct.productInfo.code"
:format="scheda.barcode.format"
:fontsize="
scheda.barcode.font?.size
"
:gap="
tools.adjustSize(optcatalogo, scheda.barcode.size?.gap)
"
:width="
parseInt(
tools.adjustSize(
optcatalogo,
scheda.barcode.size?.width
)
)
"
:widthlines="tools.adjustSize(optcatalogo, scheda.barcode.widthlines)"
:height="
tools.adjustSize(
optcatalogo,
scheda.barcode.size?.height
)
"
:show_at_right="scheda.barcode.show_at_right"
>
</CBarCode>
</div>
<div
v-if="
scheda.etichette?.bestseller?.show &&
isProductBestseller()
"
>
<q-img
src="images/bestseller.png"
alt="Bestseller"
:width="40 * tools.getScale(optcatalogo) + 'px'"
:height="40 * tools.getScale(optcatalogo) + 'px'"
fit="contain"
></q-img>
</div>
<div
v-else-if="
scheda.etichette?.novita?.show && isProductNovita()
"
>
<q-img
src="images/novita.png"
alt="Novita"
:width="40 * tools.getScale(optcatalogo) + 'px'"
:height="40 * tools.getScale(optcatalogo) + 'px'"
fit="contain"
></q-img>
</div>
</div>
</CText>
</div>
</CText>
<div
v-if="
scheda.testo_right_attaccato.font?.posiz_text ===
costanti.POSIZ_TESTO.IN_BASSO
"
class="flexible-width"
:style="{
marginTop: 'auto',
}"
>
<CText
:rectext="scheda.testo_right"
:myproduct="myproduct"
:optcatalogo="optcatalogo"
:scheda="scheda"
:show_at_right="scheda.barcode.show_at_right"
>
<div class="row no-wrap items-center">
<div v-if="scheda.barcode && scheda.barcode.show"> <div v-if="scheda.barcode && scheda.barcode.show">
<CBarCode <CBarCode
:value="myproduct.productInfo.code" :value="myproduct.productInfo.code"
:format="scheda.barcode.format" :format="scheda.barcode.format"
:fontsize="scheda.barcode.font?.size" :fontsize="
scheda.barcode.font?.size
"
:gap="
tools.adjustSize(optcatalogo, scheda.barcode.size?.gap)
"
:width=" :width="
parseInt( parseInt(
tools.adjustSize( tools.adjustSize(
@@ -187,8 +261,11 @@
) )
) )
" "
:widthlines="scheda.barcode.widthlines" :widthlines="tools.adjustSize(optcatalogo, scheda.barcode.widthlines)"
:height="scheda.barcode.size?.height" :height="
tools.adjustSize(optcatalogo, scheda.barcode.size?.height)
"
:show_at_right="scheda.barcode.show_at_right"
> >
</CBarCode> </CBarCode>
</div> </div>
@@ -219,8 +296,9 @@
></q-img> ></q-img>
</div> </div>
</div> </div>
</div> </CText>
</div> </div>
<div <div
v-if="optcatalogo.indebug" v-if="optcatalogo.indebug"
:style="{ :style="{
@@ -235,20 +313,15 @@
v-html="getTesto_Debug" v-html="getTesto_Debug"
></div> ></div>
</div> </div>
<div <!-- Testo sotto al testo attaccato, allineato al fondo -->
v-else-if="scheda.testo_bottom && scheda.testo_bottom.contenuto" <CText
:style="{ v-else-if="scheda.testo_bottom && getTesto_Bottom"
width: '100%', :rectext="scheda.testo_bottom"
}" :scheda="scheda"
> :myproduct="myproduct"
<div :optcatalogo="optcatalogo"
:style="{ ></CText>
'--scalecatalog': tools.getScale(optcatalogo), <div v-if="optcatalogo.indebug">testo: "{{ getTesto_Bottom }}"</div>
'line-height': scheda.testo_bottom.font?.line_height,
}"
v-html="getTesto_Bottom"
></div>
</div>
</div> </div>
</q-card-section> </q-card-section>
<q-separator v-if="complete" class="q-my-sm"></q-separator> <q-separator v-if="complete" class="q-my-sm"></q-separator>
@@ -674,7 +747,10 @@
:type="costanti.FieldType.number" :type="costanti.FieldType.number"
> >
</CMyValueDb> </CMyValueDb>
<CLabel :value="myproduct.indiceRanking" label="N° in Classifica:" /> <CLabel
:value="myproduct.indiceRanking"
label="N° in Classifica:"
/>
<div class="etichetta">3 Mesi:</div> <div class="etichetta">3 Mesi:</div>
<CMyValueDb <CMyValueDb

View File

@@ -0,0 +1,55 @@
import { tools } from '../../store/Modules/tools'
import { useQuasar } from 'quasar'
import { useI18n } from '@src/boot/i18n'
import { useUserStore } from '@store/UserStore'
import { useGlobalStore } from '@store/globalStore'
import { defineComponent } from 'vue'
export default defineComponent({
name: 'CDownloadJsonFile',
props: {
testoJson: {
type: String,
required: true,
},
title: {
type: String,
required: false,
default: '',
},
nomefile: {
type: String,
required: false,
default: '',
},
},
components: {},
setup(props) {
const $q = useQuasar()
const downloadJsonFile = () => {
// Crea un blob dalla jsonString passata come proprietà
const blob = new Blob([props.testoJson], { type: 'application/json' });
const url = URL.createObjectURL(blob);
// Crea un link temporaneo
const link = document.createElement('a');
link.href = url;
const fileName = `${props.nomefile}-${tools.getDateYYYYMMDD_Today()}.json`;
link.download = fileName; // Nome del file da scaricare
// Aggiungi il link al DOM e clicca per scaricare
document.body.appendChild(link);
link.click();
// Rimuovi il link dal DOM e libera l'oggetto URL
document.body.removeChild(link);
URL.revokeObjectURL(url);
};
return {
tools,
downloadJsonFile,
}
},
})

View File

@@ -0,0 +1,13 @@
<template>
<div>
<div v-if="testoJson">
<button @click="downloadJsonFile">{{ title }}</button>
</div>
</div>
</template>
<script lang="ts" src="./CDownloadJsonFile.ts"></script>
<style lang="scss" scoped>
@import './CDownloadJsonFile.scss';
</style>

View File

@@ -0,0 +1 @@
export {default as CDownloadJsonFile} from './CDownloadJsonFile.vue'

View File

View File

@@ -0,0 +1,91 @@
import { tools } from '../../store/Modules/tools'
import { useQuasar } from 'quasar'
import { useI18n } from '@src/boot/i18n'
import { useUserStore } from '@store/UserStore'
import { useGlobalStore } from '@store/globalStore'
import { CDownloadJsonFile } from '@/components/CDownloadJsonFile'
import { PropType, defineComponent, onMounted, ref } from 'vue'
import { IMyPage } from '@src/model'
export default defineComponent({
name: 'CExportPage',
props: {
idPage: {
type: String,
required: true,
},
nomefile: {
type: String,
required: true,
},
},
components: {CDownloadJsonFile},
setup(props) {
const $q = useQuasar()
const { t } = useI18n()
const globalStore = useGlobalStore()
const myrec = ref(<IMyPage | undefined>{})
const nomefile = ref(<string>'')
const testoJson = ref(<any>'')
let fileContent = ref('')
const ris = ref('')
const onFileChange = (event: any) => {
const file = event.target.files[0];
if (file && file.type === "application/json") {
const reader = new FileReader();
reader.onload = (e: any) => {
fileContent.value = e.target.result; // Carica il contenuto del file JSON
};
reader.readAsText(file);
} else {
tools.showNotif($q, 'Seleziona un file JSON valido.', { color: 'negative', icon: 'notifications' })
}
}
const importaPagina = async () => {
try {
if (!fileContent.value) {
tools.showNotif($q, 'Nessun file JSON caricato.', { color: 'negative', icon: 'notifications' })
return
}
// Chiama la funzione di importazione passandole il contenuto del file
ris.value = await globalStore.importPage(fileContent.value, $q, t);
} catch (error) {
console.error(error);
}
};
async function esportaPagina() {
if (myrec.value) {
testoJson.value = await globalStore.exportPage(myrec.value.path!, $q, t)
}
}
async function mounted() {
nomefile.value = props.nomefile
myrec.value = globalStore.getPageById(props.idPage)
}
onMounted(mounted)
return {
myrec,
tools,
testoJson,
esportaPagina,
importaPagina,
nomefile,
onFileChange,
ris,
}
},
})

View File

@@ -0,0 +1,51 @@
<template>
<div v-if="myrec && myrec.path" style="width: 800px;" class="">
<h2>Pagina '{{ myrec.path }}'</h2>
<br />
<div class="column">
Esporta:
<q-input
outlined
autofocus
v-model="nomefile"
label="Nome File"
></q-input>
<q-btn
color="primary"
label="Esporta Pagina"
@click="esportaPagina"
></q-btn>
<CDownloadJsonFile
v-if="testoJson"
:testoJson="testoJson"
:title="`Scarica file ${nomefile}`"
:nomefile="nomefile"
>
</CDownloadJsonFile>
</div>
<div class="column">
Importa file JSON:
<input
type="file"
@change="onFileChange"
outlined
></input>
fileContent: {{fileContent}}
<q-btn
color="primary"
label="Importa file"
@click="importaPagina"
></q-btn>
</div>
<div class="row">Risultato:<br>
{{ ris }}</div>
</div>
</template>
<script lang="ts" src="./CExportPage.ts"></script>
<style lang="scss" scoped>
@import './CExportPage.scss';
</style>

View File

@@ -0,0 +1 @@
export {default as CExportPage} from './CExportPage.vue'

View File

@@ -49,7 +49,7 @@ export default defineComponent({
CSelectColor, CSelectFontSize, CSelectImage, CImgPoster, CSelectAnimation, CMySlider, CSelectColor, CSelectFontSize, CSelectImage, CImgPoster, CSelectAnimation, CMySlider,
CMySize, CBorders, CMyDimensioni, CMyText, CMySize, CBorders, CMyDimensioni, CMyText,
}, },
emits: ['saveElem', 'selElemClick', 'toggleSize', 'deleteElem', 'dupPage'], emits: ['saveElem', 'selElemClick', 'toggleSize', 'deleteElem', 'dupPage', 'expPage'],
props: { props: {
myelem: { myelem: {
type: Object as PropType<IMyElem>, type: Object as PropType<IMyElem>,
@@ -60,7 +60,7 @@ export default defineComponent({
required: false, required: false,
default: '', default: '',
}, },
IdPath: { idPage: {
type: String, type: String,
required: false, required: false,
default: '', default: '',
@@ -142,7 +142,7 @@ export default defineComponent({
let neword = 0 let neword = 0
if (myelem) { if (myelem) {
neword = myelem.order! neword = myelem.order!
const recfound = globalStore.getMyElemNextThisElemId(props.path, myelem._id!) const recfound = globalStore.getMyElemNextThisElemId(props.idPage, myelem._id!)
if (recfound) { if (recfound) {
neword = Math.round((recfound.order! + myelem.order!) / 2) neword = Math.round((recfound.order! + myelem.order!) / 2)
@@ -161,10 +161,10 @@ export default defineComponent({
if (direz === -1) { // Sopra if (direz === -1) { // Sopra
// ottieni l'elemento precedente, mantenendo l'ordinamento // ottieni l'elemento precedente, mantenendo l'ordinamento
recfound = globalStore.getMyElemPrecThisElemId(props.path, elemsel._id) recfound = globalStore.getMyElemPrecThisElemId(props.idPage, elemsel._id)
} else if (direz === 1) { // Sotto } else if (direz === 1) { // Sotto
// ottieni l'elemento precedente, mantenendo l'ordinamento // ottieni l'elemento precedente, mantenendo l'ordinamento
recfound = globalStore.getMyElemNextThisElemId(props.path, elemsel._id) recfound = globalStore.getMyElemNextThisElemId(props.idPage, elemsel._id)
} }
if (recfound) { if (recfound) {
@@ -182,6 +182,9 @@ export default defineComponent({
async function dupPage() { async function dupPage() {
emit('dupPage', null) emit('dupPage', null)
} }
async function exportPage() {
emit('expPage', null)
}
async function dupElem(order?: number) { async function dupElem(order?: number) {
const newrec: IMyElem = tools.jsonCopy(props.myelem) const newrec: IMyElem = tools.jsonCopy(props.myelem)
@@ -246,7 +249,7 @@ export default defineComponent({
// @ts-ignore // @ts-ignore
label: page.title, label: page.title,
// @ts-ignore // @ts-ignore
value: page.path value: page.idPage
} }
arrPages.value.push(rec) arrPages.value.push(rec)
} }
@@ -261,15 +264,10 @@ export default defineComponent({
if (myel.value.catalogo && myel.value.catalogo?.arrSchede) { if (myel.value.catalogo && myel.value.catalogo?.arrSchede) {
for (const recscheda of myel.value.catalogo?.arrSchede) { for (const recscheda of myel.value.catalogo?.arrSchede) {
if (recscheda.scheda) { if (recscheda.scheda) {
if ((!recscheda.scheda?.testo_bottom)) { recscheda.scheda.testo_right_attaccato = tools.resetIText(recscheda.scheda?.testo_right_attaccato!)
recscheda.scheda.testo_bottom = { contenuto: '', maxlength: 100 } recscheda.scheda.testo_right = tools.resetIText(recscheda.scheda?.testo_right!)
} recscheda.scheda.testo_bottom = tools.resetIText(recscheda.scheda?.testo_bottom!)
if (!recscheda.scheda.testo_bottom!.font) {
recscheda.scheda.testo_bottom!.font = { name: '', size: '' }
}
if ((!recscheda.scheda?.testo_right || !recscheda.scheda?.testo_right.font)) {
recscheda.scheda.testo_right = { contenuto: '', font: { name: '', size: '' } }
}
if ((!recscheda.scheda?.dimensioni.pagina)) { if ((!recscheda.scheda?.dimensioni.pagina)) {
recscheda.scheda.dimensioni.pagina = tools.resetRecIPagina(recscheda.scheda?.dimensioni.pagina) recscheda.scheda.dimensioni.pagina = tools.resetRecIPagina(recscheda.scheda?.dimensioni.pagina)
} }
@@ -459,6 +457,12 @@ export default defineComponent({
dimensioni, dimensioni,
numschede_perRiga: 2, numschede_perRiga: 2,
numschede_perCol: 2, numschede_perCol: 2,
testo_right_attaccato: {
contenuto: '',
font: {
posiz_text: costanti.POSIZ_TESTO.A_DESTRA,
},
},
testo_right: { testo_right: {
contenuto: '', contenuto: '',
font: { font: {
@@ -827,8 +831,11 @@ export default defineComponent({
async function moveElem(direz: any) { async function moveElem(direz: any) {
let myelem = props.myelem let myelem = props.myelem
const elemprec = globalStore.getMyElemPrecThisElemId(props.path, myelem._id!) const elemprec = globalStore.getMyElemPrecThisElemId(props.idPage, myelem._id!)
const elemnext = globalStore.getMyElemNextThisElemId(props.path, myelem._id!) const elemnext = globalStore.getMyElemNextThisElemId(props.idPage, myelem._id!)
if (!elemprec || !elemnext)
return false
let neworder = 0 let neworder = 0
let oldorder = myelem.order! let oldorder = myelem.order!
@@ -839,7 +846,7 @@ export default defineComponent({
elemprec.order = oldorder elemprec.order = oldorder
if (oldorder === elemprec.order!) { if (oldorder === elemprec.order!) {
const elemprec2 = globalStore.getMyElemPrecThisElemId(props.path, elemprec._id!) const elemprec2 = globalStore.getMyElemPrecThisElemId(props.idPage, elemprec._id!)
neworder = (elemprec2.order! + elemprec.order) / 2 neworder = (elemprec2.order! + elemprec.order) / 2
elemprec.order = Math.round((oldorder + neworder) / 2) elemprec.order = Math.round((oldorder + neworder) / 2)
@@ -853,7 +860,7 @@ export default defineComponent({
elemnext.order = oldorder elemnext.order = oldorder
if (oldorder === elemnext.order!) { if (oldorder === elemnext.order!) {
const elemnext2 = globalStore.getMyElemNextThisElemId(props.path, elemnext._id!) const elemnext2 = globalStore.getMyElemNextThisElemId(props.idPage, elemnext._id!)
neworder = (elemnext2.order! + elemnext.order) / 2 neworder = (elemnext2.order! + elemnext.order) / 2
elemnext.order = Math.round((oldorder + neworder) / 2) elemnext.order = Math.round((oldorder + neworder) / 2)
@@ -1082,6 +1089,7 @@ export default defineComponent({
idSchedaDaCopiare, idSchedaDaCopiare,
copyfromTemplate, copyfromTemplate,
modifElemAndSchede, modifElemAndSchede,
exportPage,
} }
}, },

View File

@@ -44,24 +44,33 @@
> >
</q-btn> </q-btn>
</div> </div>
<q-bar v-if="enableEdit" class="q-pa-md bg-light-blue text-white"> <q-bar v-if="enableEdit" class="q-pa-md bg-orange text-white">
<!--<q-toggle v-if="tools.isManager()" Pagina:
v-model="enableAdd"
icon="fas fa-plus"
</q-toggle>
>-->
&nbsp;
<q-space /> <q-space />
<q-btn <q-btn
icon="far fa-copy" icon="far fa-copy"
label="Duplica Pagina" label="Duplica"
dense dense
size="sm" size="sm"
color="fuchsia" color="primary"
@click="dupPage()" @click="dupPage()"
> >
</q-btn> </q-btn>
<q-btn
icon="fas fa-expand-alt"
label="Esporta"
dense
size="sm"
color="primary"
@click="exportPage()"
>
</q-btn>
</q-bar>
<q-bar v-if="enableEdit" class="q-pa-md bg-light-blue text-white">
Elemento:
<q-space />
<q-btn <q-btn
icon="fas fa-trash-alt" icon="fas fa-trash-alt"
color="negative" color="negative"
@@ -484,7 +493,7 @@
:canEdit="true" :canEdit="true"
:canModify="true" :canModify="true"
:nosaveToDb="true" :nosaveToDb="true"
:path="myel.path" :path="path"
:fieldtype="costanti.FieldType.imgcard" :fieldtype="costanti.FieldType.imgcard"
@save="saveCard" @save="saveCard"
> >
@@ -922,7 +931,7 @@
@update:model-value="modifElem" @update:model-value="modifElem"
:canEdit="true" :canEdit="true"
:canModify="true" :canModify="true"
:path="myel.path" :path="path"
:fieldtype="costanti.FieldType.image" :fieldtype="costanti.FieldType.image"
> >
</CMyFieldRec> </CMyFieldRec>
@@ -945,6 +954,7 @@
table="myelems" table="myelems"
:id="myel._id" :id="myel._id"
:rec="myel" :rec="myel"
:path="path"
field="image" field="image"
@update:model-value="modifElem" @update:model-value="modifElem"
:canEdit="true" :canEdit="true"
@@ -1144,6 +1154,7 @@
table="myelems" table="myelems"
:id="myel._id" :id="myel._id"
:rec="myel" :rec="myel"
:path="path"
field="list" field="list"
@update:model-value="modifElem" @update:model-value="modifElem"
:canEdit="true" :canEdit="true"
@@ -1850,6 +1861,14 @@
:disabled="recscheda.scheda.linkIdTemplate" :disabled="recscheda.scheda.linkIdTemplate"
icon="fas fa-play-circle" icon="fas fa-play-circle"
> >
<CMyText
v-model="recscheda.scheda.testo_right_attaccato"
@modifElem="modifElem"
@saveFieldElem="saveFieldElem"
@update:model-value="modifElem"
label="Testo a Destra attaccato"
>
</CMyText>
<CMyText <CMyText
v-model="recscheda.scheda.testo_right" v-model="recscheda.scheda.testo_right"
@modifElem="modifElem" @modifElem="modifElem"
@@ -1865,6 +1884,7 @@
@saveFieldElem="saveFieldElem" @saveFieldElem="saveFieldElem"
@update:model-value="modifElem" @update:model-value="modifElem"
label="Testo in Basso" label="Testo in Basso"
:show_dimensioni="true"
> >
</CMyText> </CMyText>
</q-expansion-item> </q-expansion-item>
@@ -1907,6 +1927,14 @@
color="green" color="green"
@update:model-value="modifElem" @update:model-value="modifElem"
></CMySlider> ></CMySlider>
<q-toggle
v-model="recscheda.scheda.barcode.show_at_right"
color="positive"
label="Mostra a Destra"
@update:model-value="modifElem"
>
</q-toggle>
<CMySlider <CMySlider
label="Font Size:" label="Font Size:"
v-model="recscheda.scheda.barcode.font.size" v-model="recscheda.scheda.barcode.font.size"
@@ -1922,6 +1950,7 @@
v-model="recscheda.scheda.barcode.size" v-model="recscheda.scheda.barcode.size"
@update:model-value="modifElem" @update:model-value="modifElem"
:addstr="false" :addstr="false"
:gap="true"
></CMySize> ></CMySize>
</q-expansion-item> </q-expansion-item>

View File

@@ -123,7 +123,7 @@
:class=" :class="
tools.getClassAnim(myel.anim2) + ` ` + myel.class4 tools.getClassAnim(myel.anim2) + ` ` + myel.class4
" "
:src="tools.getImgFileByElem(myel, rec)" :src="tools.getImgFileByElem(myel, rec, path)"
/> />
</div> </div>
<q-card-section class="q-card-section-small"> <q-card-section class="q-card-section-small">
@@ -197,7 +197,7 @@
> >
<CImgTitle <CImgTitle
v-if="myel.image" v-if="myel.image"
:src="tools.getImgFileByElem(myel)" :src="tools.getImgFileByElem(myel, undefined, path)"
:title="myel.container" :title="myel.container"
:legendinside="myel.container2" :legendinside="myel.container2"
> >
@@ -212,7 +212,7 @@
> >
<CImgPoster <CImgPoster
v-if="myel.image" v-if="myel.image"
:src="tools.getImgFileByElem(myel)" :src="tools.getImgFileByElem(myel, undefined, path)"
:title="myel.container" :title="myel.container"
:myheight="myel.heightimg" :myheight="myel.heightimg"
:vertalign="myel.vertalign" :vertalign="myel.vertalign"
@@ -248,7 +248,7 @@
:read="myel.parambool" :read="myel.parambool"
:link="myel.container" :link="myel.container"
:textlink="myel.container2" :textlink="myel.container2"
:imglogo="tools.getImgFileByElem(myel)" :imglogo="tools.getImgFileByElem(myel, undefined, path)"
></CQRCode> ></CQRCode>
</div> </div>
<div v-else-if="myel.type === shared_consts.ELEMTYPE.IMAGE"> <div v-else-if="myel.type === shared_consts.ELEMTYPE.IMAGE">
@@ -264,7 +264,7 @@
@click="clickOnElem" @click="clickOnElem"
> >
<q-img <q-img
:src="tools.getImgFileByElem(myel)" :src="tools.getImgFileByElem(myel, undefined, path)"
:fit="myel.fit" :fit="myel.fit"
class="img" class="img"
:width="myel.widthimg ? myel.widthimg : undefined" :width="myel.widthimg ? myel.widthimg : undefined"
@@ -287,7 +287,7 @@
@click="clickOnElem" @click="clickOnElem"
> >
<q-img <q-img
:src="tools.getImgFileByElem(myel)" :src="tools.getImgFileByElem(myel, undefined, path)"
:fit="myel.fit" :fit="myel.fit"
class="img" class="img"
:width="myel.widthimg ? myel.widthimg : undefined" :width="myel.widthimg ? myel.widthimg : undefined"

View File

@@ -10,6 +10,7 @@ import { CMyElem } from '@/components/CMyElem'
import { CTitleBanner } from '@/components/CTitleBanner' import { CTitleBanner } from '@/components/CTitleBanner'
import { CMyEditElem } from '@/components/CMyEditElem' import { CMyEditElem } from '@/components/CMyEditElem'
import { CMyPageElem2 } from '@/components/CMyPageElem2' import { CMyPageElem2 } from '@/components/CMyPageElem2'
import { CExportPage } from '@/components/CExportPage'
import { CImgTitle } from '../CImgTitle/index' import { CImgTitle } from '../CImgTitle/index'
import { CTitle } from '../CTitle/index' import { CTitle } from '../CTitle/index'
@@ -24,7 +25,7 @@ export default defineComponent({
name: 'CMyPageElem', name: 'CMyPageElem',
components: { components: {
LandingFooter, CImgTitle, CTitle, CMyElem, LandingFooter, CImgTitle, CTitle, CMyElem,
CMyEditElem, CMyPageElem2, CTitleBanner, CMyEditElem, CMyPageElem2, CTitleBanner, CExportPage,
}, },
props: { props: {
title: String, title: String,
@@ -32,7 +33,7 @@ export default defineComponent({
type: String, type: String,
required: true, required: true,
}, },
myidPage: { idPage: {
type: String, type: String,
required: false, required: false,
default: '' default: ''
@@ -77,6 +78,8 @@ export default defineComponent({
const mywidthEditor = ref(400) const mywidthEditor = ref(400)
const showexportPage = ref(false)
const editOn = computed({ const editOn = computed({
get(): boolean { get(): boolean {
return !!globalStore.editOn ? globalStore.editOn : false return !!globalStore.editOn ? globalStore.editOn : false
@@ -195,6 +198,7 @@ export default defineComponent({
onloading, onloading,
deleteElem, deleteElem,
duplicatePage, duplicatePage,
showexportPage,
} }
}, },

View File

@@ -46,11 +46,12 @@
:myelem="selElem" :myelem="selElem"
:editOn="true" :editOn="true"
:path="rec.path" :path="rec.path"
:IdPath="rec._id" :idPage="rec._id"
@selElemClick="selElemClick" @selElemClick="selElemClick"
@deleteElem="deleteElem" @deleteElem="deleteElem"
@toggleSize="toggleSize" @toggleSize="toggleSize"
@dupPage="duplicatePage" @dupPage="duplicatePage"
@expPage="showexportPage = !showexportPage"
> >
</CMyEditElem> </CMyEditElem>
</q-drawer> </q-drawer>
@@ -165,6 +166,22 @@
<div v-if="!nofooter"></div> <div v-if="!nofooter"></div>
</div> </div>
</div> </div>
<q-dialog v-model="showexportPage">
<q-card class="dialog_card">
<q-toolbar class="bg-primary text-white">
<q-toolbar-title>
Esporta Pagina
</q-toolbar-title>
<q-btn flat round color="white" icon="close" v-close-popup></q-btn>
</q-toolbar>
<q-card-section class="q-pa-xs inset-shadow">
<br>
<CExportPage :idPage="selElem.idPage" :nomefile="`esporta_${rec.path}.json`"> </CExportPage>
<br>
</q-card-section>
</q-card>
</q-dialog>
</div> </div>
</template> </template>

View File

@@ -23,7 +23,7 @@
" "
></q-btn> ></q-btn>
</q-bar> </q-bar>
<CMyEditElem :myelem="selElem" :editOn="editOn" :path="rec.path"> <CMyEditElem :myelem="selElem" :editOn="editOn" :path="rec.path" :idPage="rec._id">
</CMyEditElem> </CMyEditElem>
</q-drawer> </q-drawer>

View File

@@ -8,6 +8,7 @@ import { tools } from '@store/Modules/tools'
import { costanti } from '@costanti' import { costanti } from '@costanti'
import { CMySize } from '@src/components/CMySize'
import { CMySlider } from '@src/components/CMySlider' import { CMySlider } from '@src/components/CMySlider'
import { CMyFieldRec } from '@src/components/CMyFieldRec' import { CMyFieldRec } from '@src/components/CMyFieldRec'
@@ -16,7 +17,7 @@ import { shared_consts } from '@/common/shared_vuejs'
export default defineComponent({ export default defineComponent({
name: 'CMyText', name: 'CMyText',
emits: ['update:modelValue', 'modifElem', 'saveFieldElem',], emits: ['update:modelValue', 'modifElem', 'saveFieldElem',],
components: { CMySlider, CMyFieldRec }, components: { CMySlider, CMyFieldRec, CMySize },
props: { props: {
modelValue: { modelValue: {
type: Object as PropType<IText>, type: Object as PropType<IText>,
@@ -36,6 +37,11 @@ export default defineComponent({
required: false, required: false,
default: true, default: true,
}, },
show_dimensioni: {
type: Boolean,
required: false,
default: false,
},
}, },
setup(props, { emit }) { setup(props, { emit }) {
const $q = useQuasar() const $q = useQuasar()

View File

@@ -27,7 +27,7 @@
> >
</q-select> </q-select>
<CMySlider <CMySlider
label="Margine tra l'immagine" label="Margine % tra l'immagine"
v-model="internalModel.font.perc_text" v-model="internalModel.font.perc_text"
:min="0" :min="0"
:max="100" :max="100"
@@ -45,7 +45,7 @@
></CMySlider> ></CMySlider>
<CMySlider <CMySlider
v-if="show_maxlength" v-if="show_maxlength"
label="Lunghezza Massima:" label="Max numero di caratteri:"
v-model="internalModel.maxlength" v-model="internalModel.maxlength"
:min="0" :min="0"
:max="1000" :max="1000"
@@ -53,10 +53,16 @@
addstr="" addstr=""
@update:model-value="modifElem" @update:model-value="modifElem"
></CMySlider> ></CMySlider>
<CMySize
v-if="show_dimensioni"
label="Dimensioni:"
v-model="internalModel.size"
@update:model-value="modifElem"
></CMySize>
<div> <div>
Parole Chiave: {autore} {titolo} {descrizione} {date_pub} {ranking} Parole Chiave: {autore} {titolo} {descrizione} {date_pub} {ranking}
{sottotitolo} {prezzo} {descrizione_estesa} {sottotitolo} {prezzo} {prezzo_scontato} {descrizione_estesa}
</div> </div>
<q-select <q-select

View File

61
src/components/CText/CText.ts Executable file
View File

@@ -0,0 +1,61 @@
import {
PropType,
computed,
defineComponent, onBeforeMount, onBeforeUnmount, onMounted, ref, toRef, toRefs, watch,
} from 'vue'
import { tools } from '@store/Modules/tools'
import { ICatalogo, IMyScheda, IProduct, ISchedaSingola, IText } from '@src/model'
import { useProducts } from '@store/Products'
import { useGlobalStore } from '@src/store/globalStore'
import { costanti } from '@costanti'
export default defineComponent({
name: 'CText',
props: {
rectext: {
type: Object as PropType<IText>,
required: true,
},
myproduct: {
type: Object as PropType<IProduct>,
required: true,
},
optcatalogo: {
type: Object as PropType<ICatalogo>,
required: true,
},
scheda: {
type: Object as PropType<IMyScheda>,
required: true,
},
show_at_right: {
type: Boolean,
required: false,
default: false,
},
},
setup(props, { attrs, slots, emit }) {
const globalStore = useGlobalStore()
const products = useProducts()
const getTesto = computed(() => {
return products.replaceKeyWordsByProduct(
props.optcatalogo,
props.myproduct,
props.rectext,
)
})
return {
tools,
getTesto,
globalStore,
costanti,
}
},
})

44
src/components/CText/CText.vue Executable file
View File

@@ -0,0 +1,44 @@
<template>
<!-- A DESTRA -->
<span
v-if="
getTesto && rectext.font?.posiz_text === costanti.POSIZ_TESTO.A_DESTRA
"
:class="'flex flex-col justify-between'"
:style="{
width: rectext.font?.perc_text ?? '50%',
...( rectext.size && rectext.size.height ? { height: tools.adjustSize(optcatalogo, rectext.size.height) } : {}),
marginTop: '0',
'--scalecatalog': tools.getScale(optcatalogo),
'line-height': rectext.font?.line_height,
}"
>
<div v-html="getTesto"></div>
<slot></slot>
</span>
<!-- IN BASSO -->
<span
v-else-if="
getTesto && rectext.font?.posiz_text === costanti.POSIZ_TESTO.IN_BASSO
"
:class="{ 'flex-details_and_barcode' : show_at_right }"
:style="{
width: rectext.font?.perc_text ?? '50%',
...( rectext.size && rectext.size.height ? { height: tools.adjustSize(optcatalogo, rectext.size.height) } : {}),
marginTop: '0rem',
'--scalecatalog': tools.getScale(optcatalogo),
'line-height': rectext.font?.line_height,
'gap': show_at_right && scheda.barcode.size?.gap ? tools.adjustSize(optcatalogo, scheda.barcode.size?.gap) : ''
}"
>
<div v-html="getTesto"></div>
<slot></slot>
</span>
</template>
<script lang="ts" src="./CText.ts">
</script>
<style lang="scss" scoped>
@import './CText.scss';
</style>

1
src/components/CText/index.ts Executable file
View File

@@ -0,0 +1 @@
export { default as CText } from './CText.vue'

View File

@@ -28,13 +28,27 @@
font-style: normal; font-style: normal;
} }
@font-face {
font-family: 'DIN-Pro-Condensed-Bold-Italic';
src: url('~src/assets/fonts/DIN-Pro-Condensed-Bold-Italic.otf') format('opentype');
font-weight: bold;
font-style: italic;
}
@font-face { @font-face {
font-family: 'DIN-Pro-Condensed-Regular'; font-family: 'DIN-Pro-Condensed-Regular';
src: url('~src/assets/fonts/DINPro-CondensedBold.otf') format('opentype'); src: url('~src/assets/fonts/DIN-Pro-Condensed-Regular.otf') format('opentype');
font-weight: normal; font-weight: normal;
font-style: normal; font-style: normal;
} }
@font-face {
font-family: 'DIN-Pro-Condensed-Medium-Italic';
src: url('~src/assets/fonts/DIN-Pro-Condensed-Medium-Italic.otf') format('opentype');
font-weight: normal;
font-style: italic;
}
@font-face { @font-face {
font-family: 'DINPro'; font-family: 'DINPro';
src: url('~src/assets/fonts/DINPro.otf') format('opentype'); src: url('~src/assets/fonts/DINPro.otf') format('opentype');
@@ -42,6 +56,13 @@
font-style: normal; font-style: normal;
} }
@font-face {
font-family: 'DINPro-Medium';
src: url('~src/assets/fonts/DINPro-Medium.otf') format('opentype');
font-weight: normal;
font-style: normal;
}
body { body {
font-family: Söhne, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; font-family: Söhne, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;

View File

@@ -696,6 +696,7 @@ export interface IFont {
line_height?: number line_height?: number
posiz_text?: number posiz_text?: number
perc_text?: string perc_text?: string
height?: string
} }
export interface IBorder { export interface IBorder {
@@ -731,6 +732,7 @@ export interface IBarCode {
size?: ISize size?: ISize
font?: IFont font?: IFont
widthlines?: number widthlines?: number
show_at_right?: boolean
} }
export interface IPagina { export interface IPagina {
@@ -766,6 +768,7 @@ export interface IText {
contenuto?: string contenuto?: string
maxlength?: number maxlength?: number
font?: IFont font?: IFont
size?: ISize
} }
export interface IElementiScheda { export interface IElementiScheda {
@@ -784,6 +787,7 @@ export interface IMyScheda {
numschede_perRiga?: number numschede_perRiga?: number
numschede_perCol?: number numschede_perCol?: number
show_separatore: boolean show_separatore: boolean
testo_right_attaccato?: IText
testo_right?: IText testo_right?: IText
testo_bottom?: IText testo_bottom?: IText
barcode?: IBarCode, barcode?: IBarCode,

View File

@@ -579,6 +579,7 @@ export default defineComponent({
function eseguiCmd() { function eseguiCmd() {
risultato.value = '' risultato.value = ''
userStore.importToServerCmd($q, t, cosafare.value, null) userStore.importToServerCmd($q, t, cosafare.value, null)
} }

View File

@@ -12,7 +12,7 @@
<div class="q-ma-sm q-gutter-sm q-pa-xs"> <div class="q-ma-sm q-gutter-sm q-pa-xs">
<CTitleBanner title="Pagine"></CTitleBanner> <CTitleBanner title="Pagine"></CTitleBanner>
<CGridTableRec <CGridTableRec
prop_mytable="mypage" prop_mytable="mypages"
prop_mytitle="Lista Pagine" prop_mytitle="Lista Pagine"
:prop_mycolumns="colmypage" :prop_mycolumns="colmypage"
prop_colkey="title" prop_colkey="title"

View File

@@ -1211,6 +1211,7 @@ const msg_it = {
mypages: { mypages: {
duplica_newname: 'Inserisci il nome della Nuova Pagina (senza spazi)', duplica_newname: 'Inserisci il nome della Nuova Pagina (senza spazi)',
duplica_conferma: 'Duplicare {path} creando {newpath}', duplica_conferma: 'Duplicare {path} creando {newpath}',
esporta_conferma: 'Esportare la pagina {path} su {nomefile} ?',
attivita: 'Attività', attivita: 'Attività',
find_people: 'Cerca Persone', find_people: 'Cerca Persone',
find_group: 'Cerca Gruppo', find_group: 'Cerca Gruppo',
@@ -1240,6 +1241,10 @@ const msg_it = {
follow_circuits: 'I tuoi Circuiti RIS', follow_circuits: 'I tuoi Circuiti RIS',
duplicateok: 'Pagina Duplicata con successo', duplicateok: 'Pagina Duplicata con successo',
duplicateerr: 'Errore nel duplicare la pagina', duplicateerr: 'Errore nel duplicare la pagina',
expok: 'Pagina Esportata con successo',
experr: 'Errore nell\'esportare la pagina',
impok: 'Dati Importati con successo',
imperr: 'Errore nell\'importare la pagina',
}, },
friends: { friends: {
accept_trust: 'Accetta', accept_trust: 'Accetta',

View File

@@ -163,6 +163,7 @@ export const colIText = [
AddCol({ name: 'maxlength', label_trans: 'catalogo.maxlength', fieldtype: costanti.FieldType.number }), AddCol({ name: 'maxlength', label_trans: 'catalogo.maxlength', fieldtype: costanti.FieldType.number }),
AddCol({ name: 'posiz_text', label_trans: 'catalogo.posiz_text', fieldtype: costanti.FieldType.number }), AddCol({ name: 'posiz_text', label_trans: 'catalogo.posiz_text', fieldtype: costanti.FieldType.number }),
AddCol({ name: 'perc_text', label_trans: 'catalogo.perc_text', fieldtype: costanti.FieldType.string }), AddCol({ name: 'perc_text', label_trans: 'catalogo.perc_text', fieldtype: costanti.FieldType.string }),
AddCol({ name: 'margintop', label_trans: 'catalogo.margintop', fieldtype: costanti.FieldType.string }),
AddCol({ name: 'line_height', label_trans: 'catalogo.line_height', fieldtype: costanti.FieldType.number }), AddCol({ name: 'line_height', label_trans: 'catalogo.line_height', fieldtype: costanti.FieldType.number }),
] ]
export const colmyIImg = [ export const colmyIImg = [

View File

@@ -3527,6 +3527,13 @@ export const tools = {
return mydate return mydate
}, },
getDateYYYYMMDD_Today() {
// Ottieni la data attuale nel formato YYYY-MM-DD
const today = new Date();
const formattedDate = today.toISOString().split('T')[0]; // Format YYYY-MM-DD
return formattedDate
},
isDateArrived(mydate: Date | number | string | undefined) { isDateArrived(mydate: Date | number | string | undefined) {
const datenow = this.getDateNow() const datenow = this.getDateNow()
const diff = date.getDateDiff(datenow, mydate) const diff = date.getDateDiff(datenow, mydate)
@@ -8012,9 +8019,9 @@ export const tools = {
} else if (!!myrow && !!myrow.directory) { } else if (!!myrow && !!myrow.directory) {
ris = myrow.directory ris = myrow.directory
} else if (table === 'myelems') { } else if (table === 'myelems') {
ris = 'pages/' + myrow.path ris = 'pages/' + (path ? path : myrow.path)
} else if (table === 'listcards') { } else if (table === 'listcards') {
ris = 'pages/' + myrow.path ris = 'pages/' + (path ? path : myrow.path)
} else if (table === 'imgcards') { } else if (table === 'imgcards') {
ris = 'pages/' + path ris = 'pages/' + path
} else if (table === 'productInfos') { } else if (table === 'productInfos') {
@@ -8024,10 +8031,11 @@ export const tools = {
} else { } else {
ris = table ris = table
} }
} catch (e) { } catch (e) {
console.error('err getDirectoryGall', e) console.error('err getDirectoryGall', e)
} }
// console.log('getDirectoryGall', ris) console.log('getDirectoryGall', ris, 'mypath', path, 'myrow', myrow)
return ris return ris
}, },
@@ -8035,7 +8043,7 @@ export const tools = {
return costanti.DIR_UPLOAD + 'pages/' + elem.path + '/' + filename return costanti.DIR_UPLOAD + 'pages/' + elem.path + '/' + filename
}, },
getImgFileByElem(elem: IMyElem, reccard?: IMyCard) { getImgFileByElem(elem: IMyElem, reccard?: IMyCard, path?: string) {
if (elem) { if (elem) {
let addtourl = '' let addtourl = ''
@@ -8043,21 +8051,23 @@ export const tools = {
addtourl = '?v=' + elem.vers_img addtourl = '?v=' + elem.vers_img
} }
const mypath = (path ? path : elem.path)
if (elem.type === shared_consts.ELEMTYPE.CARD) { if (elem.type === shared_consts.ELEMTYPE.CARD) {
if (reccard?.imagefile) { if (reccard?.imagefile) {
if (reccard.vers_img) { if (reccard.vers_img) {
addtourl = '?v=' + reccard.vers_img addtourl = '?v=' + reccard.vers_img
} }
return costanti.DIR_UPLOAD + 'pages/' + elem.path + '/' + reccard.imagefile + addtourl return costanti.DIR_UPLOAD + 'pages/' + mypath + '/' + reccard.imagefile + addtourl
} else } else
return '' return ''
} else if (elem.type === shared_consts.ELEMTYPE.IMAGE) { } else if (elem.type === shared_consts.ELEMTYPE.IMAGE) {
return costanti.DIR_UPLOAD + 'pages/' + elem.path + '/' + elem.container + addtourl return costanti.DIR_UPLOAD + 'pages/' + mypath + '/' + elem.container + addtourl
} else if (elem.type === shared_consts.ELEMTYPE.QRCODE) { } else if (elem.type === shared_consts.ELEMTYPE.QRCODE) {
return costanti.DIR_UPLOAD + 'pages/' + elem.path + '/' + elem.image + addtourl return costanti.DIR_UPLOAD + 'pages/' + mypath + '/' + elem.image + addtourl
} else { } else {
return costanti.DIR_UPLOAD + 'pages/' + elem.path + '/' + elem.image + addtourl return costanti.DIR_UPLOAD + 'pages/' + mypath + '/' + elem.image + addtourl
} }
} }
}, },
@@ -9300,6 +9310,9 @@ export const tools = {
size: '14px', size: '14px',
} }
} }
if (!rec.size) {
rec.size = this.resetISize(rec.size!)
}
return rec return rec
}, },

View File

@@ -1283,7 +1283,8 @@ export const useProducts = defineStore('Products', {
const ranking = myproduct.indiceRanking! || 0; const ranking = myproduct.indiceRanking! || 0;
const venduti = myproduct.productInfo.totaleVenduti! || 0; const venduti = myproduct.productInfo.totaleVenduti! || 0;
const debugstr = " Rank=" + ranking + "<br> 1Y=" + (myproduct.productInfo.rank1Y! || '') + '<br> Venduti=' + venduti + '<br> Data Pubb=' + date_pub const linkvenduti = '<a href="http://vps-88271abb.vps.ovh.net/apimacro/public/view-ordini-by-idarticolo/' + myproduct.productInfo.sku + '" target="_blank">'+venduti+'</a>'
const debugstr = " Rank=" + ranking + "<br> 1Y=" + (myproduct.productInfo.rank1Y! || '') + '<br> Venduti=' + linkvenduti + '<br> Data Pubb=' + date_pub
const truncatedDescription = description.length > maxDescriptionLength const truncatedDescription = description.length > maxDescriptionLength
? description.substring(0, description.lastIndexOf(' ', maxDescriptionLength)) + '...' ? description.substring(0, description.lastIndexOf(' ', maxDescriptionLength)) + '...'
@@ -1355,7 +1356,7 @@ export const useProducts = defineStore('Products', {
result = result.replace(new RegExp(key, 'g'), value); result = result.replace(new RegExp(key, 'g'), value);
} }
return result return result.trim()
}, },

View File

@@ -1926,6 +1926,10 @@ export const useUserStore = defineStore('UserStore', {
}, },
async importToServerCmd($q: any, t: any, cmd: number, data: any, recorddaimportare: boolean = false) { async importToServerCmd($q: any, t: any, cmd: number, data: any, recorddaimportare: boolean = false) {
$q.loading.show({
message: 'Importazione in corso, attendere ...'
})
return Api.SendReq('/admin/import', 'POST', { cmd, data }) return Api.SendReq('/admin/import', 'POST', { cmd, data })
.then((res: any) => { .then((res: any) => {
if (res) { if (res) {
@@ -1953,7 +1957,9 @@ export const useUserStore = defineStore('UserStore', {
} }
} }
$q.loading.hide()
}).catch((error) => { }).catch((error) => {
$q.loading.hide()
tools.showNegativeNotif($q, t('db.recfailed')) tools.showNegativeNotif($q, t('db.recfailed'))
return {} return {}
}) })

View File

@@ -272,7 +272,17 @@ export const useGlobalStore = defineStore('GlobalStore', {
}, },
getPage: (state: IGlobalState) => (path: string): IMyPage | undefined => state.mypage.find((page) => (`/${page.path}`) === path), getPage: (state: IGlobalState) => (path: string): IMyPage | undefined => state.mypage.find((page) => (`/${page.path}`) === path),
getPageById: (state: IGlobalState) => (idpage: string): IMyPage | undefined => state.mypage.find((page) => (`/${page._id}`) === idpage), getPageById: (state: IGlobalState) => (idpage: string): IMyPage | undefined => {
const mypage = state.mypage.find((page) => (`${page._id}`) === idpage)
return mypage
},
getPathByIdPage: (state: IGlobalState) => (idpage: string): string => {
const mypage = state.mypage.find((page) => (`${page._id}`) === idpage)
if (mypage) {
return mypage.path!
}
return ''
},
getMyElemsByIdPage: (state: IGlobalState) => (idPage?: string): IMyElem[] | [] => { getMyElemsByIdPage: (state: IGlobalState) => (idPage?: string): IMyElem[] | [] => {
return state.myelems.filter((page: IMyElem) => (page._id === idPage)).sort((a: any, b: any) => a.order - b.order) return state.myelems.filter((page: IMyElem) => (page._id === idPage)).sort((a: any, b: any) => a.order - b.order)
@@ -1203,6 +1213,9 @@ export const useGlobalStore = defineStore('GlobalStore', {
let newpath = prompt(t('mypages.duplica_newname')) let newpath = prompt(t('mypages.duplica_newname'))
if (!newpath)
return false
$q.dialog({ $q.dialog({
message: t('mypages.duplica_conferma', { path, newpath }), message: t('mypages.duplica_conferma', { path, newpath }),
ok: { label: t('dialog.yes'), push: true }, ok: { label: t('dialog.yes'), push: true },
@@ -1230,6 +1243,46 @@ export const useGlobalStore = defineStore('GlobalStore', {
}, },
async exportPage(path: string, $q: any, t: any) {
const userStore = useUserStore()
return Api.SendReq('/exppage', 'POST', { path })
.then((res) => {
if (res && res.data && res.data.json) {
tools.showPositiveNotif($q, t('mypages.expok'))
return res.data.json
} else {
tools.showNegativeNotif($q, t('mypages.experr'))
return null
}
})
.catch((error) => {
console.log('error loadTable', error)
userStore.setErrorCatch(error)
return null
})
},
importPage(jsonString: string, $q: any, t: any) {
const userStore = useUserStore()
return Api.SendReq('/imppage', 'POST', { jsonString })
.then((res) => {
if (res && res.data && res.data.ris) {
tools.showPositiveNotif($q, t('mypages.impok'))
return res.data.ris
} else {
tools.showNegativeNotif($q, t('mypages.imperr'))
return null
}
})
.catch((error) => {
console.log('error importPage', error)
userStore.setErrorCatch(error)
return null
})
},
async loadPageTest() { async loadPageTest() {
console.log('loadPageTest') console.log('loadPageTest')
@@ -2301,7 +2354,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
return; return;
} }
const filenameToDownload = tools.removeFileExtension(pdfFile.name) + '-output.pdf' const filenameToDownload = tools.removeFileExtension(pdfFile.name) + '-compresso.pdf'
const formData = new FormData(); const formData = new FormData();
if (pdfFile instanceof File) { if (pdfFile instanceof File) {

View File

@@ -1,4 +1,5 @@
$heightBtn: 100%; $heightBtn: 100%;
$colore_titolo_libro: rgb(210, 12, 12);
body { body {
line-height: 1.2 !important; line-height: 1.2 !important;
@@ -71,34 +72,35 @@ body {
.book-title { .book-title {
font-family: 'DINPro-CondensedBold', sans-serif; font-family: 'DINPro-CondensedBold', sans-serif;
color: rgba(255, 0, 0, 1); color: $colore_titolo_libro;
text-transform: uppercase; text-transform: uppercase;
margin-top: calc(5 * var(--scalecatalog) * 1px); margin-top: calc(5 * var(--scalecatalog) * 1px);
margin-bottom: calc(5 * var(--scalecatalog) * 1px); margin-bottom: calc(5 * var(--scalecatalog) * 1px);
font-size: calc(18 * var(--scalecatalog) * 1px); font-size: calc(20 * var(--scalecatalog) * 1px);
line-height: 100%;
} }
.book-author { .book-author {
font-family: 'DIN-Pro-Condensed-Regular', sans-serif; font-family: 'DIN-Pro-Condensed-Regular', sans-serif;
font-size: calc(16 * var(--scalecatalog) * 1px); font-size: calc(18 * var(--scalecatalog) * 1px);
} }
.book-descr { .book-descr {
font-family: 'DINPro-BoldItalic', sans-serif; font-family: 'DIN-Pro-Condensed-Bold-Italic', sans-serif;
font-size: calc(14 * var(--scalecatalog) * 1px); font-size: calc(16 * var(--scalecatalog) * 1px);
} }
.book-details { .book-details {
font-family: 'DINPro', sans-serif; font-family: 'DIN-Pro-Condensed-Regular', sans-serif;
margin-bottom: calc(5 * var(--scalecatalog) * 1px); margin-bottom: calc(5 * var(--scalecatalog) * 1px);
font-size: calc(12 * var(--scalecatalog) * 1px); font-size: calc(13 * var(--scalecatalog) * 1px);
text-align: left !important; text-align: left !important;
} }
.book-descr-estesa { .book-descr-estesa {
font-family: 'DINPro', sans-serif; font-family: 'AGaramondPro-Regular', sans-serif;
font-size: calc(14 * var(--scalecatalog) * 1px); font-size: calc(15 * var(--scalecatalog) * 1px);
text-align: justify; text-align: justify;
word-wrap: break-word; word-wrap: break-word;
} }

View File

@@ -877,14 +877,21 @@ export default defineComponent({
const paddingLeft = tools.adjustSize(optcatalogo.value, recscheda.scheda?.dimensioni?.riga?.padding?.left) || '0'; const paddingLeft = tools.adjustSize(optcatalogo.value, recscheda.scheda?.dimensioni?.riga?.padding?.left) || '0';
const paddingRight = tools.adjustSize(optcatalogo.value, recscheda.scheda?.dimensioni?.riga?.padding?.right) || '0'; const paddingRight = tools.adjustSize(optcatalogo.value, recscheda.scheda?.dimensioni?.riga?.padding?.right) || '0';
return { let out: any = {
placeContent, placeContent,
flex: `0 1 ${width} !important;`, flex: `0 1 ${width} !important;`,
margin: `${marginTop} ${marginRight} ${marginBottom} ${marginLeft}`, margin: `${marginTop} ${marginRight} ${marginBottom} ${marginLeft}`,
padding: `${paddingTop} ${paddingRight} ${paddingBottom} ${paddingLeft}`, padding: `${paddingTop} ${paddingRight} ${paddingBottom} ${paddingLeft}`
...(width ? { width: `${width} !important;` } : {}), }
...(height ? { height: `${height} !important;` } : {}) // Aggiungi l'altezza solo se è valorizzata
}; if (width) {
out.width = `${width} !important;`
}
if (height) {
out.height = `${height} !important;`
}
return out
} }
@@ -906,6 +913,7 @@ export default defineComponent({
return { return {
placeContent, placeContent,
alignSelf: 'flex-start',
flex: `0 1 ${width} !important;`, flex: `0 1 ${width} !important;`,
margin: `${marginTop} ${marginRight} ${marginBottom} ${marginLeft}`, margin: `${marginTop} ${marginRight} ${marginBottom} ${marginLeft}`,
padding: `${paddingTop} ${paddingRight} ${paddingBottom} ${paddingLeft}`, padding: `${paddingTop} ${paddingRight} ${paddingBottom} ${paddingLeft}`,

View File

@@ -330,6 +330,7 @@
<!-- Itera sui prodotti di ogni riga --> <!-- Itera sui prodotti di ogni riga -->
<div class="row justify-center"> <div class="row justify-center">
<span v-if="optcatalogo.indebug">{{getStyleSchedaProdotto(recscheda)}}</span>
<div <div
v-for="(prod, colIndex) in row" v-for="(prod, colIndex) in row"
:key="`${pageIndex}-${rowIndex}-${colIndex}`" :key="`${pageIndex}-${rowIndex}-${colIndex}`"