- Generazione della Raccolta dei Cataloghi (web e Stampa), e creazione del PDF Online.

- Lista Raccolta Cataloghi, aggiungi/togli catalogo.
This commit is contained in:
Surya Paolo
2025-05-14 15:02:14 +02:00
parent 85faf11d27
commit fc8a954eb0
39 changed files with 6149 additions and 4069 deletions

View File

@@ -28,7 +28,12 @@ export const useCatalogStore = defineStore('CatalogStore', {
catalogs: [{ _id: '', idapp: '', title: '' }]
}),
getters: {},
getters: {
getCatalogById: (state) => (id: string) => {
return state.catalogs.find((cat: ICatalog) => cat._id === id);
},
},
actions: {

View File

@@ -124,6 +124,58 @@ export const colmailinglist = [
AddCol(DeleteRec),
]
export const colTableRaccoltaCataloghi = [
AddCol({ name: 'title', label_trans: 'racccat.title' }),
AddCol({
name: 'foto_raccolta',
label_trans: 'racccat.foto_raccolta',
fieldtype: costanti.FieldType.image,
jointable: '',
showWhen: costanti.showWhen.NewRec + costanti.showWhen.InPage + costanti.showWhen.InEdit,
isadvanced_field: false,
}),
AddCol({
name: 'idPageAssigned',
label_trans: 'cataloglist.idPageAssigned',
fieldtype: costanti.FieldType.select,
jointable: 'mypages_id',
}),
AddCol({
name: 'idPageAssigned_stampa',
label_trans: 'cataloglist.idPageAssigned_stampa',
fieldtype: costanti.FieldType.select,
jointable: 'mypages_id',
}),
AddCol({
name: 'nomefile_da_generare',
label_trans: 'cataloglist.nomefile_generare',
}),
/*AddCol({
name: 'pdf_generato',
label_trans: 'cataloglist.pdf_generato',
}),
AddCol({
name: 'pdf_generato_stampa',
label_trans: 'cataloglist.pdf_generato_stampa',
}),
AddCol({
name: 'pdf_online',
label_trans: 'cataloglist.pdf_online',
}),
AddCol({
name: 'pdf_online_stampa',
label_trans: 'cataloglist.pdf_online_stampa',
}),*/
AddCol(ModifRec),
AddCol(DuplicateRec),
AddCol(DeleteRec),
]
export const colTableCatalogList = [
AddCol({ name: 'active', label_trans: 'myelems.pubblica_online', fieldtype: costanti.FieldType.boolean }),
AddCol({ name: 'title', label_trans: 'gallery.title' }),
@@ -4311,11 +4363,13 @@ export const fieldsTable = {
// Tabelle che hanno il /pickup
tableRemotePickup: [
'countries',
'phones',
'cities',
'products',
'catalogs',
],
tableWithUsername: [
@@ -5213,6 +5267,13 @@ export const fieldsTable = {
colkey: '_id',
collabel: 'title',
},
{
value: 'raccoltacataloghis',
label: 'Raccolta Cataloghi',
columns: colTableRaccoltaCataloghi,
colkey: '_id',
collabel: 'title',
},
{
value: 'schedeopt',
label: 'Template Cataloghi',

File diff suppressed because it is too large Load Diff

View File

@@ -84,6 +84,7 @@ export const toolsext = {
TABNEWSLETTER: 'newstosent',
TABGALLERY: 'gallery',
TABCATALOGS: 'catalogs',
TABRACCOLTA_CATALOGHI: 'raccoltacataloghis',
TABMAILINGLIST: 'mailinglist',
TABGROUPS: 'groups',
TABMYPAGE: 'mypages',

View File

@@ -898,6 +898,7 @@ export const useProducts = defineStore('Products', {
return ris
},
async loadOrders() {
// console.log('loadOrders')

View File

@@ -432,6 +432,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
else if (table === 'mypages_id') ris = state.mypage;
else if (table === toolsext.TABMYELEMS) ris = state.myelems;
else if (table === toolsext.TABCATALOGS) ris = catalogStore.catalogs!;
else if (table === toolsext.TABRACCOLTA_CATALOGHI) ris = catalogStore.raccoltacataloghis!;
else if (table === toolsext.TABCALZOOM) ris = state.calzoom;
else if (table === 'producers') ris = state.producers;
else if (table === 'storehouses') ris = state.storehouses;
@@ -1852,6 +1853,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
circuitStore.listaccounts = res.data.listaccounts ? res.data.listaccounts : [];
catalogStore.catalogs = res.data.catalogs;
catalogStore.raccoltacataloghis = res.data.raccoltacataloghis;
this.settings = res.data.settings ? [...res.data.settings] : [];
this.disciplines = res.data.disciplines ? [...res.data.disciplines] : [];
@@ -2466,6 +2468,21 @@ export const useGlobalStore = defineStore('GlobalStore', {
areadistampa: tools.resetRecIAreaDiStampa(null),
};
},
createRaccoltaCataloghiVuoto(): IOptCatalogo {
return {
productTypes: [0],
excludeproductTypes: [],
idTipologie: [],
formato: [],
Categoria: [],
editore: [],
pdf: false,
dimensioni_def: {
pagina: tools.resetRecIDimensioni(null),
},
areadistampa: tools.resetRecIAreaDiStampa(null),
};
},
async prepareAddNewElem(order: any, $q: any, t: any, myelem: any, newtype: any) {
const newrec: IMyElem = {
@@ -2487,6 +2504,8 @@ export const useGlobalStore = defineStore('GlobalStore', {
newrec.catalogo = this.createCatalogoVuoto();
} else if (newrec.type === shared_consts.ELEMTYPE.CATALOGO) {
newrec.catalogo = this.createCatalogoVuoto();
} else if (newrec.type === shared_consts.ELEMTYPE.RACCOLTA) {
newrec.catalogo = this.createRaccoltaCataloghiVuoto();
}
const mynewrec = await this.addNewElem($q, t, newrec);
@@ -2528,6 +2547,15 @@ export const useGlobalStore = defineStore('GlobalStore', {
return false;
});
},
async execJoinPDF(paramquery: any) {
return Api.SendReq('/admin/join-pdf', 'POST', paramquery)
.then((res) => {
return res.data;
})
.catch((error) => {
return false;
});
},
async execOnlinePDF(paramquery: any) {
return Api.SendReq('/admin/online-pdf', 'POST', paramquery)
.then((res) => {
@@ -2824,6 +2852,11 @@ export const useGlobalStore = defineStore('GlobalStore', {
const prec_lista_prodotti = mytablerec![index].lista_prodotti;
mytablerec![index] = { ...mytablerec[index], ...resdata.rec };
mytablerec![index].lista_prodotti = prec_lista_prodotti;
} else if (datain.table === 'raccoltacataloghis') {
// salva lista_cataloghi
const prec_lista_cataloghi = mytablerec![index].lista_cataloghi;
mytablerec![index] = { ...mytablerec[index], ...resdata.rec };
mytablerec![index].lista_cataloghi = prec_lista_cataloghi;
} else {
mytablerec![index] = { ...mytablerec[index], ...resdata.rec };
console.log('Aggiorna il record mantenendo reattività');