- aggiornamento cataloghi.
possibilità di estrapolare i dati da GM direttamente - migrazione delle tabelle di GM in locale - corretto l'ordinamento del Catalogo
This commit is contained in:
@@ -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 } 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 } from 'model'
|
||||
|
||||
import { Api } from '@api'
|
||||
import { serv_constants } from '@src/store/Modules/serv_constants'
|
||||
@@ -129,6 +129,41 @@ export const useProducts = defineStore('Products', {
|
||||
|
||||
},
|
||||
|
||||
isDisponibile: (state: IProductsState) => (product: IProduct): boolean => {
|
||||
return product.arrvariazioni[0].quantita > 100
|
||||
},
|
||||
|
||||
isQtaLimitata: (state: IProductsState) => (product: IProduct): boolean => {
|
||||
return product.arrvariazioni[0].quantita > 50 && product.arrvariazioni[0].quantita < 100
|
||||
},
|
||||
|
||||
isInEsaurendo: (state: IProductsState) => (product: IProduct): boolean => {
|
||||
return product.arrvariazioni[0].quantita > 0 && product.arrvariazioni[0].quantita < 50
|
||||
},
|
||||
isEsaurito: (state: IProductsState) => (product: IProduct): boolean => {
|
||||
return product.arrvariazioni[0].quantita <= 0
|
||||
},
|
||||
|
||||
isPubblicato: (state: IProductsState) => (productInfo: IProductInfo): boolean => {
|
||||
switch (productInfo?.idStatoProdotto) {
|
||||
case 1:
|
||||
case 4:
|
||||
case 34:
|
||||
case 45:
|
||||
case 46:
|
||||
case undefined:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
||||
getDescrStatiProdottoByIdStatoProdotto: (state: IProductsState) => (idStatoProdotto: number): string => {
|
||||
const ctrec = state.stati_prodotto.find((mystatus: T_Web_StatiProdotto) => mystatus.IdStatoProdotto === idStatoProdotto)
|
||||
return (ctrec) ? ctrec.Descrizione : ''
|
||||
},
|
||||
|
||||
|
||||
getArrayidArgomentoByArridCatProds: (state: IProductsState) => (arridCatProds: string[]): string[] => {
|
||||
const myarr: string[] = []
|
||||
for (const idCatProd of arridCatProds) {
|
||||
@@ -1404,14 +1439,14 @@ export const useProducts = defineStore('Products', {
|
||||
|
||||
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('Rank3M', myproduct.productInfo.rank3M) +
|
||||
this.getkeyValStr('Venduti', linkvenduti) +
|
||||
this.getkeyValStr('vLast3M', vLast3M) +
|
||||
this.getkeyValStr('vLast6M', vLast6M) +
|
||||
this.getkeyValStr('Fatturati', linkfatturati) +
|
||||
this.getkeyValStr('fatLast3M', fatLast3M) +
|
||||
this.getkeyValStr('fatLast6M', fatLast6M)
|
||||
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)) + '...'
|
||||
@@ -1458,6 +1493,7 @@ export const useProducts = defineStore('Products', {
|
||||
const isbn = myproduct.productInfo.code || ''
|
||||
const image_link = myproduct.productInfo.image_link || ''
|
||||
const imagefile = myproduct.productInfo.imagefile || ''
|
||||
const stato = this.getDescrStatiProdottoByIdStatoProdotto(myproduct.productInfo.idStatoProdotto || '')
|
||||
|
||||
const scale = optcatalogo.printable ? optcatalogo.areadistampa?.scale : 1
|
||||
// Crea una mappa di sostituzioni
|
||||
@@ -1480,6 +1516,7 @@ export const useProducts = defineStore('Products', {
|
||||
'{ranking_globale}': ranking_globale || '',
|
||||
'{venduti}': venduti || '',
|
||||
'{formato}': formato || '',
|
||||
'{stato}': stato || '',
|
||||
'{collana}': collana ? collana || '' : '',
|
||||
'{prezzo}': prezzo || '',
|
||||
'{scale}': scale || '',
|
||||
|
||||
Reference in New Issue
Block a user