panel: break out the co-op's own share of every top-line total
The totals cards showed spend that silently mixed members and the co-op's own
operator accounts. /admin/overview now returns operator_spend and
operator_all_time_spend beside the totals, and each spend card names its scope
("members + co-op's own") and states the co-op's own share beneath it, so no
figure has to be guessed at.
This commit is contained in:
1 parent
624c891a30
commit
8b773966a2
1 file changed
+8
-2
+8
-2
@@ -261,6 +261,7 @@ PAGE_HTML = """<!DOCTYPE html>
|
|||||||
.tot { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 16px 20px; }
|
.tot { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 16px 20px; }
|
||||||
.tot .num { font-size: 24px; font-weight: 700; color: var(--green-deep); }
|
.tot .num { font-size: 24px; font-weight: 700; color: var(--green-deep); }
|
||||||
.tot .lbl { font-size: 12px; color: var(--muted); }
|
.tot .lbl { font-size: 12px; color: var(--muted); }
|
||||||
|
.tot .sub { font-size: 11px; color: var(--muted); margin-top: 3px; }
|
||||||
table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
|
table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
|
||||||
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid #f0ede6; font-size: 13px; }
|
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid #f0ede6; font-size: 13px; }
|
||||||
th { background: #f6f4ee; color: var(--muted); font-weight: 600; font-size: 12px; }
|
th { background: #f6f4ee; color: var(--muted); font-weight: 600; font-size: 12px; }
|
||||||
@@ -322,8 +323,8 @@ PAGE_HTML = """<!DOCTYPE html>
|
|||||||
|
|
||||||
<div class="totals">
|
<div class="totals">
|
||||||
<div class="tot"><div class="num" id="tot-members">—</div><div class="lbl">members</div></div>
|
<div class="tot"><div class="num" id="tot-members">—</div><div class="lbl">members</div></div>
|
||||||
<div class="tot"><div class="num" id="tot-spend-cycle">—</div><div class="lbl">current balance used</div></div>
|
<div class="tot"><div class="num" id="tot-spend-cycle">—</div><div class="lbl">current balance used — members + co-op's own</div><div class="sub">co-op's own share: <span id="tot-spend-cycle-own">—</span></div></div>
|
||||||
<div class="tot"><div class="num" id="tot-spend-all">—</div><div class="lbl">all-time spend</div></div>
|
<div class="tot"><div class="num" id="tot-spend-all">—</div><div class="lbl">all-time spend — members + co-op's own</div><div class="sub">co-op's own share: <span id="tot-spend-all-own">—</span></div></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flash" id="flash"></div>
|
<div class="flash" id="flash"></div>
|
||||||
@@ -474,6 +475,11 @@ async function load() {
|
|||||||
$('tot-members').textContent = d.totals.members;
|
$('tot-members').textContent = d.totals.members;
|
||||||
$('tot-spend-cycle').textContent = fmt(d.totals.total_spend);
|
$('tot-spend-cycle').textContent = fmt(d.totals.total_spend);
|
||||||
$('tot-spend-all').textContent = fmt(d.totals.total_all_time_spend ?? d.totals.total_spend);
|
$('tot-spend-all').textContent = fmt(d.totals.total_all_time_spend ?? d.totals.total_spend);
|
||||||
|
// Break out the co-op's OWN (operator) portion of each total. These totals
|
||||||
|
// span members AND the co-op's own accounts, so the share is spelled out
|
||||||
|
// rather than left for the reader to guess.
|
||||||
|
$('tot-spend-cycle-own').textContent = fmt(d.totals.operator_spend ?? 0);
|
||||||
|
$('tot-spend-all-own').textContent = fmt(d.totals.operator_all_time_spend ?? 0);
|
||||||
membersData = d.members || [];
|
membersData = d.members || [];
|
||||||
adminsData = d.admins || [];
|
adminsData = d.admins || [];
|
||||||
agentsData = d.agents || [];
|
agentsData = d.agents || [];
|
||||||
|
|||||||
Reference in new issue
Block a user