- catalogo
- corretto logica del RefreshToken che non richiedeva il nuovo token, quindi scadeva tutte le volte, richiedendo sempre l'accesso !
This commit is contained in:
@@ -13,7 +13,6 @@ import { useGlobalStore } from './globalStore'
|
||||
import { ref } from 'vue'
|
||||
|
||||
import translate from '@src/globalroutines/util'
|
||||
import products from '@src/rootgen/admin/products/products'
|
||||
|
||||
function getRecordOrdersCartEmpty(): IOrderCart {
|
||||
return {
|
||||
@@ -149,6 +148,27 @@ export const useProducts = defineStore('Products', {
|
||||
return arrcat
|
||||
},
|
||||
|
||||
getCatProdsStrByCatProds: (state: IProductsState) => (catProds: ICatProd[]): string => {
|
||||
let mystr = ''
|
||||
for (const catprod of catProds) {
|
||||
const myarrcat = state.catprods.find((rec: ICatProd) => rec._id === catprod)
|
||||
if (myarrcat) {
|
||||
if (mystr)
|
||||
mystr = ' - '
|
||||
mystr += myarrcat.name
|
||||
}
|
||||
}
|
||||
return mystr
|
||||
},
|
||||
|
||||
getCatProdDescrStrByIdCatProd: (state: IProductsState) => (idCatProd: string): string => {
|
||||
const myfirstcat = state.catprods.find((rec: ICatProd) => rec._id === idCatProd)
|
||||
|
||||
if (myfirstcat) {
|
||||
return myfirstcat.descr_estesa!
|
||||
}
|
||||
return ''
|
||||
},
|
||||
|
||||
getSubCatProdsByGas: (state: IProductsState) => (idGasOrdine: string, idCatProd: string): ISubCatProd[] => {
|
||||
let arrcat = state.subcatprods
|
||||
@@ -1267,6 +1287,14 @@ export const useProducts = defineStore('Products', {
|
||||
return authorString
|
||||
},
|
||||
|
||||
getkeyValStr(chiave: string, valore: any) {
|
||||
try {
|
||||
return ` ${chiave} = ${valore} `
|
||||
} catch (e) {
|
||||
return ` ${chiave}`
|
||||
}
|
||||
},
|
||||
|
||||
replaceKeyWordsByProduct(optcatalogo: ICatalogo, myproduct: IProduct, testo: IText) {
|
||||
if (!myproduct || !testo.contenuto) {
|
||||
return testo.contenuto;
|
||||
@@ -1279,23 +1307,33 @@ export const useProducts = defineStore('Products', {
|
||||
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 vLast3M = myproduct.productInfo.vLast3M! || 0;
|
||||
const vLast6M = myproduct.productInfo.vLast6M! || 0;
|
||||
const ranking_globale = myproduct.productInfo.rank3M! || 0;
|
||||
const ranking = myproduct.indiceRanking! || 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 debugstr = " Rank=" + ranking + "<br> Rank3M=" + (myproduct.productInfo.rank3M! || '') + '<br> Venduti=' + linkvenduti + '<br>vLast3M= ' + vLast3M + '<br>vLast6M= ' + vLast6M + ' <br> Data Pubb=' + date_pub
|
||||
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('Pubblicato il', date_pub) +
|
||||
this.getkeyValStr('Rank', ranking) +
|
||||
this.getkeyValStr('Rank3M', myproduct.productInfo.rank3M) +
|
||||
this.getkeyValStr('Venduti', linkvenduti) +
|
||||
this.getkeyValStr('vLast3M', vLast3M) +
|
||||
this.getkeyValStr('vLast6M', vLast6M) +
|
||||
this.getkeyValStr('Fatturati', linkfatturati) +
|
||||
this.getkeyValStr('fatLast3M', 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 || '';
|
||||
@@ -1316,17 +1354,20 @@ export const useProducts = defineStore('Products', {
|
||||
const descrizione_breve_macro = short_descr.length > maxDescriptionLength
|
||||
? short_descr.substring(0, short_descr.lastIndexOf(' ', maxDescriptionLength)) + '...'
|
||||
: short_descr;
|
||||
|
||||
|
||||
const sottotitolo = myproduct.productInfo.sottotitolo || '';
|
||||
const link_macro = myproduct.productInfo.link_macro || '';
|
||||
|
||||
const prezzo = tools.arrotonda2Dec(myproduct.arrvariazioni![0].price) || ''
|
||||
const prezzo_scontato = tools.arrotonda2Dec(myproduct.arrvariazioni![0].sale_price) || ''
|
||||
const misure = myproduct.arrvariazioni![0].misure || ''
|
||||
const formato = myproduct.arrvariazioni![0].formato || ''
|
||||
const pagine = myproduct.arrvariazioni![0].pagine || ''
|
||||
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 ? this.getCatProdDescrStrByIdCatProd(myproduct.productInfo.catprods![0]) : ''
|
||||
const misure = myproduct.arrvariazioni![0].misure || ''
|
||||
const formato = myproduct.arrvariazioni![0].formato || ''
|
||||
const pagine = myproduct.arrvariazioni![0].pagine || ''
|
||||
|
||||
|
||||
|
||||
const scale = optcatalogo.printable ? optcatalogo.areadistampa?.scale : 1
|
||||
// Crea una mappa di sostituzioni
|
||||
const replacements = {
|
||||
@@ -1337,7 +1378,10 @@ export const useProducts = defineStore('Products', {
|
||||
'{descrizione_estesa_fdv}': truncatedlongDescription || '',
|
||||
'{descrizione_estesa}': descrizione_completa_macro || '',
|
||||
'{debug}': (debugstr) || '',
|
||||
'{pagine}': (pagine ) || '',
|
||||
'{categoria}': (categoria) || '',
|
||||
'{sottocategoria}': (sottocategoria) || '',
|
||||
'{descr_categoria}': (descr_categoria) || '',
|
||||
'{pagine}': (pagine) || '',
|
||||
'{misure}': misure || '',
|
||||
'{date_pub}': date_pub || '',
|
||||
'{ranking_globale}': ranking_globale || '',
|
||||
|
||||
Reference in New Issue
Block a user