- miglioramenti ricerca titoli e modifica del trafiletto
- miglior visualizzazione delle liste
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, T_Web_StatiProdotto, T_Web_Tipologie, T_WEB_TipiFormato, IPublisher } 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, IPublisher, ICollaneTotali } from 'model'
|
||||
|
||||
import { Api } from '@api'
|
||||
import { serv_constants } from '@src/store/Modules/serv_constants'
|
||||
@@ -352,6 +352,15 @@ export const useProducts = defineStore('Products', {
|
||||
return 0
|
||||
},
|
||||
|
||||
getTotaliProdottiByIdCollana: (state: IProductsState) => (idCollana: string): number => {
|
||||
const myfirstcat = state.collanetotali!.find((rec: ICollaneTotali) => rec._id === idCollana)
|
||||
|
||||
if (myfirstcat) {
|
||||
return myfirstcat.quanti!
|
||||
}
|
||||
return 0
|
||||
},
|
||||
|
||||
|
||||
getSubCatProdsByGas: (state: IProductsState) => (idGasOrdine: string, idCatProd: string): ISubCatProd[] => {
|
||||
let arrcat = state.subcatprods
|
||||
@@ -696,7 +705,7 @@ export const useProducts = defineStore('Products', {
|
||||
},
|
||||
|
||||
|
||||
async loadProducts() {
|
||||
async loadProducts(loadonlyifempty?: boolean) {
|
||||
|
||||
const userStore = useUserStore()
|
||||
const globalStore = useGlobalStore()
|
||||
@@ -712,6 +721,11 @@ export const useProducts = defineStore('Products', {
|
||||
// return new Types.AxiosError(0, null, 0, '')
|
||||
// }
|
||||
|
||||
if (loadonlyifempty) {
|
||||
if (this.products?.length > 0)
|
||||
return true
|
||||
}
|
||||
|
||||
let ris = null
|
||||
|
||||
let myIdActiveSelected = userStore.my._id
|
||||
@@ -1515,7 +1529,7 @@ export const useProducts = defineStore('Products', {
|
||||
replacements['{collana}'] = tools.formatCollane(myproduct.productInfo.idCollana) || '';
|
||||
}
|
||||
|
||||
const maxDescriptionLength = testo.maxlength ?? 100;
|
||||
const maxDescriptionLength = testo.maxlength || 600;
|
||||
|
||||
if (testo.contenuto.includes('{descrizione_da_fdv}')) {
|
||||
const description = myproduct.productInfo.short_descr || '';
|
||||
@@ -1534,7 +1548,7 @@ export const useProducts = defineStore('Products', {
|
||||
if (testo.contenuto.includes('{descrizione_estesa}')) {
|
||||
let addtesto = false;
|
||||
const long_descr_macro = myproduct.productInfo.descrizione_completa_macro || '';
|
||||
if (long_descr_macro.length > maxDescriptionLength) {
|
||||
if (long_descr_macro.length > maxDescriptionLength && maxDescriptionLength > 0) {
|
||||
addtesto = true;
|
||||
}
|
||||
const addstrcontinua = '<span class="book-link">👉🏻 <a href="{link_macro}" target="_blank">continua a leggere</a></span>';
|
||||
@@ -1550,14 +1564,14 @@ 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
|
||||
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}')) {
|
||||
const short_descr = myproduct.productInfo.descr_trafiletto_catalogo || '';
|
||||
replacements['{descr_trafiletto_catalogo}'] = short_descr.length > maxDescriptionLength
|
||||
replacements['{descr_trafiletto_catalogo}'] = short_descr.length > maxDescriptionLength && maxDescriptionLength > 0
|
||||
? short_descr.substring(0, short_descr.lastIndexOf(' ', maxDescriptionLength)) + '...'
|
||||
: short_descr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user