diff --git a/web/modules/custom/figli_compta_ledger/css/dashboard.css b/web/modules/custom/figli_compta_ledger/css/dashboard.css index 8bb8fc8..a3d09c3 100644 --- a/web/modules/custom/figli_compta_ledger/css/dashboard.css +++ b/web/modules/custom/figli_compta_ledger/css/dashboard.css @@ -364,6 +364,25 @@ html.gin--dark-mode #figli-dashboard-app { font-size: 0.7rem; } +/* Total line under an h-bar-chart (currently just Charges structurelles + par client, main chart and each per-année card) -- separate from the + chart component itself, plain right-aligned text matching + .figli-hbar-value's alignment/tabular-nums so the total lines up + visually with the bars' own value column above it. */ +#figli-dashboard-app .figli-chart-total { + margin-top: 0.5rem; + padding-top: 0.5rem; + border-top: 1px solid var(--figli-border); + text-align: right; + font-weight: 700; + font-variant-numeric: tabular-nums; +} +#figli-dashboard-app .figli-chart-total.is-compact { + margin-top: 0.4rem; + padding-top: 0.4rem; + font-size: 0.72rem; +} + /* --- Year small multiples (par année, next to the all-time chart) --- */ #figli-dashboard-app .figli-year-hbar-grid { display: grid; diff --git a/web/modules/custom/figli_compta_ledger/js/dashboard.js b/web/modules/custom/figli_compta_ledger/js/dashboard.js index 5dffe89..bba6b74 100644 --- a/web/modules/custom/figli_compta_ledger/js/dashboard.js +++ b/web/modules/custom/figli_compta_ledger/js/dashboard.js @@ -270,6 +270,14 @@ typeColor(item) { return TYPE_COLORS[item.type] || '#6b7280'; }, + // Sum of an hbar chart's own items -- for the "Total" line under + // Charges structurelles par client (main chart and each per-année + // card): those items are already whatever's actually plotted, so + // summing them directly (rather than a separate stats field) keeps + // the total consistent with the bars above it by construction. + sumItems(items) { + return items.reduce((sum, i) => sum + i.value, 0); + }, async load() { this.loading = true; this.error = null; 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 e73a875..de9f20c 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 @@ -64,10 +64,12 @@

Charges structurelles par client

Montant total (HT, valeur absolue) des charges structurelles par vendeur/organisme, toutes années confondues.

+
Total : {{ formatEurRound(sumItems(chargeParClientItems)) }}
{{ y.annee }}
+
Total : {{ formatEurRound(sumItems(y.items)) }}