{% extends 'base.html' %}

{% block title %}Puchar Dyrektora - wyniki{% endblock %}

{% block content %}
<nav class="pagination is-centered is-small my-0" role="navigation">
  <ul class="pagination-list">
    {% for edition in editions %}
    <li>
      <a class="pagination-link {% if edition.year == year %}is-current"{% elif edition.scores_available %}" href="{% url 'scores' edition.year %}"{% endif %}"
          {% if not edition.scores_available %}disabled{% endif%}
        >{{ edition.roman }}</a>
    </li>
    {% endfor %}
  </ul>
</nav>
{% if scores_available %}
<div class="hero has-text-centered">
  <span class="title my-6">Klasyfikacja indywidualna</span>
  <table class="hero-body table is-striped is-narrow is-hoverable is-fullwidth">
    <thead>
      <tr>
        <th>#</th>
        <th>Uczeń</th>
        <th>Wynik</th>
        <th>Tytuł</th>
      </tr>
    </thead>
    {% for student in individual %}
    <tbody>
      <tr>
        <th>{{ forloop.counter }}</th>
        <td>
          <div class="dropdown is-hoverable">
            <div class="dropdown-trigger">
              <span>{{ student.name }} {{ student.surname }}</span>
            </div>
            <div class="dropdown-menu">
              <div class="dropdown-content">
                <div class="dropdown-item">
                  <b>Szkoła: </b>{{ student.school_name }}
                  <br>
                  <b>Miejscowość: </b>{{ student.school_town }}
                </div>
              </div>
            </div>
          </div>
          </td>
        <td>{{ student.score }}</td>
        <td>{{ student.title }}</td>
      </tr>
    </tbody>
    {% endfor %}
  </table>
</div>
<div class="hero has-text-centered">
  <span class="title my-6">Klasyfikacja szkół</span>
  <table class="hero-body table is-striped is-narrow is-hoverable is-fullwidth">
    <thead>
      <tr>
        <th>#</th>
        <th>Szkoła</th>
        <th>Miejscowość</th>
        <th>Wynik</th>
      </tr>
    </thead>
    {% for team in teams %}
    <tbody>
      <tr>
        <th>{{ forloop.counter }}</th>
        <td>{{ team.name }}</td>
        <td>{{ team.town }}</td>
        <td>{{ team.score }}</td>
      </tr>
    </tbody>
    {% endfor %}
  </table>
</div>
{% else %}
<div class="hero has-text-centered">
  <span class="title my-6">Wyniki niedostępne</span>
</div>
{% endif %}
{% endblock %}
