landing: compact GOA alt display and all-account bank fallback

Wire goa-amount.js into bank/exchange/merchant intros, deploy it with the
landings, and deepen the in-container bank stats fallback to scan all
accounts (skip only exchange) when the host timer is down.
This commit is contained in:
Hernâni Marques 2026-07-17 08:12:00 +02:00
parent 746d7a41af
commit 48f77139c5
No known key found for this signature in database
8 changed files with 363 additions and 39 deletions

View file

@ -811,19 +811,36 @@ sudo apt-get install -y taler-wallet-cli</pre>
</p>
</footer>
</main>
<script src="/intro/goa-amount.js"></script>
<script>
(function () {
function set(id, v) {
var el = document.getElementById(id);
if (el) el.textContent = v == null || v === "" ? "—" : String(v);
}
function setAmt(id, rowOrAmt, altMap) {
var el = document.getElementById(id);
if (!el) return;
if (window.GoaAmount) {
var f = GoaAmount.pick(rowOrAmt, altMap);
el.textContent = f.display;
if (f.title && f.title !== f.display) el.setAttribute("title", f.title);
else el.removeAttribute("title");
} else {
var raw = rowOrAmt && typeof rowOrAmt === "object"
? (rowOrAmt.amount_alt || rowOrAmt.amount_paid_sum_alt || rowOrAmt.amount_sum_alt
|| rowOrAmt.amount_paid_sum || rowOrAmt.amount_sum || rowOrAmt.amount || "—")
: (rowOrAmt == null || rowOrAmt === "" ? "—" : String(rowOrAmt));
el.textContent = raw;
}
}
function msLabel(ms, http) {
if (ms == null || ms === "") return "—";
var s = ms + " ms";
if (http && http !== "200") s += " (" + http + ")";
return s;
}
function fillCurrency(prefix, c) {
function fillCurrency(prefix, c, altMap) {
if (!c) {
set(prefix + "-paid-amt", "—");
set(prefix + "-all-amt", "—");
@ -833,8 +850,16 @@ sudo apt-get install -y taler-wallet-cli</pre>
set(prefix + "-unpaid", "—");
return;
}
set(prefix + "-paid-amt", c.amount_paid_sum || "—");
set(prefix + "-all-amt", c.amount_sum || "—");
setAmt(prefix + "-paid-amt", {
amount: c.amount_paid_sum,
amount_alt: c.amount_paid_sum_alt,
amount_full: c.amount_paid_sum_full
}, altMap);
setAmt(prefix + "-all-amt", {
amount: c.amount_sum,
amount_alt: c.amount_sum_alt,
amount_full: c.amount_sum_full
}, altMap);
set(prefix + "-orders", c.contracts);
set(prefix + "-paid", c.paid);
set(prefix + "-wired", c.wired);
@ -851,6 +876,7 @@ sudo apt-get install -y taler-wallet-cli</pre>
.then(function (r) { if (!r.ok) throw new Error("http"); return r.json(); })
.then(function (d) {
if (!d || !d.ok) throw new Error("bad");
if (window.GoaAmount) GoaAmount.rememberAlt(d);
set("st-instances", d.instances);
set("st-orders", d.orders);
set("st-paid", d.paid);
@ -862,8 +888,8 @@ sudo apt-get install -y taler-wallet-cli</pre>
(d.by_currency || []).forEach(function (c) {
by[(c.currency || "").toUpperCase()] = c;
});
fillCurrency("goa", by.GOA);
fillCurrency("chf", by.CHF);
fillCurrency("goa", by.GOA, d.alt_unit_names);
fillCurrency("chf", by.CHF, d.alt_unit_names);
function fillActivityList(el, acts) {
if (!el) return;
@ -878,10 +904,15 @@ sudo apt-get install -y taler-wallet-cli</pre>
var li = document.createElement("li");
li.className = "act-item";
// no merchant names / ids — amount, optional summary, time only
var amtShow = a.amount_alt || a.amount || "—";
if (window.GoaAmount && !a.amount_alt) {
amtShow = GoaAmount.format(a.amount, d.alt_unit_names).display;
}
var amtTitle = a.amount_full || a.amount || "";
li.innerHTML =
'<span class="act-kind ' + esc(kind) + '">' + esc(kind) + "</span>" +
'<div class="act-main">' +
'<div class="act-amt">' + esc(a.amount || "—") + "</div>" +
'<div class="act-amt" title="' + esc(amtTitle) + '">' + esc(amtShow) + "</div>" +
(a.summary
? '<div class="act-sum">' + esc(a.summary) + "</div>"
: "") +