panel: Admin accounts show raw spend only — Status/Activated/Spend/Reset (30-day spend in Balance mode, all-time in All Time); drop allowance/credits/remaining/adjust
This commit is contained in:
1 parent
0f12dc9e7b
commit
b8f737d1ee
1 file changed
+3
-24
+3
-24
@@ -276,10 +276,7 @@ PAGE_HTML = """<!DOCTYPE html>
|
|||||||
.range-btn.active { background: var(--green-mid); color: #fff; border-color: var(--green-mid); }
|
.range-btn.active { background: var(--green-mid); color: #fff; border-color: var(--green-mid); }
|
||||||
.members-all-time .balance-col.allowance-only,
|
.members-all-time .balance-col.allowance-only,
|
||||||
.members-all-time .balance-col.remaining-only { display: none; }
|
.members-all-time .balance-col.remaining-only { display: none; }
|
||||||
.admins-all-time .balance-col.allowance-only,
|
|
||||||
.admins-all-time .balance-col.remaining-only { display: none; }
|
|
||||||
.members-all-time .credits-col-head .mode-note::after,
|
.members-all-time .credits-col-head .mode-note::after,
|
||||||
.admins-all-time .credits-col-head .mode-note::after { content: " (total purchased)"; }
|
|
||||||
.table-scroll { overflow-x: auto; border-radius: 12px; }
|
.table-scroll { overflow-x: auto; border-radius: 12px; }
|
||||||
.table-scroll table { min-width: 980px; }
|
.table-scroll table { min-width: 980px; }
|
||||||
th.sortable { cursor: pointer; user-select: none; }
|
th.sortable { cursor: pointer; user-select: none; }
|
||||||
@@ -349,12 +346,8 @@ PAGE_HTML = """<!DOCTYPE html>
|
|||||||
<th>Account</th>
|
<th>Account</th>
|
||||||
<th>Status</th>
|
<th>Status</th>
|
||||||
<th>Activated</th>
|
<th>Activated</th>
|
||||||
<th class="balance-col allowance-only">Allowance</th>
|
|
||||||
<th class="balance-col credits-col-head">Credits<span class="mode-note"></span></th>
|
|
||||||
<th><span id="spend-mode-label-admin">Spend</span></th>
|
<th><span id="spend-mode-label-admin">Spend</span></th>
|
||||||
<th class="balance-col">Remaining</th>
|
<th>Reset</th>
|
||||||
<th class="balance-col">Reset</th>
|
|
||||||
<th>Adjust</th>
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody id="admin-rows"></tbody>
|
<tbody id="admin-rows"></tbody>
|
||||||
@@ -474,7 +467,7 @@ function setMemberMode(mode) {
|
|||||||
// Header label reflects the mode
|
// Header label reflects the mode
|
||||||
$('spend-mode-label').textContent = mode === 'all' ? 'All-time spend' : 'Spend';
|
$('spend-mode-label').textContent = mode === 'all' ? 'All-time spend' : 'Spend';
|
||||||
const adminLabel = document.getElementById('spend-mode-label-admin');
|
const adminLabel = document.getElementById('spend-mode-label-admin');
|
||||||
if (adminLabel) adminLabel.textContent = mode === 'all' ? 'All-time spend' : 'Spend';
|
if (adminLabel) adminLabel.textContent = mode === 'all' ? 'All-time spend' : 'Spend (30 days)';
|
||||||
// Balance-only columns (Allowance/Credits/Remaining/Reset) hide in all-time mode
|
// Balance-only columns (Allowance/Credits/Remaining/Reset) hide in all-time mode
|
||||||
$('table-members').parentElement.classList.toggle('members-all-time', mode === 'all');
|
$('table-members').parentElement.classList.toggle('members-all-time', mode === 'all');
|
||||||
const adminTable = document.getElementById('table-admins');
|
const adminTable = document.getElementById('table-admins');
|
||||||
@@ -554,26 +547,12 @@ function renderMembers() {
|
|||||||
adminSection.style.display = '';
|
adminSection.style.display = '';
|
||||||
$('admin-rows').innerHTML = adminsData.map(m => {
|
$('admin-rows').innerHTML = adminsData.map(m => {
|
||||||
const reset = m.reset_at ? m.reset_at.slice(0,10) : '—';
|
const reset = m.reset_at ? m.reset_at.slice(0,10) : '—';
|
||||||
const credits = m.credit_balance ?? 0;
|
|
||||||
const creditsLeft = m.credits_remaining ?? credits;
|
|
||||||
const creditsShown = memberMode === 'all' ? credits : creditsLeft;
|
|
||||||
const creditsCell = creditsShown > 0
|
|
||||||
? fmt(creditsShown)
|
|
||||||
: '<span style="color:var(--muted)">—</span>';
|
|
||||||
return '<tr>' +
|
return '<tr>' +
|
||||||
'<td>' + esc(m.email) + (m.username ? '<div style="color:var(--muted);font-size:11px">' + esc(m.username) + '</div>' : '') + '</td>' +
|
'<td>' + esc(m.email) + (m.username ? '<div style="color:var(--muted);font-size:11px">' + esc(m.username) + '</div>' : '') + '</td>' +
|
||||||
'<td><span class="pill manual" title="Operator account (SSO owner / bot), not a member">admin</span></td>' +
|
'<td><span class="pill manual" title="Operator account (SSO owner / bot), not a member">admin</span></td>' +
|
||||||
'<td>' + (m.activated ? '<span class="pill active">yes</span>' : '<span class="pill inactive">pending</span>') + '</td>' +
|
'<td>' + (m.activated ? '<span class="pill active">yes</span>' : '<span class="pill inactive">pending</span>') + '</td>' +
|
||||||
'<td class="num balance-col allowance-only">' + fmt(m.balance) + '</td>' +
|
|
||||||
'<td class="num balance-col">' + creditsCell + '</td>' +
|
|
||||||
'<td class="num">' + fmt(memberSpend(m)) + '</td>' +
|
'<td class="num">' + fmt(memberSpend(m)) + '</td>' +
|
||||||
'<td class="num balance-col remaining-col remaining-only">' + fmt(m.remaining) + '</td>' +
|
'<td>' + esc(reset) + '</td>' +
|
||||||
'<td class="balance-col">' + esc(reset) + '</td>' +
|
|
||||||
'<td><div class="adjust">' +
|
|
||||||
'<input id="add-' + i(m.email) + '" placeholder="+$"/>' +
|
|
||||||
'<button data-email="' + esc(m.email) + '" onclick="addBalance(this.dataset.email)" title="Add monthly allowance">Allow</button>' +
|
|
||||||
'<button data-email="' + esc(m.email) + '" class="credits-btn" onclick="addCredits(this.dataset.email)" title="Add non-expiring credits">Credit</button>' +
|
|
||||||
'</div></td>' +
|
|
||||||
'</tr>';
|
'</tr>';
|
||||||
}).join('');
|
}).join('');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user