{% extends 'driver27/base.html' %}
{% load i18n %}
{% block dr27_menu %}

    {% include 'driver27/_selector_menu.html' %}
    {% include 'driver27/driver/driver-menu.html' %}
{% endblock %}
{% block dr27_content %}
    {{ block.super }}
    {% load champion_filter i18n %}
    <form method="POST" class="form-inline" action="{% url 'dr27-driver-record-redir' %}" onchange="this.submit()">
        {% csrf_token %}
            <div class="form-group col-md-4">
        {% if competition %}
            <input type="hidden" name="competition" value="{{ competition.slug }}"/>
        {% endif %}
        {% if season %}
            <input type="hidden" name="year" value="{{ season.year }}"/>
        {% endif %}
            <label for="record" class="control-label">Record:</label>
            <select id="record" name="record" class="form-control input-sm">
                {% if not record %}
                    <option value="">---</option>
                {% endif %}
                {% include 'driver27/driver/driver-record-optgroup.html' %}
            </select>
        </div>
        <div class="col-md-4 form-group">
            <label for="rank_opt" class="control-label">{% trans 'Filter' %}</label>
            <select id="rank_opt" name="rank_opt" class="form-control input-sm">

                {% include 'driver27/driver/driver-streak-opt.html' %}
            </select>
        </div>
    </form>
    {% if rank %}
        <table class="table table-condensed table-striped table-hover">
            <tr>
                <th>{% trans 'Count' %}</th>
                <th>{% trans 'Driver' %}</th>
                <th>{% trans 'Team' %}</th>
                {% if rank_opt == 'seasons' %}
                    <th>{% trans 'Season' %}</th>
                {% endif %}
            </tr>
            {% for entry in rank %}
                <tr>
                    <td>{{ entry.stat }}</td>
                    <td><a href="{% url 'dr27-profile-view' entry.driver.pk %}">{{ entry.driver }}</a></td>
                    <td>{{ entry.teams }}</td>
                    {% if rank_opt == 'seasons'  %}
                        <td>{{ entry.season }}</td>
                    {% endif %}
                </tr>
            {% endfor %}

        </table>
    {% endif %}
{% endblock %}