- corretto scheda prodotto, record salvato

This commit is contained in:
Surya Paolo
2025-05-01 00:20:02 +02:00
parent 358f0d6816
commit 721d2ac38c
32 changed files with 296 additions and 177 deletions

View File

@@ -27,10 +27,14 @@ export const costanti = {
CATALOGO_FIELDS: [
'productTypes',
'excludeproductTypes',
'formato',
'idTipologie',
'idTipoFormato',
'misure',
'Categoria',
'idCollane',
'editore',
'argomenti',
'idCollane',
'pdf',
'Printable',
'numschede_perCol',

View File

@@ -169,6 +169,12 @@ export const colTableCatalogList = [
fieldtype: costanti.FieldType.multiselect,
jointable: 'publishers_totali',
}),
AddCol({
name: 'idTipoFormato',
label_trans: 'cataloglist.idTipoFormato',
fieldtype: costanti.FieldType.multiselect,
jointable: 't_web_tipiformatos',
}),
AddCol({ name: 'descr_introduttiva', label_trans: 'cataloglist.descr_introduttiva', fieldtype: costanti.FieldType.html, maxlength: 1300 }),
AddCol({ name: 'pagina_introduttiva_sfondo_nero', label_trans: 'cataloglist.pagina_introduttiva_sfondo_nero', fieldtype: costanti.FieldType.boolean }),
@@ -316,6 +322,12 @@ export const colmyScheda = [
AddCol({ name: 'productTypes', label_trans: 'productTypes', fieldtype: costanti.FieldType.number }),
AddCol({ name: 'excludeproductTypes', label_trans: 'excludeproductTypes', fieldtype: costanti.FieldType.number }),
AddCol({ name: 'idTipologie', label_trans: 'idTipologie', fieldtype: costanti.FieldType.number }),
AddCol({
name: 'idTipoFormato',
label_trans: 'cataloglist.idTipoFormato',
fieldtype: costanti.FieldType.multiselect,
jointable: 't_web_tipiformatos',
}),
AddCol({ name: 'editore', label_trans: 'editore' }),
AddCol({ name: 'author', label_trans: 'scheda.author' }),
AddCol({ name: 'argomenti', label_trans: 'scheda.argomenti' }),

View File

@@ -1529,7 +1529,7 @@ export const useProducts = defineStore('Products', {
replacements['{collana}'] = tools.formatCollane(myproduct.productInfo.idCollana) || '';
}
const maxDescriptionLength = testo.maxlength || 600;
const maxDescriptionLength = testo.maxlength || 680;
if (testo.contenuto.includes('{descrizione_da_fdv}')) {
const description = myproduct.productInfo.short_descr || '';
@@ -1564,16 +1564,17 @@ export const useProducts = defineStore('Products', {
if (testo.contenuto.includes('{descrizione_breve_macro}')) {
const short_descr = myproduct.productInfo.descrizione_breve_macro || '';
replacements['{descrizione_breve_macro}'] = short_descr.length > maxDescriptionLength && maxDescriptionLength > 0
replacements['{descrizione_breve_macro}'] = short_descr.length > maxDescriptionLength && maxDescriptionLength > 0
? short_descr.substring(0, short_descr.lastIndexOf(' ', maxDescriptionLength)) + '...'
: short_descr;
}
if (testo.contenuto.includes('{descr_trafiletto_catalogo}')) {
if (testo.contenuto.includes('{descr_trafiletto_catalogo}') || testo.contenuto.includes('{descrizione_completa_macro}')) {
const short_descr = myproduct.productInfo.descr_trafiletto_catalogo || '';
replacements['{descr_trafiletto_catalogo}'] = short_descr.length > maxDescriptionLength && maxDescriptionLength > 0
replacements['{descr_trafiletto_catalogo}'] = short_descr.length > maxDescriptionLength && maxDescriptionLength > 0
? short_descr.substring(0, short_descr.lastIndexOf(' ', maxDescriptionLength)) + '...'
: short_descr;
replacements['{descrizione_completa_macro}'] = replacements['{descr_trafiletto_catalogo}']
}
if (testo.contenuto.includes('{prezzo}') || testo.contenuto.includes('{prezzo_scontato}')) {
@@ -1666,7 +1667,7 @@ export const useProducts = defineStore('Products', {
case '{debug}':
const date_pub = replacements['{date_pub}'] || '';
const fatLast6M = myproduct.productInfo.fatLast6M! || 0;
const linkvenduti = `<a href="http://vps-88271abb.vps.ovh.net/apimacro/public/view-ordini-by-idarticolo/${myproduct.productInfo.sku}" target="_blank">${replacements['{venduti}']}</a>`;
const linkvenduti = `<a href="http://vps-88271abb.vps.ovh.net/apimacro/public/view-ordini-by-idarticolo/${myproduct.productInfo.sku}" target="_blank">${myproduct.productInfo.totVen!}</a>`;
const vLast3M = myproduct.productInfo.vLast3M! || 0;
const vLast6M = myproduct.productInfo.vLast6M! || 0;
const linkfatturati = `<a href="http://vps-88271abb.vps.ovh.net/apimacro/public/view-fatturati-by-idarticolo/${myproduct.productInfo.sku}" target="_blank">${myproduct.productInfo.totFat! || 0}</a>`;

View File

@@ -2674,6 +2674,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
try {
// aggiungi idapp ad options
options.idapp = tools.getEnv('VITE_APP_ID')
console.log('CHIAMATA fetchTableContent...', options)
return Api.SendReq('/apisqlsrv/view-table', 'POST', { options })
.then((res) => {
return res.data.data
@@ -2682,7 +2683,6 @@ export const useGlobalStore = defineStore('GlobalStore', {
})
} catch (error) {
console.error("Errore nel recupero della tabella:", error);
throw error;
}
},
@@ -2783,7 +2783,16 @@ export const useGlobalStore = defineStore('GlobalStore', {
if (index !== -1 && index !== undefined) {
// Aggiorna il record mantenendo reattività
mytablerec![index] = { ...mytablerec[index], ...resdata.rec }
if (datain.table === 'catalogs') {
// salva lista_prodotti
const prec_lista_prodotti = mytablerec![index].lista_prodotti
mytablerec![index] = { ...mytablerec[index], ...resdata.rec }
mytablerec![index].lista_prodotti = prec_lista_prodotti
} else {
mytablerec![index] = { ...mytablerec[index], ...resdata.rec }
console.log('Aggiorna il record mantenendo reattività')
}
}
}
}