- Assegnazione di linkIdTemplate anche per la "Pagina di Default", in modo che posso da "Templates" cambiare le impostazioni.

This commit is contained in:
Surya Paolo
2025-05-14 17:04:18 +02:00
parent fc8a954eb0
commit f30cbf072a
13 changed files with 1508 additions and 1251 deletions

View File

@@ -7606,11 +7606,13 @@ export const tools = {
}
}
},
getFullFileNameByImageFile(table: string, imagefile: string) {
getFullFileNameByImageFile(table: string, imagefile: string, id: string) {
// console.log('arrimage', arrimage)
if (shared_consts.TABLES_IMAGEFILE_SINGOLO.includes(table)) {
return this.getDirUpload() + `products/` + imagefile;
} else if (table === 'catalogs') {
return this.getDirUpload() + `catalogs/` + id + '/' + imagefile;
}
return imagefile;
},

File diff suppressed because it is too large Load Diff

View File

@@ -237,6 +237,30 @@ export const useGlobalStore = defineStore('GlobalStore', {
return null;
},
sovrascriviPaginaDefaultFromTemplate:
(state: IGlobalState) => (idTemplate: string, origDimensioni: IDimensioni, optcatalogo: IOptCatalogo) => {
const myfindelem = state.myelems.find((myelem: IMyElem) => myelem._id === idTemplate);
const linkIdTemplate = origDimensioni.linkIdTemplate;
const precname = origDimensioni.name;
if (myfindelem) {
const myelemtocopy = tools.jsonCopy(myfindelem);
if (myelemtocopy) {
// myelemtocopy.scheda._id = origScheda.scheda?._id;
myelemtocopy.catalogo.dimensioni_def.isTemplate = false;
myelemtocopy.catalogo.dimensioni_def.name = precname;
myelemtocopy.catalogo.dimensioni_def.linkIdTemplate = linkIdTemplate;
return myelemtocopy.catalogo;
}
}
return null;
},
// conta: (state: IGlobalState) => { state.conta },
// listatodo: (state: IGlobalState) => { state.listatodo },
// category: (state: IGlobalState) => { state.category },
@@ -289,6 +313,12 @@ export const useGlobalStore = defineStore('GlobalStore', {
return Products.getSchedeOpt(state.myschedas, tag);
},
getOptCatalogoTemplate: (state: IGlobalState) => (tag?: string) => {
const Products = useProducts();
return Products.getSchedeOpt(state.myschedas, tag);
},
getLinkIdTemplateByName: (state: IGlobalState) => (name: string) => {
try {
const myrecscheda = state.myschedas.find((recscheda: ISchedaSingola) => recscheda.scheda.name === name);
@@ -2463,6 +2493,9 @@ export const useGlobalStore = defineStore('GlobalStore', {
editore: [],
pdf: false,
dimensioni_def: {
isTemplate: false,
linkIdTemplate: '',
name: '',
pagina: tools.resetRecIDimensioni(null),
},
areadistampa: tools.resetRecIAreaDiStampa(null),
@@ -2478,6 +2511,9 @@ export const useGlobalStore = defineStore('GlobalStore', {
editore: [],
pdf: false,
dimensioni_def: {
isTemplate: false,
linkIdTemplate: '',
name: '',
pagina: tools.resetRecIDimensioni(null),
},
areadistampa: tools.resetRecIAreaDiStampa(null),
@@ -2617,7 +2653,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
window.URL.revokeObjectURL(downloadUrl);
} else {
return response
return response;
}
} else {
console.error('No data returned from the server.');