{% extends 'base.html' %}
{% block title %}域名列表{% endblock %}
{% block content %}
  <div class="d-flex justify-content-between align-items-center mb-3">
    <h3>域名列表</h3>
    <a href="{% url 'domains:add' %}" class="btn btn-primary">添加域名</a>
  </div>

  <table class="table table-striped">
    <thead>
      <tr>
        <th>域名</th>
        <th>套餐</th>
        <th>状态</th>
        <th>已用/本月</th>
        <th>操作</th>
      </tr>
    </thead>
    <tbody>
    {% for d in domains %}
      <tr>
        <td>{{ d.name }}</td>
        <td>{% if d.current_plan %}{{ d.current_plan.name }}{% else %}-{% endif %}</td>
        <td>{{ d.get_status_display }}</td>
        <td>{% if d.total_quota_gb %}{{ d.used_gb }} GB / {{ d.total_quota_gb }} GB{% else %}-{% endif %}</td>
        <td>
          <a href="{% url 'domains:detail' domain_id=d.id %}" class="btn btn-sm btn-outline-secondary">详情</a>
        </td>
      </tr>
    {% empty %}
      <tr><td colspan="5" class="text-center">暂无域名</td></tr>
    {% endfor %}
    </tbody>
  </table>
{% endblock %}