From 0c893b1b24539cfbde5c15c45b59b7efce375040 Mon Sep 17 00:00:00 2001 From: bach Date: Sun, 6 Sep 2026 12:32:41 +0200 Subject: [PATCH] Show the exact solde amount directly in the versement badge MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The reste-à-verser/sur-versé badge only showed the word, with the exact figure available in the hover title -- had to open the drill-down modal just to see how much. linkStatus() now exposes the computed amount (montant) alongside kind/detail, and linkStatusLabel() takes the whole status object to format it inline: "Reste à verser : 440,00 €", "Sur-versé : 710,00 €", "Lié : 0,00 €" for a fully settled one. Verified live: all three cases render with the exact figure in both the main table and the drill-down modal. --- .../custom/figli_compta_ledger/js/home.js | 24 ++++++++++++------- .../templates/figli-compta-home.html.twig | 4 ++-- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/web/modules/custom/figli_compta_ledger/js/home.js b/web/modules/custom/figli_compta_ledger/js/home.js index e7c724c..328caab 100644 --- a/web/modules/custom/figli_compta_ledger/js/home.js +++ b/web/modules/custom/figli_compta_ledger/js/home.js @@ -654,23 +654,29 @@ } } if (resteAVerser > 0.01) { - return { kind: 'reste', detail: 'Reste à verser (comptes de cette ligne) : ' + this.formatEur(Math.round(resteAVerser * 100) / 100) }; + const montant = Math.round(resteAVerser * 100) / 100; + return { kind: 'reste', montant, detail: 'Reste à verser (comptes de cette ligne) : ' + this.formatEur(montant) }; } if (surVerse > 0.01) { - return { kind: 'sur-verse', detail: 'Sur-versé (comptes de cette ligne) : ' + this.formatEur(Math.round(surVerse * 100) / 100) }; + const montant = Math.round(surVerse * 100) / 100; + return { kind: 'sur-verse', montant, detail: 'Sur-versé (comptes de cette ligne) : ' + this.formatEur(montant) }; } if (unresolved) { return { kind: 'inconnu', detail: 'Entrée(s) liée(s) pas encore vérifiée(s) -- cliquer pour vérifier.' }; } const n = item.entreeLieeIds.length; - return { kind: 'ok', detail: 'Lié à ' + n + ' entrée' + (n > 1 ? 's' : '') + ' client' + (n > 1 ? 's' : '') + '.' }; + return { kind: 'ok', montant: 0, detail: 'Lié à ' + n + ' entrée' + (n > 1 ? 's' : '') + ' client' + (n > 1 ? 's' : '') + '.' }; }, - linkStatusLabel(kind) { - if (kind === 'non-liee') return 'Non liée'; - if (kind === 'reste') return 'Reste à verser'; - if (kind === 'sur-verse') return 'Sur-versé'; - if (kind === 'inconnu') return 'À vérifier'; - return 'Lié'; + // Takes the whole status object (not just kind) -- reste/sur-verse/ + // ok show the exact solde right in the badge, not just in the + // hover title, since a bare "Reste à verser" with no figure meant + // opening the drill-down modal just to see how much. + linkStatusLabel(status) { + if (status.kind === 'non-liee') return 'Non liée'; + if (status.kind === 'reste') return 'Reste à verser : ' + this.formatEur(status.montant); + if (status.kind === 'sur-verse') return 'Sur-versé : ' + this.formatEur(status.montant); + if (status.kind === 'inconnu') return 'À vérifier'; + return 'Lié : ' + this.formatEur(status.montant); }, // Only non-liee/sur-versé read as a hard anomaly (red); reste and // inconnu are their own softer amber; ok gets neither, falling back diff --git a/web/modules/custom/figli_compta_ledger/templates/figli-compta-home.html.twig b/web/modules/custom/figli_compta_ledger/templates/figli-compta-home.html.twig index 3bd05f6..1d00701 100644 --- a/web/modules/custom/figli_compta_ledger/templates/figli-compta-home.html.twig +++ b/web/modules/custom/figli_compta_ledger/templates/figli-compta-home.html.twig @@ -221,7 +221,7 @@ :class="linkStatusClasses(linkStatus(item).kind)" :title="item.entreeLieeIds.length ? linkStatus(item).detail + ' -- cliquer pour voir la ou les entrées liées' : linkStatus(item).detail + ' -- cliquer pour lier une entrée client'" @click="item.entreeLieeIds.length ? toggleEntreeFilter(item.entreeLieeIds[0], item.nid) : openLinkForm(item.nid)" - >{{ linkStatus(item).kind === 'ok' ? '' : '⚠ ' }}{{ linkStatusLabel(linkStatus(item).kind) }} + >{{ linkStatus(item).kind === 'ok' ? '' : '⚠ ' }}{{ linkStatusLabel(linkStatus(item)) }} {{ formatEur(item.montant_ht) }} @@ -299,7 +299,7 @@ v-if="linkStatus(item)" class="figli-recon-badge" :class="linkStatusClasses(linkStatus(item).kind)" - >{{ linkStatus(item).kind === 'ok' ? '' : '⚠ ' }}{{ linkStatusLabel(linkStatus(item).kind) }} + >{{ linkStatus(item).kind === 'ok' ? '' : '⚠ ' }}{{ linkStatusLabel(linkStatus(item)) }} {{ formatEur(item.montant_ht) }} {{ formatEur(item.montant_ttc) }}