- miglioramenti ricerca titoli e modifica del trafiletto

- miglior visualizzazione delle liste
This commit is contained in:
Surya Paolo
2025-04-30 13:27:47 +02:00
parent 493ebf51f3
commit 358f0d6816
40 changed files with 1093 additions and 148 deletions

View File

@@ -482,6 +482,8 @@ export const costanti = {
cards: 16000,
color: 17000,
arrmenu: 18000,
op_andor: 19000,
editor_nohtml: 20000,
},
@@ -543,4 +545,9 @@ export const costanti = {
PER_ADMIN: 16,
},
OP_ANDOR: {
OP_OR: 0,
OP_AND: 1,
}
}

View File

@@ -150,19 +150,24 @@ export const colTableCatalogList = [
name: 'argomenti',
label_trans: 'cataloglist.argomenti',
fieldtype: costanti.FieldType.multiselect,
jointable: 'catprods',
jointable: 'catprtotali',
}),
AddCol({
name: 'condition_andor',
label_trans: 'cataloglist.op_andor',
fieldtype: costanti.FieldType.op_andor,
}),
AddCol({
name: 'idCollane',
label_trans: 'cataloglist.collane',
fieldtype: costanti.FieldType.multiselect,
jointable: 'collanas',
jointable: 'collanastotali',
}),
AddCol({
name: 'editore',
label_trans: 'cataloglist.editore',
fieldtype: costanti.FieldType.multiselect,
jointable: 'publishers',
jointable: 'publishers_totali',
}),
AddCol({ name: 'descr_introduttiva', label_trans: 'cataloglist.descr_introduttiva', fieldtype: costanti.FieldType.html, maxlength: 1300 }),
@@ -2587,6 +2592,9 @@ export const colTableProductInfos = [
AddCol({ name: 'date', label_trans: 'products.date', fieldtype: costanti.FieldType.date }),
AddCol({ name: 'link_scheda', label_trans: 'products.link_scheda' }),
AddCol({ name: 'ingredienti', label_trans: 'products.ingredienti', fieldtype: costanti.FieldType.html }),
AddCol({ name: 'descrizione_breve_macro', label_trans: 'products.descrizione_breve_macro', fieldtype: costanti.FieldType.editor_nohtml }),
AddCol({ name: 'descrizione_completa_macro', label_trans: 'products.descrizione_completa_macro', fieldtype: costanti.FieldType.editor_nohtml }),
AddCol({ name: 'descr_trafiletto_catalogo', label_trans: 'products.descr_trafiletto_catalogo', fieldtype: costanti.FieldType.editor_nohtml }),
AddCol({ name: 'valori_nutrizionali', label_trans: 'products.valori_nutrizionali', fieldtype: costanti.FieldType.html }),
AddCol({ name: 'author', label_trans: 'products.author', fieldtype: costanti.FieldType.string }),
AddCol({ name: 'collezione', label_trans: 'products.collezione', fieldtype: costanti.FieldType.string }),
@@ -4395,6 +4403,13 @@ export const fieldsTable = {
colkey: '_id',
collabel: 'name',
},
{
value: 'catprtotali',
label: 'Categorie',
columns: colTableCatProd,
colkey: '_id',
collabel: (row: any) => row.name + ' (' + row.quanti + ')',
},
{
value: 't_web_statiprodottos',
label: 'Stati Prodotto',
@@ -4423,6 +4438,13 @@ export const fieldsTable = {
colkey: '_id',
collabel: 'title',
},
{
value: 'collanastotali',
label: 'Collane Totali',
columns: colTableCollane,
colkey: '_id',
collabel: (row: any) => row.title + ' (' + row.quanti + ')',
},
{
value: 'publishers',
label: 'Nome',
@@ -4430,6 +4452,13 @@ export const fieldsTable = {
colkey: '_id',
collabel: 'name',
},
{
value: 'publishers_totali',
label: 'Nome',
columns: colTablePublisher,
colkey: '_id',
collabel: (row: any) => row.name + ' (' + row.quanti + ')',
},
{
value: 'catais',
label: 'Categorie AI',

View File

@@ -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;
}

View File

@@ -440,11 +440,14 @@ export const useGlobalStore = defineStore('GlobalStore', {
else if (table === 'departments') ris = state.departments
else if (table === 'categorys') ris = state.categories
else if (table === 'catprods') ris = Products.catprods
else if (table === 'catprtotali') ris = Products.catprtotali
else if (table === 'collanas') ris = Products.collane
else if (table === 'collanastotali') ris = Products.collane
else if (table === 'subcatprods') ris = Products.subcatprods
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 === 'publishers_totali') 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