- miglioramenti ricerca titoli e modifica del trafiletto
- miglior visualizzazione delle liste
This commit is contained in:
@@ -26,6 +26,7 @@ import type {
|
||||
IText,
|
||||
ICollana,
|
||||
IOptRigenera,
|
||||
IOpAndOr,
|
||||
} from 'model';
|
||||
import {
|
||||
IMyPage,
|
||||
@@ -107,8 +108,8 @@ export default defineComponent({
|
||||
}, { deep: false });
|
||||
|
||||
watch(optrigenera.value, (newVal) => {
|
||||
tools.setCookie((showListaArgomenti.value ? 'INC_ES_' : '') +'VIS_DISP', newVal.visibilitaDisp);
|
||||
tools.setCookie((showListaArgomenti.value ? 'INC_ES_' : '') +'VIS_STATO', newVal.stato);
|
||||
tools.setCookie((showListaArgomenti.value ? 'INC_ES_' : '') + 'VIS_DISP', newVal.visibilitaDisp);
|
||||
tools.setCookie((showListaArgomenti.value ? 'INC_ES_' : '') + 'VIS_STATO', newVal.stato);
|
||||
if (showListaArgomenti.value)
|
||||
calcArrProducts()
|
||||
}, { deep: true });
|
||||
@@ -243,12 +244,14 @@ export default defineComponent({
|
||||
|
||||
watch(() => cat.value, (newval, oldval) => {
|
||||
|
||||
if (loadpage.value) {
|
||||
tools.setCookie(getKeyCatAtLoad(), cat.value.toString())
|
||||
filter.value.author = '' // disattivo il filtro autore
|
||||
resetSearch()
|
||||
if (showListaArgomenti.value) {
|
||||
if (loadpage.value) {
|
||||
tools.setCookie(getKeyCatAtLoad(), cat.value.toString())
|
||||
filter.value.author = '' // disattivo il filtro autore
|
||||
resetSearch()
|
||||
|
||||
calcArrProducts()
|
||||
calcArrProducts()
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -489,6 +492,7 @@ export default defineComponent({
|
||||
editore: string[],
|
||||
idCollane: string[],
|
||||
arrargomstr: any[],
|
||||
op_andor: IOpAndOr,
|
||||
catstr: string,
|
||||
gasselstr: string,
|
||||
cosaValue: any,
|
||||
@@ -505,7 +509,11 @@ export default defineComponent({
|
||||
const boolfiltroVuotoidTipologie = filtroidTipologie.length === 0;
|
||||
const boolfiltroVuotoEditore = editore.length === 0;
|
||||
const boolfiltroVuotoCollane = idCollane.length === 0;
|
||||
// const boolfiltroVuotoArgomenti = arrargomstr.length === 0;
|
||||
const boolfiltroVuotoArgomenti = arrargomstr.length === 0;
|
||||
|
||||
const se_tutti_veri = op_andor.condition_andor === costanti.OP_ANDOR.OP_AND;
|
||||
|
||||
const trovatocatalogo = getCatalogoByMyPage.value
|
||||
|
||||
const arrris = products
|
||||
.filter((product: IProduct) => {
|
||||
@@ -536,20 +544,32 @@ export default defineComponent({
|
||||
const lowerName = (product.productInfo.name || '').toLowerCase();
|
||||
const lowerCode = (product.productInfo.code || '').toLowerCase();
|
||||
|
||||
const boolfiltroVuotoCat = product.productInfo.idCatProds?.length === 0
|
||||
|
||||
// Filtri per argomenti e categorie
|
||||
let hasCategoria = false;
|
||||
let hasArgomentiCat = true;
|
||||
let hasCategoria = se_tutti_veri;
|
||||
let hasArgomentiCat = se_tutti_veri;
|
||||
if (arrargomstr && arrargomstr.length > 0) {
|
||||
hasArgomentiCat = (product.productInfo.idCatProds || []).some((idCat: any) => arrargomstr.includes(idCat));
|
||||
hasCategoria = true;
|
||||
hasCategoria = se_tutti_veri;
|
||||
} else {
|
||||
if (catstr === costanti.NO_CATEGORY) {
|
||||
hasCategoria = product.productInfo.idCatProds?.length === 0
|
||||
if (!optcatalogo.value.showListaArgomenti) {
|
||||
|
||||
} else {
|
||||
hasCategoria = !catstr || (catstr && (product.productInfo.idCatProds || []).includes(catstr));
|
||||
hasCategoria = (catstr === costanti.NO_CATEGORY)
|
||||
? (boolfiltroVuotoCat ? se_tutti_veri : product.productInfo.idCatProds.length === 0)
|
||||
: !catstr || (product.productInfo.idCatProds || []).includes(catstr);
|
||||
|
||||
hasArgomentiCat = boolfiltroVuotoArgomenti
|
||||
? se_tutti_veri
|
||||
: hasArgomentiCat
|
||||
}
|
||||
}
|
||||
|
||||
/*hasArgomentiCat = boolfiltroVuotoArgomenti
|
||||
? se_tutti_veri
|
||||
: hasArgomentiCat*/
|
||||
|
||||
// Filtri per autore
|
||||
const hasAuthor = !filtroAuthor || (product.productInfo.idAuthors || []).includes(filtroAuthor);
|
||||
|
||||
@@ -569,13 +589,13 @@ export default defineComponent({
|
||||
|
||||
// Filtri per editore
|
||||
const hasPublished = boolfiltroVuotoEditore
|
||||
? true
|
||||
? se_tutti_veri
|
||||
: editore.includes(product.productInfo.idPublisher);
|
||||
|
||||
// Filtri per collana
|
||||
const hasCollana = boolfiltroVuotoCollane
|
||||
? true
|
||||
: (idCollane || []).includes(product.productInfo.idCollana?.toString())
|
||||
? se_tutti_veri
|
||||
: (idCollane || []).includes(product.productInfo.idCollana)
|
||||
|
||||
// Filtri per GAS
|
||||
const productgassel = !gasselstr || (cosaValue === shared_consts.PROD.GAS && product.idGasordine === gasselstr);
|
||||
@@ -589,20 +609,24 @@ export default defineComponent({
|
||||
return codeMatch || allWordsPresent;
|
||||
});
|
||||
|
||||
return (
|
||||
searchMatch &&
|
||||
hasAuthor &&
|
||||
productgassel &&
|
||||
hasidTipologie &&
|
||||
// hasProductTypes &&
|
||||
(
|
||||
hasPublished &&
|
||||
hasCollana &&
|
||||
hasCategoria &&
|
||||
hasArgomentiCat
|
||||
)
|
||||
// && !hasExcludeProductTypes
|
||||
);
|
||||
// Funzione che valuta un gruppo in base a OP_AND o OP_OR
|
||||
|
||||
// Raccolgo tutti i gruppi attivi
|
||||
const filtri = [hasArgomentiCat, hasCategoria, hasCollana, hasPublished];
|
||||
|
||||
// Decido se combinare in AND o OR sulla base della scelta globale
|
||||
let risult = searchMatch && hasAuthor && productgassel && hasidTipologie
|
||||
|
||||
if (op_andor.condition_andor === costanti.OP_ANDOR.OP_AND) {
|
||||
risult = risult && filtri.every(Boolean); // Tutti i gruppi devono essere veri
|
||||
} else {
|
||||
risult = risult && filtri.some(Boolean)
|
||||
}
|
||||
|
||||
return risult
|
||||
|
||||
// && !hasExcludeProductTypes
|
||||
|
||||
})
|
||||
.sort((a, b) => getProductsSorted([a, b], sortField, sortDir)[0] === a ? -1 : 1);
|
||||
|
||||
@@ -654,6 +678,10 @@ export default defineComponent({
|
||||
generalista = true
|
||||
}*/
|
||||
|
||||
let op_andor: IOpAndOr = {
|
||||
condition_andor: trovatocatalogo?.condition_andor !== undefined ? trovatocatalogo.condition_andor : costanti.OP_ANDOR.OP_AND,
|
||||
}
|
||||
|
||||
if (!generalista && (trovatocatalogo?.lista_prodotti.length > 0)) {
|
||||
arrprod = trovatocatalogo?.lista_prodotti
|
||||
} else {
|
||||
@@ -668,6 +696,7 @@ export default defineComponent({
|
||||
filtroPublishers,
|
||||
filtroCollane,
|
||||
arrargomstr,
|
||||
op_andor,
|
||||
catstr,
|
||||
gasselstr,
|
||||
cosa.value,
|
||||
@@ -749,6 +778,11 @@ export default defineComponent({
|
||||
const gasselstr = cosa.value === shared_consts.PROD.GAS ? idGasSel.value || '' : '';
|
||||
|
||||
const trovatocatalogo = getCatalogoByMyPage.value
|
||||
|
||||
let op_andor: IOpAndOr = {
|
||||
condition_andor: trovatocatalogo?.condition_andor ?? costanti.OP_ANDOR.OP_AND,
|
||||
}
|
||||
|
||||
if (trovatocatalogo?.lista_prodotti.length > 0) {
|
||||
arrprod = trovatocatalogo?.lista_prodotti
|
||||
} else {
|
||||
@@ -764,6 +798,7 @@ export default defineComponent({
|
||||
filtroPublishers,
|
||||
filtroCollane,
|
||||
arrargomstr,
|
||||
op_andor,
|
||||
catstr,
|
||||
gasselstr,
|
||||
cosa.value,
|
||||
@@ -785,7 +820,7 @@ export default defineComponent({
|
||||
function getProductsSorted(arrprod: IProduct[], sort_field: string, sort_dir: number): IProduct[] {
|
||||
if (sort_field) {
|
||||
|
||||
console.log('--- Primi 10 elementi INIZIALI:');
|
||||
// console.log('--- Primi 10 elementi INIZIALI:');
|
||||
arrprod.slice(0, 15).forEach((product, index) => {
|
||||
console.log(
|
||||
`${index + 1}. ${product.productInfo?.name} (${product.productInfo?.date_pub})`
|
||||
@@ -817,7 +852,7 @@ export default defineComponent({
|
||||
|
||||
// logga i primi N elementi, mostrando il nome del prodotto (productInfo.name e la data di pibblicazione : productinfo.date_pub
|
||||
if (sortedArr.length > 0) {
|
||||
console.log('Primi 15 elementi ordinati: ***** ');
|
||||
// console.log('Primi 15 elementi ordinati: ***** ');
|
||||
sortedArr.slice(0, 15).forEach((product, index) => {
|
||||
console.log(
|
||||
`${index + 1}. ${product.productInfo?.name} (${product.productInfo?.date_pub})`
|
||||
@@ -1053,15 +1088,16 @@ export default defineComponent({
|
||||
|
||||
generatinglist.value = true
|
||||
|
||||
cat.value = tools.getCookie(getKeyCatAtLoad(), '')
|
||||
if (showListaArgomenti.value)
|
||||
cat.value = tools.getCookie(getKeyCatAtLoad(), '')
|
||||
|
||||
tabcatalogo.value = tools.getCookie('TAB_CAT', 'visu')
|
||||
|
||||
optrigenera.value.visibilitaDisp = tools.getCookie((showListaArgomenti.value ? 'INC_ES_' : '') + 'VIS_DISP', costanti.DISP.DISPONIBILI)
|
||||
optrigenera.value.stato = tools.getCookie((showListaArgomenti.value ? 'INC_ES_' : '') +'VIS_STATO', costanti.STATO.IN_COMMERCIO)
|
||||
optrigenera.value.stato = tools.getCookie((showListaArgomenti.value ? 'INC_ES_' : '') + 'VIS_STATO', costanti.STATO.IN_COMMERCIO)
|
||||
|
||||
loadpage.value = false
|
||||
await productStore.loadProducts()
|
||||
await productStore.loadProducts(true)
|
||||
|
||||
mycolumns.value = fieldsTable.getArrColsByTable('products')
|
||||
|
||||
@@ -1120,7 +1156,7 @@ export default defineComponent({
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// productStore.getTotaliProdottiByIdCollana(rec._id)
|
||||
|
||||
function onLoadScroll(index: number, done: any) {
|
||||
if (index >= 1) {
|
||||
|
||||
Reference in New Issue
Block a user