diff --git a/src/components/CMyEditElem/CMyEditElem.ts b/src/components/CMyEditElem/CMyEditElem.ts index cceaa023..ca35112c 100755 --- a/src/components/CMyEditElem/CMyEditElem.ts +++ b/src/components/CMyEditElem/CMyEditElem.ts @@ -345,6 +345,8 @@ export default defineComponent({ if (!myel.value.catalogo.areadistampa) { myel.value.catalogo.areadistampa = tools.resetRecIAreaDiStampa(null); myel.value.catalogo.areadistampa.margini = { left: '0.59', top: '0.59', right: '0.59', bottom: '0.28' }; + myel.value.catalogo.print_isTemplate = false; + myel.value.catalogo.print_linkIdTemplate = ''; } myel.value.catalogo.areadistampa = tools.resetRecIAreaDiStampa(myel.value.catalogo.areadistampa); @@ -363,6 +365,8 @@ export default defineComponent({ myel.value.catalogo.dimensioni_def.pagina ); } + + console.log('Area di stampa MOUNTED... ',myel.value.catalogo.areadistampa) } catch (error) { console.log(error); } diff --git a/src/components/CMyEditElem/CMyEditElem.vue b/src/components/CMyEditElem/CMyEditElem.vue index a2cf5140..9705606a 100755 --- a/src/components/CMyEditElem/CMyEditElem.vue +++ b/src/components/CMyEditElem/CMyEditElem.vue @@ -1788,15 +1788,6 @@ @update:model-value="modifElem" > - - @@ -2409,7 +2399,6 @@ @saveFieldElem="saveFieldElem" @update:model-value="modifElem" label="Testo" - debounce="1000" > @@ -2422,7 +2411,30 @@ label="Per Stampa" icon="fas fa-play-circle" > -
+ + + + + +
Per Stampa: { - if (!props.modelValue) - return '' - const mystr = props.modelValue + '' - return mystr.replace(props.addstr, '') + if (!props.modelValue) return 0; + const clean = String(props.modelValue).replace(props.addstr, ''); + return Number(clean) || 0; }, - set: (value) => emit('update:modelValue', value ? value + props.addstr : '') + set: (value) => { + const valWithSuffix = value ? value + props.addstr : ''; + emit('update:modelValue', valWithSuffix); + } }) function valoreinc() { diff --git a/src/components/CSearchProduct/CSearchProduct.ts b/src/components/CSearchProduct/CSearchProduct.ts index ec9ad350..5e3f27d0 100755 --- a/src/components/CSearchProduct/CSearchProduct.ts +++ b/src/components/CSearchProduct/CSearchProduct.ts @@ -208,6 +208,13 @@ export default defineComponent({ } } + if (optcatalogo.value.print_linkIdTemplate) { + const reccatalog = globalStore.sovrascriviAreadistampaFromTemplate(optcatalogo.value.print_linkIdTemplate, optcatalogo.value); + if (reccatalog) { + optcatalogo.value.areadistampa = { ...reccatalog.areadistampa}; + } + } + // LINK SCHEDA for (const recscheda of optcatalogo.value.arrSchede!) { if (recscheda.scheda?.linkIdTemplate) { diff --git a/src/model/GlobalStore.ts b/src/model/GlobalStore.ts index 217556de..331d9069 100755 --- a/src/model/GlobalStore.ts +++ b/src/model/GlobalStore.ts @@ -903,6 +903,9 @@ export interface IOptCatalogo { last_page?: IDimensioni areadistampa?: IAreaDiStampa + print_isTemplate?: boolean + print_linkIdTemplate?: string + dimensioni_def?: IElementiPagina arrSchede?: ISchedaSingola[] diff --git a/src/store/Products.ts b/src/store/Products.ts index 55c0a928..15cec46d 100755 --- a/src/store/Products.ts +++ b/src/store/Products.ts @@ -1936,6 +1936,32 @@ export const useProducts = defineStore('Products', { return arr }, + getOptCatalogoPrintTemplate() { + // Ottieni l'array delle pagine che in cataloghi sono dimensioni_def.isTemplate + + let arr: any = []; + + const globalStore = useGlobalStore(); + + arr.push({ label: '[Nessuna]', value: '' }); + + for (const myelem of globalStore.myelems) { + if (myelem.catalogo && myelem.catalogo.print_isTemplate) { + const page = globalStore.getPageById(myelem.idPage); + let pagename = page ? page.title! : ''; + + if (pagename) { + pagename = '[Pag: ' + pagename + '] '; + } + + const mylabel = pagename; + + arr.push({ label: mylabel, value: myelem._id }); + } + }; + + return arr + }, getSchedeOpt(arrschede: ISchedaSingola[], tag?: string): any[] { let arr: any = []; diff --git a/src/store/globalStore.ts b/src/store/globalStore.ts index 54584f08..0ee5a77e 100644 --- a/src/store/globalStore.ts +++ b/src/store/globalStore.ts @@ -238,7 +238,7 @@ export const useGlobalStore = defineStore('GlobalStore', { }, sovrascriviPaginaDefaultFromTemplate: - (state: IGlobalState) => (idTemplate: string, origDimensioni: IDimensioni, optcatalogo: IOptCatalogo) => { + (state: IGlobalState) => (idTemplate: string, origDimensioni: IDimensioni) => { const myfindelem = state.myelems.find((myelem: IMyElem) => myelem._id === idTemplate); @@ -261,6 +261,28 @@ export const useGlobalStore = defineStore('GlobalStore', { return null; }, + sovrascriviAreadistampaFromTemplate: + (state: IGlobalState) => (idTemplate: string, optCatalogo: IOptCatalogo) => { + + const myfindelem = state.myelems.find((myelem: IMyElem) => myelem._id === idTemplate); + + const linkIdTemplate = optCatalogo.print_linkIdTemplate; + + if (myfindelem) { + const myelemtocopy = tools.jsonCopy(myfindelem); + + if (myelemtocopy) { + // myelemtocopy.scheda._id = origScheda.scheda?._id; + myelemtocopy.catalogo.print_isTemplate = false; + myelemtocopy.catalogo.print_linkIdTemplate = linkIdTemplate; + + return myelemtocopy.catalogo; + } + } + + return null; + }, + // conta: (state: IGlobalState) => { state.conta }, // listatodo: (state: IGlobalState) => { state.listatodo }, // category: (state: IGlobalState) => { state.category }, @@ -2499,6 +2521,9 @@ export const useGlobalStore = defineStore('GlobalStore', { pagina: tools.resetRecIDimensioni(null), }, areadistampa: tools.resetRecIAreaDiStampa(null), + print_isTemplate: false, + print_linkIdTemplate: '', + }; }, createRaccoltaCataloghiVuoto(): IOptCatalogo { @@ -2517,6 +2542,8 @@ export const useGlobalStore = defineStore('GlobalStore', { pagina: tools.resetRecIDimensioni(null), }, areadistampa: tools.resetRecIAreaDiStampa(null), + print_isTemplate: false, + print_linkIdTemplate: '', }; }, diff --git a/src/views/ecommerce/catalogo/catalogo.ts b/src/views/ecommerce/catalogo/catalogo.ts index ff72b008..b45d0bb1 100755 --- a/src/views/ecommerce/catalogo/catalogo.ts +++ b/src/views/ecommerce/catalogo/catalogo.ts @@ -90,6 +90,8 @@ export default defineComponent({ const heightpdf = ref('12.31'); const compressionepdf = ref('prepress'); + const ismounting = ref(false) + const optDisp = ref([ { label: 'Tutti', value: costanti.DISP.TUTTI }, { label: 'Disponibili', value: costanti.DISP.DISPONIBILI }, @@ -578,7 +580,7 @@ export default defineComponent({ } function populateDataWithlinkIdTemplate() { - // console.log('populateDataWithlinkIdTemplate') + console.log('populateDataWithlinkIdTemplate') if (optcatalogo.value) { // LINK PAGINA @@ -589,6 +591,25 @@ export default defineComponent({ } } + if (optcatalogo.value.print_linkIdTemplate) { + const reccat2 = globalStore.sovrascriviAreadistampaFromTemplate(optcatalogo.value.print_linkIdTemplate, optcatalogo.value); + if (reccat2) { + const optcatalogo2 = { ...optcatalogo.value }; + // optcatalogo2.areadistampa = { ...reccat2.areadistampa}; + optcatalogo2.areadistampa.margini = reccat2.areadistampa.margini; + optcatalogo2.areadistampa.unit = reccat2.areadistampa.unit; + optcatalogo2.areadistampa.scalecanvas = reccat2.areadistampa.scalecanvas; + optcatalogo2.areadistampa.scale_printable = reccat2.areadistampa.scale_printable; + optcatalogo2.areadistampa.format = reccat2.areadistampa.format; + optcatalogo2.areadistampa.orientation = reccat2.areadistampa.orientation; + optcatalogo2.areadistampa.compress = reccat2.areadistampa.compress; + + // optcatalogo.value = optcatalogo2; + // optcatalogo.value.areadistampa.margini = { left: '50'}; + } + // console.log('areadistampa', optcatalogo.value.areadistampa) + } + for (const recscheda of optcatalogo.value.arrSchede!) { if (recscheda.scheda?.linkIdTemplate) { // ricopia da Template: @@ -914,6 +935,8 @@ export default defineComponent({ console.log('***** FINE calcArrPROD'); + console.log('areadistampa FINITO...', optcatalogo.value.areadistampa) + generatinglist.value = false; rigeneraLibri.value = false; } @@ -1304,6 +1327,7 @@ export default defineComponent({ async function mounted() { // console.log('mounted Catalogo') + ismounting.value = true generatinglist.value = true; if (optcatalogo.value.showListaArgomenti) cat.value = tools.getCookie(getKeyCatAtLoad(), ''); @@ -1364,6 +1388,8 @@ export default defineComponent({ window.addEventListener('scroll', handleScroll); calcArrProducts(); + + ismounting.value = false } function loaddata() { @@ -1863,7 +1889,7 @@ export default defineComponent({ await nextTick(); $q.loading.show({ - message: 'Caricamento immagini e generazione PDF in corso...', + message: 'Generazione PDF in corso, attendere ...', }); try { @@ -2080,6 +2106,7 @@ export default defineComponent({ getCollane, pubblicaPDF, pubblicaPDFStampa, + ismounting, }; }, }); diff --git a/src/views/ecommerce/catalogo/catalogo.vue b/src/views/ecommerce/catalogo/catalogo.vue index c76f1ac4..f16e98e9 100755 --- a/src/views/ecommerce/catalogo/catalogo.vue +++ b/src/views/ecommerce/catalogo/catalogo.vue @@ -90,11 +90,6 @@ id="spinner" :showing="generatinglist" > - - - -
@@ -643,7 +633,7 @@