- 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 || '',
|
||||
|
||||
@@ -441,6 +441,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
else if (table === 'catprods_gas') ris = Products.catprods_gas
|
||||
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 === 'catais') ris = state.catAI
|
||||
else if (table === 'queryais') ris = state.queryAIList
|
||||
else if (table === 'sharewithus') ris = state.sharewithus
|
||||
@@ -1827,6 +1828,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
Products.catprtotali = (res.data.catprtotali) ? [...res.data.catprtotali] : []
|
||||
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.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] : []
|
||||
@@ -2607,12 +2609,12 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
|
||||
return null
|
||||
},
|
||||
async updateLocalDbFromGM_T_Web_Articoli(sku: string) {
|
||||
async updateLocalDbFromGM_T_Web_Articoli(sku: string, isbn: string) {
|
||||
|
||||
const options: IOptQueryGM = {
|
||||
nameTable: 'T_Web_Articoli',
|
||||
query: '',
|
||||
where: 'T.IdArticolo =' + sku,
|
||||
where: 'T.IdArticolo =' + sku + ' AND T.Ean13 = ' + isbn,
|
||||
showQtaDisponibile: false,
|
||||
outhtml: false,
|
||||
cmd: shared_consts.CmdQueryMs.UPDATE,
|
||||
@@ -2623,9 +2625,9 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
|
||||
return !!valueris
|
||||
},
|
||||
async updateAllBookFromGM_T_Web_Articoli(sku: string) {
|
||||
async updateAllBookFromGM_T_Web_Articoli(options: any) {
|
||||
|
||||
const valueris = await this.updateAllBookTableContent({ sku });
|
||||
const valueris = await this.updateAllBookTableContent(options);
|
||||
|
||||
return valueris
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user