Files
vpn-control-panel/app/templates/payments.html

80 lines
3.5 KiB
HTML

{% extends "base.html" %}
{% block title %}Payments — VPN Control Panel{% endblock %}
{% block content %}
<h2>Payments</h2>
<div class="card" style="margin-bottom:20px;padding:16px;">
<form action="/admin/payments/create" method="post" style="display:flex;gap:8px;align-items:end;flex-wrap:wrap;">
<div>
<label style="font-size:11px;color:#888;display:block;margin-bottom:2px;">User</label>
<select name="user_id" style="padding:6px 10px;border:1px solid #ddd;border-radius:4px;font-size:13px;">
{% for u in users %}
<option value="{{ u.id }}">#{{ u.id }} @{{ u.username or u.telegram_id }}</option>
{% endfor %}
</select>
</div>
<div>
<label style="font-size:11px;color:#888;display:block;margin-bottom:2px;">Tariff</label>
<select name="tariff_id" style="padding:6px 10px;border:1px solid #ddd;border-radius:4px;font-size:13px;">
{% for t in tariffs %}
<option value="{{ t.id }}">{{ t.name }} — {{ "%.2f"|format(t.price) }} {{ t.currency }}</option>
{% endfor %}
</select>
</div>
<div>
<label style="font-size:11px;color:#888;display:block;margin-bottom:2px;">Amount</label>
<input type="number" step="0.01" name="amount" required style="padding:6px 10px;border:1px solid #ddd;border-radius:4px;font-size:13px;width:90px;">
</div>
<div>
<label style="font-size:11px;color:#888;display:block;margin-bottom:2px;">Provider</label>
<input type="text" name="provider" value="manual" style="padding:6px 10px;border:1px solid #ddd;border-radius:4px;font-size:13px;width:80px;">
</div>
<button type="submit" style="padding:7px 16px;background:#1a1a2e;color:#fff;border:none;border-radius:4px;font-size:13px;cursor:pointer;">+ Add Payment</button>
</form>
</div>
{% if error %}<div style="color:#c53030;font-size:13px;margin-bottom:12px;">{{ error }}</div>{% endif %}
<div class="count">{{ payments|length }} total</div>
<table>
<thead>
<tr>
<th>ID</th>
<th>User</th>
<th>Tariff</th>
<th>Amount</th>
<th>Status</th>
<th>Provider</th>
<th>Created</th>
<th>Paid At</th>
</tr>
</thead>
<tbody>
{% for p in payments %}
<tr>
<td>{{ p.id }}</td>
<td>#{{ p.user_id }}</td>
<td>{{ tariffs_map.get(p.tariff_id, "—") }}</td>
<td>{{ "%.2f"|format(p.amount) }} {{ p.currency }}</td>
<td>
{% if p.status.value == "confirmed" %}
<span class="badge badge-green">Confirmed</span>
{% elif p.status.value == "pending" %}
<span class="badge badge-yellow">Pending</span>
{% elif p.status.value == "failed" %}
<span class="badge badge-red">Failed</span>
{% elif p.status.value == "refunded" %}
<span class="badge badge-blue">Refunded</span>
{% else %}
<span class="badge">{{ p.status.value }}</span>
{% endif %}
</td>
<td>{{ p.provider }}</td>
<td>{{ p.created_at.strftime("%Y-%m-%d %H:%M") }}</td>
<td>{{ p.paid_at.strftime("%Y-%m-%d %H:%M") if p.paid_at else "—" }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock %}