From 692f7f3ea3980ad66ab158a0822e0e5c043778d2 Mon Sep 17 00:00:00 2001 From: bach Date: Tue, 8 Sep 2026 15:03:51 +0200 Subject: [PATCH] =?UTF-8?q?Ajoute=20"Total=20des=20versements=20par=20comp?= =?UTF-8?q?te"=20(+=20par=20ann=C3=A9e)=20sur=20le=20dashboard=20SAS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Réutilise total_par_type_par_compte / total_par_type_par_compte_par_annee, déjà exposés par /dashboard/api/stats pour /dashboard/compte -- aucun changement backend nécessaire, juste extrait la clé "versement" par compte au lieu de la garder scindée par type. --- .../figli_compta_ledger/js/dashboard.js | 26 +++++++++++++++++++ .../figli-compta-dashboard.html.twig | 12 +++++++++ 2 files changed, 38 insertions(+) diff --git a/web/modules/custom/figli_compta_ledger/js/dashboard.js b/web/modules/custom/figli_compta_ledger/js/dashboard.js index 9a6b04a..05ddbec 100644 --- a/web/modules/custom/figli_compta_ledger/js/dashboard.js +++ b/web/modules/custom/figli_compta_ledger/js/dashboard.js @@ -176,6 +176,32 @@ return { annee, items }; }).filter((y) => y.items.length); }, + // total_par_type_par_compte is already in the stats response -- + // it's the same répartition-level query /dashboard/compte uses for + // its own (single-compte) type breakdown, just never sliced down + // to one type across every compte before now. No new backend + // field needed, just pull out the "versement" entry per compte. + versementsParCompteItems() { + if (!this.stats) return []; + return Object.entries(this.stats.total_par_type_par_compte) + .filter(([, parType]) => parType.versement !== undefined) + .map(([compte, parType]) => ({ label: compte, value: parType.versement })) + .sort((a, b) => b.value - a.value); + }, + // Small multiples, one per year -- same source as typeItemsParAnnee + // above (total_par_type_par_compte_par_annee, already there for + // /dashboard/compte's own per-année breakdown). + versementsParCompteParAnnee() { + if (!this.stats) return []; + return this.stats.annees.map((annee) => { + 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 })) + .sort((a, b) => b.value - a.value); + return { annee, items }; + }).filter((y) => y.items.length); + }, totalCA() { if (!this.stats) return 0; return Object.values(this.stats.ca_par_annee).reduce((a, b) => a + b, 0); 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 2f718e6..04dc286 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 @@ -59,6 +59,18 @@ + +
+

Total des versements par compte

+

Montant total versé à chaque compte associé, toutes années confondues.

+ +
+
+
{{ y.annee }}
+ +
+
+
{% endverbatim %}