diff --git a/web/modules/custom/figli_compta_ledger/js/dashboard.js b/web/modules/custom/figli_compta_ledger/js/dashboard.js index 21efa6e..efdf5d1 100644 --- a/web/modules/custom/figli_compta_ledger/js/dashboard.js +++ b/web/modules/custom/figli_compta_ledger/js/dashboard.js @@ -188,14 +188,19 @@ // reads as "who/what actually got paid", not just the 6 associés. // Sourced from total_par_type (all-time)/total_par_type_par_annee, // same fields typeItems()/typeItemsParAnnee() above already use. + // `type` on every item is what colorFor="typeColor" keys off of + // (same typeColor() method typeItems() already feeds) -- the 6 + // compte rows are coloured as "versement" (they're that same + // money, just broken down by recipient instead of summed), and + // the two extra rows keep their own type colour. versementsParCompteItems() { if (!this.stats) return []; const items = Object.entries(this.stats.total_par_type_par_compte) .filter(([, parType]) => parType.versement !== undefined) - .map(([compte, parType]) => ({ label: compte, value: parType.versement })); + .map(([compte, parType]) => ({ label: compte, value: parType.versement, type: 'versement' })); const parType = this.stats.total_par_type || {}; - if (parType.salaire_stage) items.push({ label: TYPE_LABELS.salaire_stage, value: parType.salaire_stage }); - if (parType.sous_traitant) items.push({ label: TYPE_LABELS.sous_traitant, value: parType.sous_traitant }); + 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); }, // Small multiples, one per year -- same source as typeItemsParAnnee @@ -207,10 +212,10 @@ 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 })); + .map(([compte, parType]) => ({ label: compte, value: parType.versement, type: 'versement' })); 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 }); - if (parType.sous_traitant) items.push({ label: TYPE_LABELS.sous_traitant, value: parType.sous_traitant }); + 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) }; }).filter((y) => y.items.length); }, diff --git a/web/modules/custom/figli_compta_ledger/templates/figli-compta-dashboard.html.twig b/web/modules/custom/figli_compta_ledger/templates/figli-compta-dashboard.html.twig index 9d4a9eb..7280cea 100644 --- a/web/modules/custom/figli_compta_ledger/templates/figli-compta-dashboard.html.twig +++ b/web/modules/custom/figli_compta_ledger/templates/figli-compta-dashboard.html.twig @@ -63,11 +63,11 @@

Total des versements par compte

Montant total versé à chaque compte associé, plus les salaires/stages et sous-traitants, toutes années confondues.

- +
{{ y.annee }}
- +