{% extends "base.html" %}

{% block content %}
    {% include "statistiques/stat-form.html" %}
    {% include "statistiques/stat-tabs.html" with active="niveau" %}

    <div class="row">
        <div class="col">
            <table class="table table-sm stat_table table-hover mt-4">
                <thead>
                    <tr class="app_line">
                        <th class="text-start h4 pt-3">Ressources par niveau</th>
                        {% for month in months %}<th>{{ month }}</th>{% endfor %}
                        <th>Total</th>
                    </tr>
                </thead>
                <tbody>
                {% for niveau, prest_list in stats.items %}
                    <tr>
                        <td colspan="3" class="fw-bold bg-light">Niveau {{ niveau }}</td><td></td>
                    </tr>
                    {% for prest, prest_data in prest_list.items %}
                        <tr>
                            <td class="ps-5">{{ prest_map|get_item:prest }}</td>
                            {% for month in months %}<td class="num">{{ prest_data|get_item:month|format_duree }}</td>{% endfor %}
                            <td class="num">{{ prest_data|get_item:'total'|format_duree }}</td>
                        </tr>
                    {% endfor %}
                {% endfor %}
                </tbody>
            </table>
            <div class="text-end">
                <a href=".?{% param_replace %}&export=1"><img class="icon-ui" src="{% static 'ficons/xlsx.svg' %}"></a>
            </div>
        </div>
    </div>
{% endblock %}
