# account/edit-profile

> Trang sửa thông tin cá nhân.

Trang sửa thông tin cá nhân.

- **Tệp giao diện:** `account/edit-profile.html`
- **Đường dẫn:** `/tai-khoan/thong-tin`
- **Controller:** `App\Modules\Account\AccountController::editProfilePage`

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 |
| `error_message` | `string` \| `null` | Thông báo lỗi khi lưu thất bại. | 1.0 |
| `success_message` | `string` \| `null` | Thông báo khi lưu thành công. | 1.0 |

## Mã đầy đủ

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

```liquid
<div class="container page-content">
  <h1 class="page-title">Thông tin cá nhân</h1>
  <div class="account-layout">
    {% assign active_page = 'profile' %}
    {% include 'account/_sidebar' %}
    <div class="account-main">
      {% if success_message %}
        <div class="alert alert--success">{{ success_message | escape }}</div>
      {% endif %}
      {% if error_message %}
        <div class="alert alert--error">{{ error_message | escape }}</div>
      {% endif %}

      <form action="/tai-khoan/thong-tin" method="post" class="account-form">
        <div style="position:absolute;left:-9999px;top:-9999px" aria-hidden="true">
          <label for="_hp">Leave this field empty</label>
          <input type="text" id="_hp" name="_hp" tabindex="-1" autocomplete="off">
        </div>

        <div class="form-row">
          <div class="form-group">
            <label for="first_name">Họ *</label>
            <input type="text" id="first_name" name="first_name" required class="form-input"
                   value="{{ customer.first_name | escape }}">
          </div>
          <div class="form-group">
            <label for="last_name">Tên *</label>
            <input type="text" id="last_name" name="last_name" required class="form-input"
                   value="{{ customer.last_name | escape }}">
          </div>
        </div>

        <div class="form-group">
          <label for="phone">Số điện thoại</label>
          <input type="tel" id="phone" name="phone" class="form-input"
                 value="{{ customer.phone | escape }}">
        </div>

        <div class="form-group form-group--checkbox">
          <label class="checkbox-label">
            <input type="checkbox" name="accepts_marketing" value="1"
                   {% if customer.accepts_marketing %}checked{% endif %}>
            Nhận thông tin khuyến mãi qua email
          </label>
        </div>

        <button type="submit" class="btn btn--primary">Lưu thay đổi</button>
      </form>
    </div>
  </div>
</div>
```
