Colore les lignes du graph versements selon leur type
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.
This commit is contained in:
@@ -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);
|
||||
},
|
||||
|
||||
@@ -63,11 +63,11 @@
|
||||
<section class="figli-chart-section">
|
||||
<h2>Total des versements par compte</h2>
|
||||
<p class="figli-note">Montant total versé à chaque compte associé, plus les salaires/stages et sous-traitants, toutes années confondues.</p>
|
||||
<h-bar-chart :items="versementsParCompteItems" :format-value="formatEurRound"></h-bar-chart>
|
||||
<h-bar-chart :items="versementsParCompteItems" :format-value="formatEurRound" :color-for="typeColor"></h-bar-chart>
|
||||
<div class="figli-year-hbar-grid">
|
||||
<div class="figli-year-hbar-card" v-for="y in versementsParCompteParAnnee" :key="y.annee">
|
||||
<div class="figli-year-hbar-title">{{ y.annee }}</div>
|
||||
<h-bar-chart :items="y.items" :format-value="formatEurRound" compact></h-bar-chart>
|
||||
<h-bar-chart :items="y.items" :format-value="formatEurRound" :color-for="typeColor" compact></h-bar-chart>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
Reference in New Issue
Block a user