mirror of
https://github.com/myronblair/tomtomgames
synced 2026-06-30 17:51:08 -05:00
Show dollar/token totals on platform cards instead of counts
Purchases shows sum of amount_cents as dollars, cashouts shows sum of tokens with coin icon. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+2
-2
@@ -1238,11 +1238,11 @@ async function loadPlatformStats() {
|
||||
${lowBadge}
|
||||
<div style="display:flex;gap:10px;margin-top:12px;padding-top:10px;border-top:1px solid var(--border)">
|
||||
<div style="flex:1;text-align:center">
|
||||
<div style="font-family:'Exo 2',sans-serif;font-weight:700;font-size:17px;color:var(--gold)">${p.purchases}</div>
|
||||
<div style="font-family:'Exo 2',sans-serif;font-weight:700;font-size:15px;color:var(--gold)">$${parseFloat(p.purchases_total).toLocaleString(undefined,{minimumFractionDigits:2,maximumFractionDigits:2})}</div>
|
||||
<div style="font-size:11px;color:var(--text2);font-weight:700;letter-spacing:.5px">PURCH</div>
|
||||
</div>
|
||||
<div style="flex:1;text-align:center;border-left:1px solid var(--border)">
|
||||
<div style="font-family:'Exo 2',sans-serif;font-weight:700;font-size:17px;color:var(--green)">${p.cashouts}</div>
|
||||
<div style="font-family:'Exo 2',sans-serif;font-weight:700;font-size:15px;color:var(--green)">${parseFloat(p.cashouts_total).toLocaleString(undefined,{minimumFractionDigits:2,maximumFractionDigits:2})} 🪙</div>
|
||||
<div style="font-size:11px;color:var(--text2);font-weight:700;letter-spacing:.5px">CASH</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+2
-2
@@ -73,8 +73,8 @@ switch ($action) {
|
||||
$rows = db()->query("
|
||||
SELECT p.id, p.name, p.slug, p.color,
|
||||
COALESCE(SUM(CASE WHEN pc.type='debit' THEN -pc.credits_purchased ELSE pc.credits_purchased END),0) AS credits_balance,
|
||||
(SELECT COUNT(*) FROM token_purchases tp WHERE tp.platform_id=p.slug AND tp.status='completed') AS purchases,
|
||||
(SELECT COUNT(*) FROM cashout_requests cr WHERE cr.platform_id=p.slug AND cr.status IN ('sent','approved')) AS cashouts
|
||||
(SELECT COALESCE(SUM(tp.amount_cents),0)/100 FROM token_purchases tp WHERE tp.platform_id=p.slug AND tp.status='completed') AS purchases_total,
|
||||
(SELECT COALESCE(SUM(cr.tokens),0) FROM cashout_requests cr WHERE cr.platform_id=p.slug AND cr.status IN ('sent','approved')) AS cashouts_total
|
||||
FROM platforms p
|
||||
LEFT JOIN platform_credits pc ON pc.platform_id=p.id
|
||||
WHERE p.is_deleted=0 AND p.is_active=1
|
||||
|
||||
Reference in New Issue
Block a user