From d17a3e2e33086cf5bdf30ef5cb98b6adfc174729 Mon Sep 17 00:00:00 2001 From: bach Date: Tue, 8 Sep 2026 15:05:18 +0200 Subject: [PATCH] Ajoute Salaire/stage et Sous-traitant au graphique des versements par compte MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Deux lignes supplémentaires (pas ventilées par compte, un seul total chacune) dans "Total des versements par compte" et sa version par année -- même source déjà utilisée par "Répartition de l'activité par type" (total_par_type / total_par_type_par_annee), aucun changement backend. --- .../figli_compta_ledger/js/dashboard.js | 24 ++++++++++++++----- .../figli-compta-dashboard.html.twig | 2 +- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/web/modules/custom/figli_compta_ledger/js/dashboard.js b/web/modules/custom/figli_compta_ledger/js/dashboard.js index 05ddbec..21efa6e 100644 --- a/web/modules/custom/figli_compta_ledger/js/dashboard.js +++ b/web/modules/custom/figli_compta_ledger/js/dashboard.js @@ -181,12 +181,22 @@ // 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. + // Salaire/stage and sous-traitant are the two other ways money + // leaves the collective toward a person/entity outside the 6 + // comptes associés -- added as two extra rows (not split per + // compte, there's only one meaningful total each) so the chart + // 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. versementsParCompteItems() { if (!this.stats) return []; - return Object.entries(this.stats.total_par_type_par_compte) + const items = 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); + .map(([compte, parType]) => ({ label: compte, value: parType.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 }); + return items.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 @@ -197,9 +207,11 @@ 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 }; + .map(([compte, parType]) => ({ label: compte, value: parType.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 }); + return { annee, items: items.sort((a, b) => b.value - a.value) }; }).filter((y) => y.items.length); }, totalCA() { 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 04dc286..9d4a9eb 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 @@ -62,7 +62,7 @@

Total des versements par compte

-

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

+

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