{% extends 'tournaments/base.html' %}

{% block head_title %}Matchs du {{ tournament.display_name }}{% endblock %}
{% block first_title %}{{ tournament.event.display_name }}{% endblock %}
{% block second_title %}{{ tournament.display_name }}{% endblock %}
{% block title_link %}{% url 'tournament' tournament.id %}{% endblock %}

{% block content %}

{% include 'tournaments/navigation_tournament.html' %}

{% if tournament.display_matches or tournament.display_group_stages %}
{% if rounds or group_stages %}
    <nav class="margin10">
        <a href="{% url 'tournament' tournament.id %}" class="mybox topmargin5">Tous les matchs</a>

        {% if tournament.display_group_stages %}
        {% for group_stage in group_stages %}
            <a href="{% url 'tournament' tournament.id %}?group_stage={{ group_stage.id }}" class="mybox topmargin5">{{ group_stage.display_name }}</a>
        {% endfor %}
        {% endif %}
        {% if tournament.display_matches %}
        {% for round in rounds %}
            <a href="{% url 'tournament' tournament.id %}?round={{ round.id }}" class="mybox topmargin5">{{ round.name }}</a>
        {% endfor %}
        {% endif %}
    </nav>
{% endif %}

{% for match_group in match_groups %}

    {% if match_group.matches %}

    <h1 class="club my-block topmargin20">{{ match_group.name }}{{ match_group.formatted_schedule }}</h1>

    <div class="grid-x">
        {% for match in match_group.matches %}
        {% include 'tournaments/match_cell.html' %}
        {% endfor %}
    </div>

    {% endif %}

{% endfor %}

{% endif %}
{% endblock %}
