{% extends "membership/membership_detail.html" %}
{% load i18n %}

{% block title %} {% trans 'Dan Score for' %} {{membership.username}} {% endblock %}
{% block teaser %}<h1>{% trans 'Dan Score for' %} {{membership.username}}</h1>{% endblock %}

{% block score_list %}
    <h2 class="grid_12">{% trans 'Hanchans that apply to the Dan Score' %}</h2>
    <table>
        <thead>
        <tr>
            <th rowspan="2">{% trans 'Date' %}</th>
            <th rowspan="2">{% trans 'Event' %}</th>
            <th rowspan="2">{% trans 'Start' %}</th>
            <th rowspan="2">{% trans 'Placement' %}</th>
            <th colspan="4">{% trans 'Players' %}</th>
            <th rowspan="2">{% trans 'Dan Points' %}</th>
            <th rowspan="2">{% trans 'Comment' %}</th>
            <th rowspan="2"></th>
        </tr>
        <tr>
            <th>1.</th>
            <th>2.</th>
            <th>3.</th>
            <th>4.</th>
        </tr>
        </thead>

        {% for hanchan in hanchan_list %}
        <tr>
            <td>{{ hanchan.start|date:'SHORT_DATE_FORMAT' }}</td>
            <td><a href="{{ hanchan.get_absolute_url }}">{{ hanchan.event.name }}</a></td>
            <td>{{ hanchan.start|time:'TIME_FORMAT' }}</td>
            <td class="center">{{hanchan.placement}}.</td>
            {% for player in hanchan.player_list %}
            <td class="center"><a href="{% url 'player-dan-score' player.user.username %}">{{player.user}}</a><br/>
                {{player.game_score }}
            </td>
            {% endfor %}
            <td class="center">{{hanchan.dan_points}}</td>
            <td>{{ hanchan.player_comment }}</td>
            <td>
                {% if perms.mahjong_ranking.delete_hanchan %}
                <a href="{% url 'delete-hanchan' hanchan.pk %}"><span class="fa fa-trash" title="{% trans 'Delete Hanchan' %}"></span></a>
                {% endif %}
                {% if perms.mahjong_ranking.change_hanchan %}
                <a href="{% url 'edit-hanchan' hanchan.pk %}"><span class="fa fa-pencil" title="{% trans 'Edit Hanchan' %}"></span></a>
                {% endif %}
            </td>
        </tr>
        {% endfor %}
    </table>

{% if kyu_dan_ranking.legacy_date %}
<p><strong>Frühere Dan Punkte vom {{ kyu_dan_ranking.legacy_date|date }}:</strong> {{kyu_dan_ranking.legacy_dan_points }}</p>
{% endif %}
{% endblock %}

{% block buttonbar %}
<a href="?download=xlsx" class="button"><span class="fa fa-table"></span> Download</a>
{% endblock %}
