- scheda prodotto migliorata
- aggiornamento filtri
This commit is contained in:
@@ -646,6 +646,24 @@ export const colTableCatProd = [
|
||||
AddCol(DeleteRec),
|
||||
AddCol(DuplicateRec),
|
||||
]
|
||||
export const colTableStatiProdotto = [
|
||||
AddCol({ name: 'IdTipologia', label_trans: 'statoprod.IdTipologia' }),
|
||||
AddCol({ name: 'Descrizione', label_trans: 'statoprod.Descrizione' }),
|
||||
AddCol(DeleteRec),
|
||||
AddCol(DuplicateRec),
|
||||
]
|
||||
export const colTableTipoFormato = [
|
||||
AddCol({ name: 'IdTipoFormato', label_trans: 'statoprod.IdTipologia' }),
|
||||
AddCol({ name: 'Descrizione', label_trans: 'statoprod.Descrizione' }),
|
||||
AddCol(DeleteRec),
|
||||
AddCol(DuplicateRec),
|
||||
]
|
||||
export const colTableTipologie = [
|
||||
AddCol({ name: 'IdStatoProdotto', label_trans: 'statoprod.IdStatoProdotto' }),
|
||||
AddCol({ name: 'Descrizione', label_trans: 'statoprod.Descrizione' }),
|
||||
AddCol(DeleteRec),
|
||||
AddCol(DuplicateRec),
|
||||
]
|
||||
export const colTableCollane = [
|
||||
AddCol({ name: 'idCollana', label_trans: 'collane.idCollana', fieldtype: costanti.FieldType.number }),
|
||||
AddCol({ name: 'title', label_trans: 'collane.title' }),
|
||||
@@ -4372,6 +4390,27 @@ export const fieldsTable = {
|
||||
colkey: '_id',
|
||||
collabel: 'name',
|
||||
},
|
||||
{
|
||||
value: 't_web_statiprodottos',
|
||||
label: 'Stati Prodotto',
|
||||
columns: colTableStatiProdotto,
|
||||
colkey: 'IdStatoProdotto',
|
||||
collabel: 'Descrizione',
|
||||
},
|
||||
{
|
||||
value: 't_web_tipiformatos',
|
||||
label: 'Tipo Formato',
|
||||
columns: colTableTipoFormato,
|
||||
colkey: 'IdTipoFormato',
|
||||
collabel: 'Descrizione',
|
||||
},
|
||||
{
|
||||
value: 't_web_tipologies',
|
||||
label: 'Tipologie',
|
||||
columns: colTableTipologie,
|
||||
colkey: 'IdStatoProdotto',
|
||||
collabel: 'Descrizione',
|
||||
},
|
||||
{
|
||||
value: 'collanas',
|
||||
label: 'Collane',
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { IBaseOrder, ICart, IOrder, IOrderCart, IProduct, IProductsState, IProductInfo, ICatProd, IUserShort, IGasordine, IAuthor, ISubCatProd, IText, IOptCatalogo, ICatalog, ICatPrTotali, ISingleProductOrdered, ISchedaSingola, IMyScheda, IElementiScheda, T_Web_StatiProdotto } from 'model'
|
||||
import type { IBaseOrder, ICart, IOrder, IOrderCart, IProduct, IProductsState, IProductInfo, ICatProd, IUserShort, IGasordine, IAuthor, ISubCatProd, IText, IOptCatalogo, ICatalog, ICatPrTotali, ISingleProductOrdered, ISchedaSingola, IMyScheda, IElementiScheda, T_Web_StatiProdotto, T_Web_Tipologie, T_WEB_TipiFormato } from 'model'
|
||||
|
||||
import { Api } from '@api'
|
||||
import { serv_constants } from '@src/store/Modules/serv_constants'
|
||||
@@ -130,6 +130,10 @@ export const useProducts = defineStore('Products', {
|
||||
},
|
||||
|
||||
isDisponibile: (state: IProductsState) => (product: IProduct): boolean => {
|
||||
return product?.arrvariazioni?.[0]?.quantita > 1
|
||||
},
|
||||
|
||||
isDisponibilitaOk: (state: IProductsState) => (product: IProduct): boolean => {
|
||||
return product?.arrvariazioni?.[0]?.quantita > 100
|
||||
},
|
||||
|
||||
@@ -146,11 +150,9 @@ export const useProducts = defineStore('Products', {
|
||||
|
||||
isPubblicatoById: (state: IProductsState) => (idStatoProdotto: number): boolean => {
|
||||
switch (idStatoProdotto) {
|
||||
case 1:
|
||||
case 4:
|
||||
case 34:
|
||||
case 45:
|
||||
case 46:
|
||||
case 1: // In Commercio
|
||||
case 45: // In Commercio
|
||||
case 46: // 2023 in commercio
|
||||
case undefined:
|
||||
return true;
|
||||
default:
|
||||
@@ -158,16 +160,41 @@ export const useProducts = defineStore('Products', {
|
||||
}
|
||||
},
|
||||
|
||||
isProssimaUscitaById: (state: IProductsState) => (idStatoProdotto: number): boolean => {
|
||||
// 4 - Prossima uscita
|
||||
// 34 - In Prevendita
|
||||
return (idStatoProdotto === 4) || (idStatoProdotto === 34)
|
||||
},
|
||||
|
||||
isPubblicato: (state: IProductsState) => (productInfo: IProductInfo): boolean => {
|
||||
return state.isPubblicatoById(productInfo.idStatoProdotto)
|
||||
},
|
||||
|
||||
isNonVendibile: (state: IProductsState) => (productInfo: IProductInfo): boolean => {
|
||||
return !state.isPubblicatoById(productInfo.idStatoProdotto) && !state.isProssimaUscitaById(productInfo.idStatoProdotto)
|
||||
},
|
||||
|
||||
isProssimaUscita: (state: IProductsState) => (productInfo: IProductInfo): boolean => {
|
||||
return state.isProssimaUscitaById(productInfo.idStatoProdotto)
|
||||
},
|
||||
|
||||
getDescrStatiProdottoByIdStatoProdotto: (state: IProductsState) => (idStatoProdotto: number): string => {
|
||||
const ctrec = state.stati_prodotto.find((mystatus: T_Web_StatiProdotto) => mystatus.IdStatoProdotto === idStatoProdotto)
|
||||
return (ctrec) ? ctrec.Descrizione : ''
|
||||
},
|
||||
|
||||
|
||||
getDescrByIdTipologia: (state: IProductsState) => (idTipologia: number): string => {
|
||||
const ctrec = state.tipologie.find((mystatus: T_Web_Tipologie) => mystatus.IdTipologia === idTipologia)
|
||||
return (ctrec) ? ctrec.Descrizione : ''
|
||||
},
|
||||
|
||||
getDescrByIdTipoFormato: (state: IProductsState) => (idTipoFormato: number): string => {
|
||||
const ctrec = state.tipoformato.find((mystatus: T_WEB_TipiFormato) => mystatus.IdTipoFormato === idTipoFormato)
|
||||
return (ctrec) ? ctrec.Descrizione : ''
|
||||
},
|
||||
|
||||
|
||||
getArrayidArgomentoByArridCatProds: (state: IProductsState) => (arridCatProds: string[]): string[] => {
|
||||
const myarr: string[] = []
|
||||
for (const idCatProd of arridCatProds) {
|
||||
@@ -1426,114 +1453,158 @@ export const useProducts = defineStore('Products', {
|
||||
return testo.contenuto;
|
||||
}
|
||||
|
||||
const autori = this.getAutoriByArrayAuthors(myproduct.productInfo.authors)
|
||||
const collana = tools.formatCollane(myproduct.productInfo.idCollana)
|
||||
const replacements: { [key: string]: any } = {};
|
||||
|
||||
if (testo.contenuto.includes('{autore}')) {
|
||||
replacements['{autore}'] = this.getAutoriByArrayAuthors(myproduct.productInfo.authors) || '';
|
||||
}
|
||||
|
||||
if (testo.contenuto.includes('{collana}')) {
|
||||
replacements['{collana}'] = tools.formatCollane(myproduct.productInfo.idCollana) || '';
|
||||
}
|
||||
|
||||
const maxDescriptionLength = testo.maxlength ?? 100;
|
||||
const description = myproduct.productInfo.short_descr || '';
|
||||
const long_descr = myproduct.productInfo.description || '';
|
||||
const date_pub = tools.getstrDateShort(myproduct.productInfo.date_pub) || '';
|
||||
const fatLast3M = myproduct.productInfo.fatLast3M! || 0;
|
||||
const fatLast6M = myproduct.productInfo.fatLast6M! || 0;
|
||||
const vLast3M = myproduct.productInfo.vLast3M! || 0;
|
||||
const vLast6M = myproduct.productInfo.vLast6M! || 0;
|
||||
const ranking_globale = myproduct.productInfo.rank3M! || 0;
|
||||
const venduti = myproduct.productInfo.totVen! || 0;
|
||||
const fatturati = myproduct.productInfo.totFat! || 0;
|
||||
|
||||
const linkvenduti = '<a href="http://vps-88271abb.vps.ovh.net/apimacro/public/view-ordini-by-idarticolo/' + myproduct.productInfo.sku + '" target="_blank">' + venduti + '</a>'
|
||||
const linkfatturati = '<a href="http://vps-88271abb.vps.ovh.net/apimacro/public/view-fatturati-by-idarticolo/' + myproduct.productInfo.sku + '" target="_blank">' + fatturati + '</a>'
|
||||
const debugstr = this.getkeyValStr('Pub:', date_pub) +
|
||||
this.getkeyValStr('fat6M', fatLast6M) +
|
||||
// this.getkeyValStr('Rank3M', myproduct.productInfo.rank3M) +
|
||||
this.getkeyValStr('Ven:', linkvenduti) +
|
||||
this.getkeyValStr('v3M', vLast3M) +
|
||||
this.getkeyValStr('v6M', vLast6M) +
|
||||
this.getkeyValStr('Fatt:', linkfatturati) +
|
||||
this.getkeyValStr('fat3M', fatLast3M)
|
||||
|
||||
const truncatedDescription = description.length > maxDescriptionLength
|
||||
? description.substring(0, description.lastIndexOf(' ', maxDescriptionLength)) + '...'
|
||||
: description;
|
||||
|
||||
const truncatedlongDescription = long_descr.length > maxDescriptionLength
|
||||
? long_descr.substring(0, long_descr.lastIndexOf(' ', maxDescriptionLength)) + '...'
|
||||
: long_descr;
|
||||
|
||||
let addtesto = false
|
||||
|
||||
const long_descr_macro = myproduct.productInfo.descrizione_completa_macro || '';
|
||||
if (long_descr_macro.length > maxDescriptionLength) {
|
||||
addtesto = true
|
||||
}
|
||||
const addstrcontinua = '<span class="book-link">👉🏻 <a href="{link_macro}" target="_blank">continua a leggere</a></span>'
|
||||
|
||||
let descrizione_completa_macro = addtesto
|
||||
? long_descr_macro.substring(0, long_descr_macro.lastIndexOf(' ', maxDescriptionLength)) + '...'
|
||||
: long_descr_macro;
|
||||
|
||||
if (addtesto) {
|
||||
descrizione_completa_macro += addstrcontinua
|
||||
if (testo.contenuto.includes('{descrizione_da_fdv}')) {
|
||||
const description = myproduct.productInfo.short_descr || '';
|
||||
replacements['{descrizione_da_fdv}'] = description.length > maxDescriptionLength
|
||||
? description.substring(0, description.lastIndexOf(' ', maxDescriptionLength)) + '...'
|
||||
: description;
|
||||
}
|
||||
|
||||
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)) + '...'
|
||||
: short_descr;
|
||||
if (testo.contenuto.includes('{descrizione_estesa_fdv}')) {
|
||||
const long_descr = myproduct.productInfo.description || '';
|
||||
replacements['{descrizione_estesa_fdv}'] = long_descr.length > maxDescriptionLength
|
||||
? long_descr.substring(0, long_descr.lastIndexOf(' ', maxDescriptionLength)) + '...'
|
||||
: long_descr;
|
||||
}
|
||||
|
||||
const sottotitolo = myproduct.productInfo.sottotitolo || '';
|
||||
const link_macro = myproduct.productInfo.link_macro || '';
|
||||
if (testo.contenuto.includes('{descrizione_estesa}')) {
|
||||
let addtesto = false;
|
||||
const long_descr_macro = myproduct.productInfo.descrizione_completa_macro || '';
|
||||
if (long_descr_macro.length > maxDescriptionLength) {
|
||||
addtesto = true;
|
||||
}
|
||||
const addstrcontinua = '<span class="book-link">👉🏻 <a href="{link_macro}" target="_blank">continua a leggere</a></span>';
|
||||
let descrizione_completa_macro = addtesto
|
||||
? long_descr_macro.substring(0, long_descr_macro.lastIndexOf(' ', maxDescriptionLength)) + '...'
|
||||
: long_descr_macro;
|
||||
|
||||
const prezzo = tools.arrotonda2Dec(myproduct.arrvariazioni![0].price) || ''
|
||||
const prezzo_scontato = tools.arrotonda2Dec(myproduct.arrvariazioni![0].sale_price) || ''
|
||||
const categoria = this.getCatProdsStrByCatProds(myproduct.productInfo.catprods!)
|
||||
const sottocategoria = myproduct.productInfo.subcatprods && myproduct.productInfo.subcatprods.length > 0 ? myproduct.productInfo.subcatprods[0].name! : ''
|
||||
const descr_categoria = myproduct.productInfo.catprods && myproduct.productInfo.catprods.length > 0 ? this.getCatProdDescrStrByIdCatProd(myproduct.productInfo.catprods![0].name) : ''
|
||||
const misure = myproduct.arrvariazioni![0].misure || ''
|
||||
const formato = myproduct.arrvariazioni![0].formato || ''
|
||||
const pagine = myproduct.arrvariazioni![0].pagine || ''
|
||||
const qta = myproduct.arrvariazioni![0].quantita || ''
|
||||
const isbn = myproduct.productInfo.code || ''
|
||||
const image_link = myproduct.productInfo.image_link || ''
|
||||
const imagefile = myproduct.productInfo.imagefile || ''
|
||||
const stato = this.getDescrStatiProdottoByIdStatoProdotto(myproduct.productInfo.idStatoProdotto || '')
|
||||
if (addtesto) {
|
||||
descrizione_completa_macro += addstrcontinua;
|
||||
}
|
||||
replacements['{descrizione_estesa}'] = descrizione_completa_macro || '';
|
||||
}
|
||||
|
||||
const scale = optcatalogo.printable ? optcatalogo.areadistampa?.scale : 1
|
||||
// Crea una mappa di sostituzioni
|
||||
const replacements = {
|
||||
'{autore}': autori || '',
|
||||
'{titolo}': myproduct.productInfo.name || '',
|
||||
'{sottotitolo}': (sottotitolo) || '',
|
||||
'{descrizione_da_fdv}': truncatedDescription || '',
|
||||
'{descrizione_estesa_fdv}': truncatedlongDescription || '',
|
||||
'{descrizione_estesa}': descrizione_completa_macro || '',
|
||||
'{debug}': (debugstr) || '',
|
||||
'{categoria}': (categoria) || '',
|
||||
'{sottocategoria}': (sottocategoria) || '',
|
||||
'{descr_categoria}': (descr_categoria) || '',
|
||||
'{pagine}': (pagine) || '',
|
||||
'{isbn}': (isbn) || '',
|
||||
'{misure}': misure || '',
|
||||
'{argomento}': categoria || '',
|
||||
'{date_pub}': date_pub || '',
|
||||
'{ranking_globale}': ranking_globale || '',
|
||||
'{venduti}': venduti || '',
|
||||
'{formato}': formato || '',
|
||||
'{stato}': stato || '',
|
||||
'{collana}': collana ? collana || '' : '',
|
||||
'{prezzo}': prezzo || '',
|
||||
'{scale}': scale || '',
|
||||
'{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 || '',
|
||||
'{imagefile}': imagefile || '',
|
||||
};
|
||||
if (testo.contenuto.includes('{descrizione_breve_macro}')) {
|
||||
const short_descr = myproduct.productInfo.descrizione_breve_macro || '';
|
||||
replacements['{descrizione_breve_macro}'] = short_descr.length > maxDescriptionLength
|
||||
? short_descr.substring(0, short_descr.lastIndexOf(' ', maxDescriptionLength)) + '...'
|
||||
: short_descr;
|
||||
}
|
||||
|
||||
if (testo.contenuto.includes('{descr_trafiletto_catalogo}')) {
|
||||
const short_descr = myproduct.productInfo.descr_trafiletto_catalogo || '';
|
||||
replacements['{descr_trafiletto_catalogo}'] = short_descr.length > maxDescriptionLength
|
||||
? short_descr.substring(0, short_descr.lastIndexOf(' ', maxDescriptionLength)) + '...'
|
||||
: short_descr;
|
||||
}
|
||||
|
||||
if (testo.contenuto.includes('{prezzo}') || testo.contenuto.includes('{prezzo_scontato}')) {
|
||||
const prezzo = tools.arrotonda2Dec(myproduct.arrvariazioni![0].price) || '';
|
||||
const prezzo_scontato = tools.arrotonda2Dec(myproduct.arrvariazioni![0].sale_price) || '';
|
||||
replacements['{prezzo}'] = prezzo;
|
||||
replacements['{prezzo_scontato}'] = prezzo_scontato;
|
||||
}
|
||||
|
||||
// Additional replacements based on the content
|
||||
const keysToCheck = [
|
||||
'{titolo}', '{sottotitolo}', '{categoria}', '{sottocategoria}', '{descr_categoria}',
|
||||
'{pagine}', '{isbn}', '{misure}', '{argomento}', '{date_pub}', '{ranking_globale}',
|
||||
'{venduti}', '{formato}', '{tipologia}', '{stato}', '{scale}', '{descr_trafiletto_catalogo}',
|
||||
'{link_macro}', '{qta}', '{image_link}', '{imagefile}', '{debug}'
|
||||
];
|
||||
|
||||
for (const key of keysToCheck) {
|
||||
if (testo.contenuto.includes(key)) {
|
||||
switch (key) {
|
||||
case '{titolo}':
|
||||
replacements[key] = myproduct.productInfo.name || '';
|
||||
break;
|
||||
case '{sottotitolo}':
|
||||
replacements[key] = myproduct.productInfo.sottotitolo || '';
|
||||
break;
|
||||
case '{sottocategoria}':
|
||||
replacements[key] = myproduct.productInfo.subcatprods && myproduct.productInfo.subcatprods.length > 0 ? myproduct.productInfo.subcatprods[0].name! : '';
|
||||
break;
|
||||
case '{descr_categoria}':
|
||||
replacements[key] = myproduct.productInfo.catprods && myproduct.productInfo.catprods.length > 0 ? this.getCatProdDescrStrByIdCatProd(myproduct.productInfo.catprods![0].name) : '';
|
||||
break;
|
||||
case '{pagine}':
|
||||
replacements[key] = myproduct.arrvariazioni![0].pagine || '';
|
||||
break;
|
||||
case '{isbn}':
|
||||
replacements[key] = myproduct.productInfo.code || '';
|
||||
break;
|
||||
case '{misure}':
|
||||
replacements[key] = myproduct.arrvariazioni![0].misure || '';
|
||||
break;
|
||||
case '{argomento}':
|
||||
replacements[key] = this.getCatProdsStrByCatProds(myproduct.productInfo.catprods!) || '';
|
||||
break;
|
||||
case '{date_pub}':
|
||||
replacements[key] = tools.getstrDateShort(myproduct.productInfo.date_pub) || '';
|
||||
break;
|
||||
case '{ranking_globale}':
|
||||
replacements[key] = myproduct.productInfo.rank3M! || '0';
|
||||
break;
|
||||
case '{venduti}':
|
||||
replacements[key] = myproduct.productInfo.totVen! || '0';
|
||||
break;
|
||||
case '{formato}':
|
||||
replacements[key] = this.getDescrByIdTipoFormato(myproduct.arrvariazioni[0].idTipoFormato || 0)
|
||||
break;
|
||||
case '{tipologia}':
|
||||
replacements[key] = this.getDescrByIdTipologia(myproduct.arrvariazioni[0].idTipologia || 0);
|
||||
break;
|
||||
case '{stato}':
|
||||
replacements[key] = this.getDescrStatiProdottoByIdStatoProdotto(myproduct.productInfo.idStatoProdotto || '');
|
||||
break;
|
||||
case '{scale}':
|
||||
replacements[key] = optcatalogo.printable ? optcatalogo.areadistampa?.scale : '1';
|
||||
break;
|
||||
case '{link_macro}':
|
||||
replacements[key] = myproduct.productInfo.link_macro || '';
|
||||
break;
|
||||
case '{qta}':
|
||||
replacements[key] = myproduct.arrvariazioni![0].quantita || '';
|
||||
break;
|
||||
case '{image_link}':
|
||||
replacements[key] = myproduct.productInfo.image_link || '';
|
||||
break;
|
||||
case '{imagefile}':
|
||||
replacements[key] = myproduct.productInfo.imagefile || '';
|
||||
break;
|
||||
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 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>`;
|
||||
const fatLast3M = myproduct.productInfo.fatLast3M! || 0;
|
||||
|
||||
replacements[key] = this.getkeyValStr('Pub:', date_pub) +
|
||||
this.getkeyValStr('fat6M', fatLast6M) +
|
||||
this.getkeyValStr('Ven:', linkvenduti) +
|
||||
this.getkeyValStr('v3M', vLast3M) +
|
||||
this.getkeyValStr('v6M', vLast6M) +
|
||||
this.getkeyValStr('Fatt:', linkfatturati) +
|
||||
this.getkeyValStr('fat3M', fatLast3M);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Esegue le sostituzioni
|
||||
let result = testo.contenuto;
|
||||
@@ -1541,7 +1612,7 @@ export const useProducts = defineStore('Products', {
|
||||
result = result.replace(new RegExp(key, 'g'), value);
|
||||
}
|
||||
|
||||
return result.trim()
|
||||
return result.trim();
|
||||
},
|
||||
|
||||
getSubCatStrByProduct(myproductInfo: IProductInfo): string {
|
||||
|
||||
@@ -13,7 +13,10 @@ import type {
|
||||
StateConnection,
|
||||
ISchedaSingola,
|
||||
IOptQueryGM,
|
||||
IOptCatalogo
|
||||
IOptCatalogo,
|
||||
IProduct,
|
||||
IProductInfo,
|
||||
IVariazione
|
||||
} from '@model';
|
||||
import {
|
||||
ICity, IMySkill,
|
||||
@@ -442,6 +445,8 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
else if (table === 'authors') ris = Products.authors
|
||||
else if (table === 'publishers') ris = Products.publishers
|
||||
else if (table === 't_web_statiprodottos') ris = Products.stati_prodotto
|
||||
else if (table === 't_web_tipologies') ris = Products.tipologie
|
||||
else if (table === 't_web_tipiformatos') ris = Products.tipoformato
|
||||
else if (table === 'catais') ris = state.catAI
|
||||
else if (table === 'queryais') ris = state.queryAIList
|
||||
else if (table === 'sharewithus') ris = state.sharewithus
|
||||
@@ -1829,6 +1834,8 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
Products.collane = (res.data.collane) ? [...res.data.collane] : []
|
||||
Products.subcatprods = (res.data.subcatprods) ? [...res.data.subcatprods] : []
|
||||
Products.stati_prodotto = (res.data.stati_prodotto) ? [...res.data.stati_prodotto] : []
|
||||
Products.tipologie = (res.data.tipologie) ? [...res.data.tipologie] : []
|
||||
Products.tipoformato = (res.data.tipoformato) ? [...res.data.tipoformato] : []
|
||||
Products.catprods_gas = (res.data.catprods_gas) ? [...res.data.catprods_gas] : []
|
||||
Products.authors = (res.data.authors) ? [...res.data.authors] : []
|
||||
Products.publishers = (res.data.publishers) ? [...res.data.publishers] : []
|
||||
@@ -2676,15 +2683,41 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
}
|
||||
},
|
||||
|
||||
async updateTablesInMemory(data: any) {
|
||||
|
||||
const table = data.table
|
||||
const id = data.idRecUpdated
|
||||
|
||||
if (!id)
|
||||
return
|
||||
|
||||
const productStore = useProducts()
|
||||
|
||||
try {
|
||||
if (table === 'products') {
|
||||
await productStore.loadProductById(id)
|
||||
} else if (table === 'productinfos') {
|
||||
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Errore durante l'aggiornamento della tabella in memoria:", error);
|
||||
}
|
||||
},
|
||||
|
||||
async updateAllBookTableContent(options: any) {
|
||||
try {
|
||||
// aggiungi idapp ad options
|
||||
options.idapp = tools.getEnv('VITE_APP_ID')
|
||||
return Api.SendReq('/apisqlsrv/updateAllBook', 'POST', { options })
|
||||
.then((res) => {
|
||||
return await Api.SendReq('/apisqlsrv/updateAllBook', 'POST', { options })
|
||||
.then(async (res) => {
|
||||
if (res?.data?.data?.logerror) {
|
||||
return { error: 'Errore ' + res?.data?.data?.logerror }
|
||||
}
|
||||
await this.updateTablesInMemory(res.data.data)
|
||||
return res.data.data
|
||||
}).catch((error: any) => {
|
||||
console.error('Error fetchTableContent: ', error)
|
||||
return { error: 'Errore ' + error }
|
||||
})
|
||||
} catch (error) {
|
||||
console.error("Errore nel recupero della tabella:", error);
|
||||
|
||||
Reference in New Issue
Block a user