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) }}