- il catalogo si aggiorna in base alle impostazioni del template anche per la "Stampa"
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -1788,15 +1788,6 @@
|
||||
@update:model-value="modifElem"
|
||||
>
|
||||
</q-toggle>
|
||||
<q-input
|
||||
label="Nome Template"
|
||||
@update:model-value="modifElem"
|
||||
v-model="myel.catalogo.dimensioni_def.name"
|
||||
filled
|
||||
debounce="1000"
|
||||
v-on:keyup.enter="saveElem"
|
||||
>
|
||||
</q-input>
|
||||
<q-select
|
||||
:behavior="$q.platform.is.ios === true ? 'dialog' : 'menu'"
|
||||
v-if="enableEdit"
|
||||
@@ -2380,7 +2371,6 @@
|
||||
@saveFieldElem="saveFieldElem"
|
||||
@update:model-value="modifElem"
|
||||
label="Testo"
|
||||
debounce="1000"
|
||||
>
|
||||
</CMyText>
|
||||
</div>
|
||||
@@ -2409,7 +2399,6 @@
|
||||
@saveFieldElem="saveFieldElem"
|
||||
@update:model-value="modifElem"
|
||||
label="Testo"
|
||||
debounce="1000"
|
||||
>
|
||||
</CMyText>
|
||||
</div>
|
||||
@@ -2422,7 +2411,30 @@
|
||||
label="Per Stampa"
|
||||
icon="fas fa-play-circle"
|
||||
>
|
||||
<div class="sfondo_print">
|
||||
<q-toggle
|
||||
v-model="myel.catalogo.print_isTemplate"
|
||||
color="positive"
|
||||
icon="fas fa-file-pdf"
|
||||
label="E' un template"
|
||||
@update:model-value="modifElem"
|
||||
>
|
||||
</q-toggle>
|
||||
<q-select
|
||||
:behavior="$q.platform.is.ios === true ? 'dialog' : 'menu'"
|
||||
v-if="enableEdit"
|
||||
rounded
|
||||
outlined
|
||||
v-model="myel.catalogo.print_linkIdTemplate"
|
||||
:options="Products.getOptCatalogoPrintTemplate()"
|
||||
@update:model-value="modifElem"
|
||||
label="Catalogo Stampa collegato:"
|
||||
style="width: 250px"
|
||||
emit-value
|
||||
map-options
|
||||
>
|
||||
</q-select>
|
||||
|
||||
<div :class="{ 'sfondo_print': !myel.catalogo.print_linkIdTemplate, 'bg-grey': myel.catalogo.print_linkIdTemplate }">
|
||||
Per Stampa:
|
||||
<q-toggle
|
||||
v-model="myel.catalogo.printable"
|
||||
|
||||
@@ -57,12 +57,14 @@ export default defineComponent({
|
||||
|
||||
const sliderValue = computed({
|
||||
get: () => {
|
||||
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() {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -903,6 +903,9 @@ export interface IOptCatalogo {
|
||||
last_page?: IDimensioni
|
||||
areadistampa?: IAreaDiStampa
|
||||
|
||||
print_isTemplate?: boolean
|
||||
print_linkIdTemplate?: string
|
||||
|
||||
dimensioni_def?: IElementiPagina
|
||||
|
||||
arrSchede?: ISchedaSingola[]
|
||||
|
||||
@@ -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 = [];
|
||||
|
||||
@@ -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: '',
|
||||
};
|
||||
},
|
||||
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
@@ -90,11 +90,6 @@
|
||||
id="spinner"
|
||||
:showing="generatinglist"
|
||||
>
|
||||
<q-spinner-tail
|
||||
color="primary"
|
||||
size="4em"
|
||||
>
|
||||
</q-spinner-tail>
|
||||
</q-inner-loading>
|
||||
|
||||
<q-tab-panel
|
||||
@@ -227,7 +222,7 @@
|
||||
</div>
|
||||
|
||||
<CProductTable
|
||||
v-if="loadpage && lista_prodotti?.length > 0"
|
||||
v-if="!ismounting && lista_prodotti?.length > 0"
|
||||
:lista_prodotti="lista_prodotti"
|
||||
@update:lista_prodotti="updateProducts"
|
||||
:optcatalogo="optcatalogo"
|
||||
@@ -244,23 +239,18 @@
|
||||
id="spinner"
|
||||
:showing="generatinglist"
|
||||
>
|
||||
<q-spinner-tail
|
||||
color="primary"
|
||||
size="4em"
|
||||
>
|
||||
</q-spinner-tail>
|
||||
</q-inner-loading>
|
||||
<div class="row justify-center q-mx-auto bg-blue-1">
|
||||
<div class="text-center">
|
||||
<q-spinner
|
||||
v-if="!loadpage"
|
||||
v-if="ismounting"
|
||||
color="primary"
|
||||
size="3em"
|
||||
:thickness="2"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
v-if="loadpage"
|
||||
v-if="!ismounting"
|
||||
class="panel"
|
||||
>
|
||||
<div class="container">
|
||||
@@ -643,7 +633,7 @@
|
||||
<div :style="generateStyleCatalogo(optcatalogo)">
|
||||
<div class="flex-container-book">
|
||||
<q-infinite-scroll
|
||||
v-if="!optcatalogo.pdf && arrLoaded && arrLoaded.length > 0"
|
||||
v-if="!optcatalogo.pdf && arrLoaded && arrLoaded.length > 0 && !ismounting"
|
||||
ref="myinfscroll"
|
||||
:initial-index="0"
|
||||
@load="onLoadScroll"
|
||||
|
||||
Reference in New Issue
Block a user