{% extends "minecraft_manager/dashboard.html" %}

{% block h1 %}{% if timestamp %}<h2>Report Generated on {{ timestamp }}</h2>{% endif %}{% endblock %}

{% block title %}Entity Report{% endblock %}
{% block section %}
    <form>
    Report: <br/>
    <label for="player">
        <input type="radio" name="report" id="player" value="players" {% if report == 'players' %}checked{% endif %}>Players
    </label>&nbsp;&nbsp;
    <label for="entity">
        <input type="radio" name="report" id="entity" value="entities" {% if report == 'entities' %}checked{% endif %}>Entities
    </label>&nbsp;&nbsp;
    <label for="count">
        <input type="radio" name="report" id="count" value="counts" {% if report == 'counts' %}checked{% endif %}>Counts
    </label>
    <br/><br/>
    World: <br/>
    <label for="overworld">
        <input type="radio" name="world" id="overworld" value="overworld" {% if world == 'overworld' %}checked{% endif %}>Overworld
    </label>&nbsp;&nbsp;
    <label for="nether">
        <input type="radio" name="world" id="nether" value="nether" {% if world == 'nether' %}checked{% endif %}>Nether
    </label>&nbsp;&nbsp;
    <label for="end">
        <input type="radio" name="world" id="end" value="end" {% if world == 'end' %}checked{% endif %}>The End
    </label>
    <br/><br/>
    <button type="submit" class="btn btn-primary">Load</button>
    </form>
    <br/>
    {% if results %}
        {% if results == 'NONE' %}
            <h2>No Report Found. Use "/mcm report" in-game to generate one.</h2>
        {% elif results == 'BOTH' %}
            <h2>Choose One Of Each Option</h2>
        {% elif results == 'EMPTY' %}
            <h2>No Data</h2>
        {% else %}
            <table id="model-table" class="table table-hover link-table">
                <thead>
                    <tr>
                        <th>{% if report == 'players' %}Name{% else %}Entity{% endif %}</th>
                        <th>{% if report == 'counts' %}Count{% else %}X{% endif %}</th>
                        {% if report != 'counts' %}<th>Y</th>{% endif %}
                        {% if report != 'counts' %}<th>Z</th>{% endif %}
                    </tr>
                </thead>
                <tbody>
                    {% for row in results %}
                        <tr>
                            <td>{{ row.name }}</td>
                            <td>{% if report == 'counts' %}{{ row.count }}{% else %}{{ row.x }}{% endif %}</td>
                            {% if report != 'counts' %}<td>{{ row.y }}</td>{% endif %}
                            {% if report != 'counts' %}<td>{{ row.z }}</td>{% endif %}
                        </tr>
                    {% endfor %}
                </tbody>
            </table>
        {% endif %}
    {% endif %}
<script>
$(document).ready(function() {
    $("#model-table").DataTable({
        'lengthMenu': [ [ 10, 25, 50, 100, -1 ], [  10, 25, 50, 100, "All" ] ],
        'initComplete': function(settings, json) {
            $("#content").show();
            $(this).css('width', '');
        },
        'order': [],
    {% if user.usersettings %}
        'pageLength': {{ user.usersettings.default_results }},
    {% endif %}
    });

});

</script>
{% endblock %}


{% block form_bottom %}

{% endblock %}