# account/coupons

> Mã giảm giá khách đang có.

Mã giảm giá khách đang có.

- **Tệp giao diện:** `account/coupons.html`
- **Đường dẫn:** `/tai-khoan/ma-giam-gia`
- **Controller:** `App\Modules\Account\AccountController::couponsPage`

Ngoài những biến dưới đây, slot này còn nhận toàn bộ [biến toàn cục](/docs/bien-toan-cuc/index.md).

## Biến của trang

| Biến | Kiểu | Mô tả | Từ phiên bản |
|---|---|---|---|
| `coupons` | [`Coupon[]`](/docs/doi-tuong/coupon/index.md) | Mã giảm giá khả dụng. | 1.0 |
| `has_more` | `boolean` | Còn trang tiếp theo hay không. | 1.0 |
| `next_cursor` | `string` \| `null` | Con trỏ để tải trang kế; null khi đã hết. | 1.0 |

## Mã đầy đủ

Toàn bộ tệp `account/coupons.html` của bộ giao diện mặc định. Chép về `templates/<bộ giao diện của bạn>/account/coupons.html` rồi sửa theo ý muốn.

```liquid
<div class="container page-content">
  <h1 class="page-title">Mã giảm giá đã dùng</h1>
  <div class="account-layout">
    {% assign active_page = 'coupons' %}
    {% include 'account/_sidebar' %}
    <div class="account-main">
      {% if coupons %}
        <table class="data-table">
          <thead>
            <tr><th>Mã</th><th>Ngày dùng</th></tr>
          </thead>
          <tbody>
            {% for c in coupons %}
              <tr>
                <td><code>{{ c.coupon_code | escape }}</code></td>
                <td>{{ c.used_at | date: '%d/%m/%Y %H:%M' }}</td>
              </tr>
            {% endfor %}
          </tbody>
        </table>
        {% if has_more %}
          <a href="/tai-khoan/ma-giam-gia?cursor={{ next_cursor | escape }}" class="btn btn--outline">Xem thêm</a>
        {% endif %}
      {% else %}
        <p class="empty-state">Bạn chưa sử dụng mã giảm giá nào.</p>
      {% endif %}
    </div>
  </div>
</div>
```
