{% extends 'admin/admin_base.html.twig' %}
{% block title %}List launched matches{% endblock %}
{% block heading %}List launched matches{% endblock %}
{% block admin_body %}
<div>
<h2>
Tournament: <a href="{{ path('app_admin_tournament_list') }}">{{ competition.tournament.name }}</a>
</h2>
<h2>
Competition: <a href="{{ path(
'app_admin_competition_list',
{'tournament': competition.tournament.id}
) }}">{{ competition.name }}</a>
</h2>
</div>
<table class="table">
<tr>
<th>ID</th>
<th>Table number</th>
{# TODO: super admin only? #}
{# <th>Team 1 name</th> #}
{# <th>Team 2 name</th> #}
<th>Team 1</th>
<th>Team 2</th>
<th>Starts at</th>
<th>Launched</th>
<th>Actions</th>
</tr>
{% for match in match_list %}
<tr>
<td>{{ match.id }}</td>
<td>{{ match.table.number }}</td>
{% if match.team1 is defined %}
<td>{{ match.team1.name|title }}</td>
{% else %}
<td>{{ match.team1Name }}</td>
{% endif %}
{% if match.team2 is defined %}
<td>{{ match.team2.name|title }}</td>
{% else %}
<td>{{ match.team2Name }}</td>
{% endif %}
<td>{{ match.startsAt|date('Y/m/d H:i:s') }}</td>
<td>{{ match.isLaunched ? 'Yes' : 'No' }}</td>{# TODO: super admin only? #}
<td>
{% if competition.tournament.isActive %}
<a href="{{ path(
'app_admin_competition_match_edit',
{'tournament': competition.tournament.id, 'competition': competition.id, 'match': match.id}
) }}" class="btn btn-secondary">{% trans %}Edit{% endtrans %}</a>
<a href="{{ path(
'app_admin_competition_match_delete',
{'tournament': competition.tournament.id, 'competition': competition.id, 'match': match.id}
) }}" class="btn btn-danger">{% trans %}Delete{% endtrans %}</a>
{% endif %}
<a href="{{ path(
'app_admin_result_list',
{'tournament': competition.tournament.id, 'competition': competition.id, 'match': match.id}
) }}" class="btn btn-info">View results</a>
</td>
</tr>
{% endfor %}
</table>
{% endblock %}