# account/order-list

> Danh sách đơn hàng của khách.

Danh sách đơn hàng của khách.

- **Tệp giao diện:** `account/order-list.html`
- **Đường dẫn:** `/tai-khoan/don-hang`
- **Controller:** `App\Modules\Account\AccountController::orderListPage`

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 |
|---|---|---|---|
| `customer` | [`Customer`](/docs/doi-tuong/customer/index.md) | Hồ sơ khách đang đăng nhập. | 1.0 |
| `orders` | [`Order[]`](/docs/doi-tuong/order/index.md) | Đơn hàng của khách. | 1.0 |

## Mã đầy đủ

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

```liquid
<div class="container page-content">
  <h1 class="page-title">Đơn hàng của tôi</h1>
  <div class="account-layout">
    {% assign active_page = 'orders' %}
    {% include 'account/_sidebar' %}
    <div class="account-main">
      {% if orders.size > 0 %}
        <table class="orders-table">
          <thead>
            <tr>
              <th>Mã đơn</th>
              <th>Ngày đặt</th>
              <th>Trạng thái</th>
              <th>Tổng tiền</th>
            </tr>
          </thead>
          <tbody>
            {% for order in orders %}
            <tr>
              <td>
                <a href="/tai-khoan/don-hang/{{ order.id | escape }}">#{{ order.code | default: order.id | escape }}</a>
              </td>
              <td>{{ order.created_at | date_vi }}</td>
              <td><span class="status-badge">{{ order.current_status | escape }}</span></td>
              <td>{{ order.total_amount | money }}</td>
            </tr>
            {% endfor %}
          </tbody>
        </table>
      {% else %}
        <p class="empty-state">Chưa có đơn hàng nào.</p>
      {% endif %}
    </div>
  </div>
</div>
```
