- ho migliorato la grafica della generazione del PDF e PDF Stampa.

This commit is contained in:
Surya Paolo
2025-05-15 19:18:50 +02:00
parent 9e0634da05
commit 685bc34bd0
16 changed files with 570 additions and 476 deletions

View File

@@ -14,6 +14,7 @@ import { shared_consts } from '@src/common/shared_vuejs';
import { CProductCard } from '@src/components/CProductCard';
import { CMyDialog } from '@src/components/CMyDialog';
import { CTitleBanner } from '@src/components/CTitleBanner';
import { CMySelect } from '@src/components/CMySelect';
import { CMyValueDb } from '@src/components/CMyValueDb';
import { CProductTable } from '@src/components/CProductTable';
@@ -57,6 +58,7 @@ export default defineComponent({
CSearchProduct,
CMyDialog,
CMyValueDb,
CTitleBanner,
},
emits: ['update:modelValue', 'updateCatalogo'],
props: {
@@ -90,7 +92,33 @@ export default defineComponent({
const heightpdf = ref('12.31');
const compressionepdf = ref('prepress');
const ismounting = ref(false)
const ismounting = ref(false);
const pdfColumns = [
{ name: 'name', label: 'Nome', field: 'name', align: 'left' },
{ name: 'pdf', label: 'PDF', field: 'pdf', align: 'left' },
{ name: 'data', label: 'Data', field: 'data', align: 'left' },
{ name: 'azioni', label: 'Azioni', field: 'azioni', align: 'center' },
];
const pdfRows = computed(() => [
{
name: 'PDF Generato',
pdf: getCatalogoByMyPage.value.pdf_generato,
data: getCatalogoByMyPage.value.data_generato,
showButton: getCatalogoByMyPage.value.data_generato !== getCatalogoByMyPage.value.data_online,
buttonLabel: 'Pubblica PDF OnLine',
action: pubblicaPDF,
},
{
name: 'PDF Generato Stampa',
pdf: getCatalogoByMyPage.value.pdf_generato_stampa,
data: getCatalogoByMyPage.value.data_generato_stampa,
showButton: getCatalogoByMyPage.value.data_generato_stampa !== getCatalogoByMyPage.value.data_online_stampa,
buttonLabel: 'Pubblica PDF Stampa',
action: pubblicaPDFStampa,
},
]);
const optDisp = ref([
{ label: 'Tutti', value: costanti.DISP.TUTTI },
@@ -585,14 +613,20 @@ export default defineComponent({
if (optcatalogo.value) {
// LINK PAGINA
if (optcatalogo.value.dimensioni_def.linkIdTemplate) {
const reccatalog = globalStore.sovrascriviPaginaDefaultFromTemplate(optcatalogo.value.dimensioni_def.linkIdTemplate, optcatalogo.value.dimensioni_def);
const reccatalog = globalStore.sovrascriviPaginaDefaultFromTemplate(
optcatalogo.value.dimensioni_def.linkIdTemplate,
optcatalogo.value.dimensioni_def
);
if (reccatalog) {
optcatalogo.value.dimensioni_def.pagina = { ...reccatalog.dimensioni_def.pagina};
optcatalogo.value.dimensioni_def.pagina = { ...reccatalog.dimensioni_def.pagina };
}
}
if (optcatalogo.value.print_linkIdTemplate) {
const reccat2 = globalStore.sovrascriviAreadistampaFromTemplate(optcatalogo.value.print_linkIdTemplate, optcatalogo.value);
const reccat2 = globalStore.sovrascriviAreadistampaFromTemplate(
optcatalogo.value.print_linkIdTemplate,
optcatalogo.value
);
if (reccat2) {
const optcatalogo2 = { ...optcatalogo.value };
// optcatalogo2.areadistampa = { ...reccat2.areadistampa};
@@ -847,7 +881,6 @@ export default defineComponent({
await productStore.loadProducts(true);
}
if (!loadpage.value) return;
generatinglist.value = true;
@@ -1333,7 +1366,7 @@ export default defineComponent({
async function mounted() {
// console.log('mounted Catalogo')
ismounting.value = true
ismounting.value = true;
generatinglist.value = true;
if (optcatalogo.value.showListaArgomenti) cat.value = tools.getCookie(getKeyCatAtLoad(), '');
@@ -1400,7 +1433,7 @@ export default defineComponent({
calcArrProducts();
ismounting.value = false
ismounting.value = false;
}
function loaddata() {
@@ -1752,13 +1785,14 @@ export default defineComponent({
if (element) {
// add this record to lista_prodotti
if (getCatalogoByMyPage.value && !getCatalogoByMyPage.value.lista_prodotti?.some((p) => p._id === element._id)) {
if (
getCatalogoByMyPage.value &&
!getCatalogoByMyPage.value.lista_prodotti?.some((p) => p._id === element._id)
) {
// inserire il record in cima
const arr = getCatalogoByMyPage.value.lista_prodotti || [];
if (where === shared_consts.WHERE_INSERT.ONTOP)
arr.unshift(element);
else if (where === shared_consts.WHERE_INSERT.ONBOTTOM)
arr.push(element)
if (where === shared_consts.WHERE_INSERT.ONTOP) arr.unshift(element);
else if (where === shared_consts.WHERE_INSERT.ONBOTTOM) arr.push(element);
updateProducts(arr);
@@ -1989,51 +2023,81 @@ export default defineComponent({
const pubblicaPDF = async () => {
const catalog = getCatalogoByMyPage.value;
const ris = await globalStore.execOnlinePDF({ id_catalog: catalog._id, stampa: false });
const confirm = await $q
.dialog({
title: 'Conferma',
message: 'Vuoi pubblicare OnLine questo PDF?',
ok: {
label: 'S ',
push: true,
},
cancel: {
label: 'Annulla',
},
})
.onOk(async () => {
if (!confirm) return;
if (ris) {
if (ris.record?.pdf_online) {
catalog.pdf_online = ris.record.pdf_online;
catalog.data_online = ris.record.data_online;
}
$q.notify({
color: 'positive',
message: 'PDF inviato ONLINE!',
icon: 'check',
const ris = await globalStore.execOnlinePDF({ id_catalog: catalog._id, stampa: false });
if (ris) {
if (ris.record?.pdf_online) {
catalog.pdf_online = ris.record.pdf_online;
catalog.data_online = ris.record.data_online;
}
$q.notify({
color: 'positive',
message: 'PDF inviato ONLINE!',
icon: 'check',
});
} else {
$q.loading.hide();
$q.notify({
color: 'negative',
message: "Errore nell'invio del PDF OnLine",
icon: 'error',
});
}
});
} else {
$q.loading.hide();
$q.notify({
color: 'negative',
message: "Errore nell'invio del PDF OnLine",
icon: 'error',
});
}
};
const pubblicaPDFStampa = async () => {
const catalog = getCatalogoByMyPage.value;
const ris = await globalStore.execOnlinePDF({ id_catalog: catalog._id, stampa: true });
const confirm = await $q
.dialog({
title: 'Conferma',
message: 'Vuoi pubblicare OnLine questo PDF di STAMPA ?',
ok: {
label: 'S ',
push: true,
},
cancel: {
label: 'Annulla',
},
})
.onOk(async () => {
const ris = await globalStore.execOnlinePDF({ id_catalog: catalog._id, stampa: true });
if (ris) {
if (ris.record.pdf_online_stampa) {
catalog.pdf_online_stampa = ris.record.pdf_online_stampa;
catalog.data_online_stampa = ris.record.data_online_stampa;
}
$q.notify({
color: 'positive',
message: 'PDF STAMPA inviato ONLINE!',
icon: 'check',
if (ris) {
if (ris.record.pdf_online_stampa) {
catalog.pdf_online_stampa = ris.record.pdf_online_stampa;
catalog.data_online_stampa = ris.record.data_online_stampa;
}
$q.notify({
color: 'positive',
message: 'PDF STAMPA inviato ONLINE!',
icon: 'check',
});
} else {
$q.loading.hide();
$q.notify({
color: 'negative',
message: "Errore nell'invio del PDF STAMPA OnLine",
icon: 'error',
});
}
});
} else {
$q.loading.hide();
$q.notify({
color: 'negative',
message: "Errore nell'invio del PDF STAMPA OnLine",
icon: 'error',
});
}
// await saveCatalog();
};
@@ -2118,6 +2182,8 @@ export default defineComponent({
pubblicaPDF,
pubblicaPDFStampa,
ismounting,
pdfColumns,
pdfRows,
};
},
});