diff --git a/web/modules/custom/figli_compta_ledger/js/dashboard.js b/web/modules/custom/figli_compta_ledger/js/dashboard.js index efdf5d1..78c2bfe 100644 --- a/web/modules/custom/figli_compta_ledger/js/dashboard.js +++ b/web/modules/custom/figli_compta_ledger/js/dashboard.js @@ -195,13 +195,18 @@ // the two extra rows keep their own type colour. versementsParCompteItems() { if (!this.stats) return []; + // Alphabetical among the 6 comptes, but Salaire/stage and + // Sous-traitant always pushed on afterward -- they're not + // comptes, so they stay out of that ordering and just close out + // the list, in that fixed order. const items = Object.entries(this.stats.total_par_type_par_compte) .filter(([, parType]) => parType.versement !== undefined) - .map(([compte, parType]) => ({ label: compte, value: parType.versement, type: 'versement' })); + .map(([compte, parType]) => ({ label: compte, value: parType.versement, type: 'versement' })) + .sort((a, b) => a.label.localeCompare(b.label, 'fr')); const parType = this.stats.total_par_type || {}; if (parType.salaire_stage) items.push({ label: TYPE_LABELS.salaire_stage, value: parType.salaire_stage, type: 'salaire_stage' }); if (parType.sous_traitant) items.push({ label: TYPE_LABELS.sous_traitant, value: parType.sous_traitant, type: 'sous_traitant' }); - return items.sort((a, b) => b.value - a.value); + return items; }, // Small multiples, one per year -- same source as typeItemsParAnnee // above (total_par_type_par_compte_par_annee, already there for @@ -212,11 +217,12 @@ const parCompte = this.stats.total_par_type_par_compte_par_annee[annee] || {}; const items = Object.entries(parCompte) .filter(([, parType]) => parType.versement !== undefined) - .map(([compte, parType]) => ({ label: compte, value: parType.versement, type: 'versement' })); + .map(([compte, parType]) => ({ label: compte, value: parType.versement, type: 'versement' })) + .sort((a, b) => a.label.localeCompare(b.label, 'fr')); const parType = this.stats.total_par_type_par_annee[annee] || {}; if (parType.salaire_stage) items.push({ label: TYPE_LABELS.salaire_stage, value: parType.salaire_stage, type: 'salaire_stage' }); if (parType.sous_traitant) items.push({ label: TYPE_LABELS.sous_traitant, value: parType.sous_traitant, type: 'sous_traitant' }); - return { annee, items: items.sort((a, b) => b.value - a.value) }; + return { annee, items }; }).filter((y) => y.items.length); }, totalCA() {