Ajoute un filtre par tag de signalement sur /lignes et /dashboard/compte
Même modèle multiselect/OR que les filtres Compte et Type déjà en place, en complément (pas en remplacement) du simple on/off "Signalées uniquement" du grand livre. Sur /dashboard/compte, la liste d'options se limite aux tags réellement présents pour le compte sélectionné, et se réinitialise au changement de compte.
This commit is contained in:
@@ -289,6 +289,7 @@
|
||||
filterCompte: params.get('compte') ? params.get('compte').split(',') : [],
|
||||
filterClient: params.get('client') || '',
|
||||
filterType: params.get('type') ? params.get('type').split(',') : [],
|
||||
filterFlag: params.get('tag') ? params.get('tag').split(',') : [],
|
||||
filterYear: params.get('annee') || '',
|
||||
onlyErrors: params.get('ecarts') === '1',
|
||||
onlyFlagged: params.get('signale') === '1',
|
||||
@@ -301,6 +302,7 @@
|
||||
if (state.filterCompte.length) params.set('compte', state.filterCompte.join(','));
|
||||
if (state.filterClient) params.set('client', state.filterClient);
|
||||
if (state.filterType.length) params.set('type', state.filterType.join(','));
|
||||
if (state.filterFlag.length) params.set('tag', state.filterFlag.join(','));
|
||||
if (state.filterYear) params.set('annee', state.filterYear);
|
||||
if (state.onlyErrors) params.set('ecarts', '1');
|
||||
if (state.onlyFlagged) params.set('signale', '1');
|
||||
@@ -397,6 +399,11 @@
|
||||
filterCompte: [],
|
||||
filterClient: '',
|
||||
filterType: [],
|
||||
// Same array/OR-semantics/multiselect model as filterCompte/
|
||||
// filterType above -- independent of onlyFlagged (the plain on/
|
||||
// off toggle): this narrows to specific tags, onlyFlagged just
|
||||
// means "has any tag at all".
|
||||
filterFlag: [],
|
||||
filterYear: '',
|
||||
jumpYearValue: '',
|
||||
// Not a filter itself (jumpYearValue always resets to '' right
|
||||
@@ -593,6 +600,7 @@
|
||||
if (this.filterCompte.length && !this.filterCompte.some((c) => r.parCompte[c] !== undefined)) return false;
|
||||
if (this.filterClient && r.client !== this.filterClient) return false;
|
||||
if (this.filterType.length && !this.filterType.includes(r.type)) return false;
|
||||
if (this.filterFlag.length && !this.filterFlag.some((f) => r.flags.includes(f))) return false;
|
||||
if (this.filterYear && (r.date || '').slice(0, 4) !== this.filterYear) return false;
|
||||
if (this.onlyErrors && !r.hasError) return false;
|
||||
if (this.onlyFlagged && !r.hasFlag) return false;
|
||||
@@ -1331,7 +1339,7 @@
|
||||
// filter with only a few matches a year could search almost forever
|
||||
// without surfacing more of them.
|
||||
isFiltering() {
|
||||
return !!(this.filterCompte.length || this.filterClient || this.filterType.length || this.onlyErrors || this.onlyFlagged);
|
||||
return !!(this.filterCompte.length || this.filterClient || this.filterType.length || this.filterFlag.length || this.onlyErrors || this.onlyFlagged);
|
||||
},
|
||||
// Keeps extending the window (both directions) as long as a filter
|
||||
// leaves too few matching rows to fill the viewport -- otherwise
|
||||
@@ -1543,6 +1551,7 @@
|
||||
filterCompte: this.filterCompte,
|
||||
filterClient: this.filterClient,
|
||||
filterType: this.filterType,
|
||||
filterFlag: this.filterFlag,
|
||||
filterYear: this.filterYear,
|
||||
onlyErrors: this.onlyErrors,
|
||||
onlyFlagged: this.onlyFlagged,
|
||||
@@ -1592,6 +1601,10 @@
|
||||
this.ensureScrollable();
|
||||
this.syncHash();
|
||||
},
|
||||
filterFlag() {
|
||||
this.ensureScrollable();
|
||||
this.syncHash();
|
||||
},
|
||||
onlyErrors() {
|
||||
this.ensureScrollable();
|
||||
this.syncHash();
|
||||
@@ -1612,6 +1625,7 @@
|
||||
this.filterCompte = hashState.filterCompte;
|
||||
this.filterClient = hashState.filterClient;
|
||||
this.filterType = hashState.filterType;
|
||||
this.filterFlag = hashState.filterFlag;
|
||||
this.onlyErrors = hashState.onlyErrors;
|
||||
this.onlyFlagged = hashState.onlyFlagged;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user