Files
pleiades/templates/admin.html
2026-09-19 19:17:44 -07:00

69 lines
3.3 KiB
HTML

{% extends "base.html" %}
{% block body %}
<h2>Admin</h2>
<div class="stats-row">
<div class="card stat"><span class="lbl">Revenue (paid)</span><span class="val">{{ stats.revenue_sats }} sats</span></div>
<div class="card stat"><span class="lbl">IPRoyal balance</span><span class="val">${{ ipr_balance }}</span></div>
<div class="card stat"><span class="lbl">Users</span><span class="val">{{ stats.users }} <span style="font-size:14px;color:var(--muted)">({{ stats.active }} active)</span></span></div>
</div>
<div class="stats-row">
<div class="card stat"><span class="lbl">GB sold</span><span class="val">{{ stats.gb_sold }} GB</span></div>
<div class="card stat"><span class="lbl">Pending orders</span><span class="val">{{ stats.pending_orders }}</span></div>
<div class="card stat"><span class="lbl">Dedicated IPs</span><span class="val">{{ dedicated|length }}</span></div>
</div>
<div class="card" style="margin-top:18px">
<h3>Credit a user</h3>
<form method="post" action="/admin/credit" style="display:flex;gap:10px;align-items:flex-end">
<div style="flex:1"><label>Username</label><input type="text" name="username" required></div>
<div style="width:120px"><label>GB</label><input type="number" name="gb" step="0.1" value="5" required></div>
<input type="submit" value="Credit" style="width:auto;margin:0;padding:11px 20px">
</form>
</div>
<div class="dash-grid" style="margin-top:18px">
<div class="card">
<h3>Recent orders</h3>
<table style="width:100%;font-size:13px;border-collapse:collapse">
<tr style="color:var(--muted);text-align:left"><th>ID</th><th>User</th><th>Plan</th><th>sats</th><th>Status</th></tr>
{% for o in orders %}
<tr style="border-top:1px solid var(--border)">
<td style="padding:4px">{{ o.id }}</td><td>{{ o.user_id }}</td><td>{{ o.plan_id }}</td>
<td>{{ o.amount_sats }}</td><td style="color:{{ 'var(--ok)' if o.status=='paid' else 'var(--warn)' }}">{{ o.status }}</td>
</tr>
{% endfor %}
</table>
</div>
<div class="card">
<h3>Dedicated IPs</h3>
<table style="width:100%;font-size:13px;border-collapse:collapse">
<tr style="color:var(--muted);text-align:left"><th>Type</th><th>Location</th><th>IP</th><th>Status</th></tr>
{% for d in dedicated %}
<tr style="border-top:1px solid var(--border)">
<td style="padding:4px">{{ d.product_name|replace(' Dedicated','') }}</td>
<td>{{ d.location_name|truncate(20) }}</td>
<td class="mono">{{ d.proxy_host or '—' }}</td>
<td style="color:{{ 'var(--ok)' if d.status=='active' else 'var(--warn)' }}">{{ d.status }}</td>
</tr>
{% endfor %}
</table>
</div>
</div>
<div class="card" style="margin-top:18px">
<h3>Users</h3>
<table style="width:100%;font-size:13px;border-collapse:collapse">
<tr style="color:var(--muted);text-align:left"><th>ID</th><th>Username</th><th>Active</th><th>Balance</th><th>Geo</th></tr>
{% for u in users %}
<tr style="border-top:1px solid var(--border)">
<td style="padding:4px">{{ u.id }}</td><td>{{ u.username }}</td>
<td>{{ '✓' if u.active else '—' }}</td>
<td>{{ '%.2f'|format(u.balance_gb) }} GB</td>
<td>{{ u.country or '—' }}{% if u.city %}/{{ u.city }}{% endif %}</td>
</tr>
{% endfor %}
</table>
</div>
{% endblock %}