{% extends "base.html" %}
{% block title %}کد هدیه{% endblock %}
{% block content %}
<div class="dashboard">{% include "_sidebar.html" %}<main class="main">
<header class="topbar"><h2>کدهای هدیه</h2></header>
<div class="content">
<div class="card">
<form method="post">
<div class="form-group"><label>کد</label><input name="code" required placeholder="GIFT1404"></div>
<div class="form-group"><label>مبلغ (تومان)</label><input type="number" name="amount" required></div>
<div class="form-group"><label>حداکثر استفاده</label><input type="number" name="max_uses" value="1"></div>
<button class="btn-primary inline" type="submit">ساخت</button>
</form>
</div>
{% for g in codes %}
<div class="card">
<code>{{ g.code }}</code> — {{ "{:,.0f}".format(g.amount) }} تومان
— استفاده {{ g.used_count }}/{{ g.max_uses }}
{% if not g.is_active %}<span class="badge">غیرفعال</span>{% endif %}
</div>
{% endfor %}
</div></main></div>
{% endblock %}
