- aggiornamento catalogo: lista titoli del catalogo

- scheda prodotto libro
- migliorata tabella prodotto
This commit is contained in:
Surya Paolo
2025-04-04 18:15:14 +02:00
parent 79d1c5fe1d
commit 9cfc308d09
49 changed files with 1760 additions and 934 deletions

View File

@@ -2244,11 +2244,15 @@ export const tools = {
},
strToObj(mystr: string): any {
if (mystr) {
mystr = decodeURIComponent(mystr)
return JSON.parse(mystr)
} else
try {
if (mystr) {
mystr = decodeURIComponent(mystr)
return JSON.parse(mystr)
} else
return null
} catch (e) {
return null
}
},
objToStr(myobj: any): string {
@@ -9839,7 +9843,20 @@ export const tools = {
const url = import.meta.env.VITE_APP_URL
const protocol = url.startsWith('http://') ? 'http://' : url.startsWith('https://') ? 'https://' : ''
return protocol
}
},
isRisoApp() {
return this.appid() === tools.IDAPP_RISO
},
isValueNotEmpty(value: any) {
// Verifica se `value` è un oggetto non vuoto o un valore valido
return (
value !== null &&
typeof value === "object" &&
Object.keys(value).length > 0
);
},
// FINE !

View File

@@ -549,11 +549,18 @@ export const useProducts = defineStore('Products', {
async getProductById(id: string): Promise<IProduct> {
let prod = null
if (!this.products) {
// Se non lo carico all'avvio, allora fai la chiamata al server
prod = await this.loadProductById(id)
} else {
prod = this.products.find((prod: IProduct) => prod._id === id)
try {
if (!id) {
return null
}
if (!this.products) {
// Se non lo carico all'avvio, allora fai la chiamata al server
prod = await this.loadProductById(id)
} else {
prod = this.products.find((prod: IProduct) => prod._id === id)
}
} catch (e) {
console.error('Err', e)
}
return prod ? prod : getRecordProductEmpty()
@@ -1419,6 +1426,7 @@ export const useProducts = defineStore('Products', {
descrizione_completa_macro += addstrcontinua
}
const descr_trafiletto_catalogo = myproduct.productInfo.descr_trafiletto_catalogo || '';
const short_descr = myproduct.productInfo.descrizione_breve_macro || '';
const descrizione_breve_macro = short_descr.length > maxDescriptionLength
? short_descr.substring(0, short_descr.lastIndexOf(' ', maxDescriptionLength)) + '...'
@@ -1468,6 +1476,7 @@ export const useProducts = defineStore('Products', {
'{prezzo_scontato}': prezzo_scontato || '',
'{descrizione_completa_macro}': descrizione_completa_macro || '',
'{descrizione_breve_macro}': descrizione_breve_macro || '',
'{descr_trafiletto_catalogo}': descr_trafiletto_catalogo || '',
'{link_macro}': link_macro || '',
'{qta}': qta || '',
'{image_link}': image_link || '',