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.