{% extends "layout/landing_page.html" %}

{% load i18n %}
{% load event_tags %}


{% block landing_content %}

    <div class="w3-padding w3-padding-top-64">
    <h2>Kategorie: {{ category }}</h2>

    <h3>Dokoncene</h3>
        <table class="w3-table w3-striped w3-bordered w3-border w3-hoverable w3-white">
            <thead>
            <tr>
                <th>Poradi</th>
                <th>Startovni cislo</th>
                <th>Jezdec</th>
                <th>Jizdy</th>
                <th>Celkovej cas</th>

            </tr>
            </thead>
            <tbody>
            {% for registration in finished %}
                <tr>
                    <td>{{ registration.rank }}</td>
                    <td>{{ registration.registration.start_number }}</td>
                    <td>{% if registration.registration.nick_name %}{{ registration.registration.nick_name }}{% else %}
                        {{ registration.registration.first_name }}
                        {{ registration.registration.last_name }}{% endif %}</td>
                    <td>
                        {% for lap in registration.registration.laps.all %}
                            {{ lap.start|time }} - {{ lap.end|time }} ({{ lap.duration }})<br>
                        {% endfor %}
                    </td>
                    <td>{{ registration.duration }}</td>

                </tr>
            {% empty %}
                <tr>
                    <td colspan="2">tady nic neni</td>
                </tr>
            {% endfor %}
            </tbody>
        </table>

    <h3>Jeste zavodi</h3>
        <table class="w3-table w3-striped w3-bordered w3-border w3-hoverable w3-white">
            <thead>
            <tr>
                <th>Startovni cislo</th>
                <th>Jezdec</th>
                <th>Jizdy</th>
            </tr>
            </thead>
            <tbody>
            {% for registration in unfinished %}
                <tr>
                    <td>{{ registration.start_number }}</td>
                    <td>{% if registration.nick_name %}{{ registration.nick_name }}{% else %}
                        {{ registration.first_name }}
                        {{ registration.last_name }}{% endif %}</td>
                    <td>
                        {% for lap in registration.laps.all %}
                            {{ lap.start|time }} - {{ lap.end|time }} ({{ lap.duration }})<br>
                        {% endfor %}
                    </td>
                </tr>
            {% empty %}
                <tr>
                    <td colspan="2">tady nic neni</td>
                </tr>
            {% endfor %}
            </tbody>
        </table>



    </div>
{% endblock %}



