{% extends "layout.html.j2" %}

{% block scripts %}
{% endblock%}

{% block content %}
<div>
    <h1>Upcoming tournaments</h1>
    <table class="table table-striped table-hover">
        <thead>
            <tr>
                <th scope="col">Name</th>
                <th scope="col">Date</th>
                <th scope="col">Location</th>
            </tr>
        </thead>
        <tbody>
            {% for tournament in tournaments %}
            <tr>
                <th scope="row"><a href="{{ url_for('html_tournament_display', uid=tournament.uid) }}">{{
                        tournament.name }}</a></th>
                {% if tournament.finish %}
                <td>{{ tournament.start }} - {{ tournament.finish }}</td>
                {% else %}
                <td>{{ tournament.start }}</td>
                {% endif %}
                {% if tournament.online %}
                <td>Online</td>
                {% else %}
                <td>{{ tournament.country }} - {{ tournament.city }}</td>
                {% endif %}
            </tr>
            {% endfor %}
        </tbody>
    </table>
    <a href="{{ url_for('html_tournament_create') }}" class="btn btn-primary">Create Tournament</a>
</div>
{% endblock %}