<h2>Admin</h2>
<form method="post" action="<?= \Tshen\url('/admin/credits/code') ?>" style="margin-bottom:12px;">
  <?= \Tshen\csrf_field() ?>
  <label>Issue free credits code</label>
  <input type="number" name="credits" min="1" value="5" />
  <button type="submit">Generate Code</button>
</form>

<h3>Existing Codes</h3>
<table>
  <tr><th>Code</th><th>Credits</th><th>Used By</th></tr>
  <?php foreach ($codes as $c): ?>
    <tr>
      <td><?= htmlspecialchars($c['code']) ?></td>
      <td><?= (int)$c['credits'] ?></td>
      <td><?= htmlspecialchars($c['used_by'] ?? '') ?></td>
    </tr>
  <?php endforeach; ?>
</table>