{% extends 'minecraft_manager/external/base.html' %}

{% load pretty_print %}

{% block title %}Stats Search{% endblock %}

{% block h1 %}Stats{% endblock %}

{% block method %}GET{% endblock %}

{% block form %}
    <label data-toggle="tooltip" title="If you recently updated your username, try searching via UUID">Username:
        <input type="text" name="username" value="{{ request.GET.username }}" />
    </label>
    <br/><br/>----- or -----<br/><br/>
    <label>UUID:
        <input type="text" name="uuid" size="36" value="{{ request.GET.uuid }}" />
    </label>
{% endblock %}

{% block submit %}Search{% endblock %}

{%  block form_bottom %}
    {% if results %}
        <table id="dataTable" class="stripe row-border compact">
            <thead>
                <tr>
                    <th>Stat</th>
                    <th>Rank</th>
                    <th>Score</th>
                </tr>
            </thead>
        <tbody>
        {% for result in results %}
            <tr>
                <td><a href="{% url 'external-stats' %}?stat={{ result.stat }}">{{ result.stat|pretty_stat }}</a></td>
                <td>{{ result.rank }}</td>
                <td>{{ result.score|pretty_score }}</td>
            </tr>
        {% endfor %}
        </tbody>
        </table>
    {% endif %}
{% endblock %}