{% extends 'base.html' %}
{% block content %}
<section class="stats-grid">
  <article class="card stat-card">
    <h2>{{ t('total_guests') }}</h2>
    <p>{{ stats.total_guests }}</p>
  </article>
  <article class="card stat-card">
    <h2>{{ t('attending_yes') }}</h2>
    <p>{{ stats.attending_yes }}</p>
  </article>
  <article class="card stat-card">
    <h2>{{ t('attending_no') }}</h2>
    <p>{{ stats.attending_no }}</p>
  </article>
  <article class="card stat-card">
    <h2>{{ t('attending_open') }}</h2>
    <p>{{ stats.attending_open }}</p>
  </article>
</section>

<section class="card">
  <h2>{{ t('host_stats_title') }}</h2>
  <div class="table-wrap">
    <table class="guest-table">
      <thead>
        <tr>
          <th>{{ t('host_table_group') }}</th>
          <th>{{ t('host_table_member') }}</th>
          <th>{{ t('host_table_status') }}</th>
          <th>{{ t('host_table_age') }}</th>
        </tr>
      </thead>
      <tbody>
        {% for member in members %}
        <tr>
          <td>{{ member["group_name"] }}</td>
          <td>{{ member["name"] }}</td>
          <td>
            {% if member["attending"] == 1 %}
              {{ t('status_yes') }}
            {% elif member["attending"] == 0 %}
              {{ t('status_no') }}
            {% else %}
              {{ t('status_open') }}
            {% endif %}
          </td>
          <td>
            {% if member["child_age"] is not none %}
              {{ member["child_age"] }}
            {% else %}
              -
            {% endif %}
          </td>
        </tr>
        {% endfor %}
      </tbody>
    </table>
  </div>
</section>
{% endblock %}
