From 612269ec6d3ae2c83171bff2427b993c2762a17c Mon Sep 17 00:00:00 2001 From: bach Date: Tue, 8 Sep 2026 15:07:41 +0200 Subject: [PATCH] Colore les lignes du graph versements selon leur type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Les 6 comptes reprennent la couleur "versement" (orange, même que "Versement freelance" dans Répartition par type) puisque c'est la même somme, juste ventilée par bénéficiaire ; Salaire/stage et Sous-traitant gardent leur propre couleur de type. Réutilise typeColor()/TYPE_COLORS déjà en place, juste besoin d'un champ "type" sur chaque item pour que colorFor puisse s'en servir. --- .../custom/figli_compta_ledger/js/dashboard.js | 17 +++++++++++------ .../templates/figli-compta-dashboard.html.twig | 4 ++-- 2 files changed, 13 insertions(+), 8 deletions(-) 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 }}
- +