{% extends 'admin/admin_base.html.twig' %}
{% block title %}List competitions{% endblock %}
{% block heading %}List competitions{% endblock %}
{% block admin_body %}
<table class="table">
<tr>
<th>{% trans %}ID{% endtrans %}</th>
<th>{% trans %}Tournament{% endtrans %}</th>
<th>{% trans %}Competition{% endtrans %}</th>
<th>{% trans %}State{% endtrans %}</th>
<th>{% trans %}Match format{% endtrans %}</th>
<th>{% trans %}Actions{% endtrans %}</th>
</tr>
{% for competition in competition_list %}
<tr>
<td>{{ competition.id }}</td>
<td>
<a href="{{ path('app_admin_tournament_list') }}"> {# TODO: maybe add view tournament page, not sure for what. #}
{{ competition.tournament.name }}
</a>
</td>
<td>{{ competition.name }}</td>
<td>{{ competition.state }}</td>
<td>
{# {% if competition.lastStage is null %} #}
{# <a href="{{ path('app_admin_competition_stage_add', {'tournament': competition.tournament.id, 'competition': competition.id}) }}" #}
{# class="btn btn-secondary">Add stage</a> #}
{# {% else %} #}
{# {{ competition.lastStage.type }} #}
{# {% endif %} #}
</td>
<td>
{% if competition.tournament.isActive %}
<a href="{{ path('app_admin_competition_edit', {'tournament': competition.tournament.id, 'competition': competition.id}) }}"
class="btn btn-secondary">{% trans %}Edit{% endtrans %}</a>
<a href="{{ path('app_admin_competition_delete', {'tournament': competition.tournament.id, 'competition': competition.id}) }}"
class="btn btn-danger">{% trans %}Delete{% endtrans %}</a>
{% endif %}
<a href="{{ path('app_admin_competition_match_list', {'tournament': competition.tournament.id, 'competition': competition.id}) }}"
class="btn btn-primary">{% trans %}View launched matches{% endtrans %}</a>
<a href="{{ path('app_admin_team_list', {'tournament': competition.tournament.id, 'competition': competition.id}) }}"
class="btn btn-primary">{% trans %}View teams{% endtrans %}</a>
</td>
</tr>
{% endfor %}
</table>
<a href="{{ path('app_admin_competition_add', {'tournament': tournament.id }) }}"
class="btn btn-primary">{% trans %}Add new competition{% endtrans %}</a>
<br/>
{% endblock %}