{% extends "cradmin_legacy/viewhelpers/listbuilderview/filterlist-top.django.html" %}

{% load i18n %}
{% load cradmin_legacy_tags %}
{% load cradmin_legacy_icon_tags %}

{% block pageheader-outer-extraclasses %}
    {{ block.super }}
    devilry-page-header-with-backlink
{% endblock %}

{% block pageheader-inner %}
    <a href="{% cradmin_instance_appindex_url 'overview' %}" class="devilry-page-header-backlink">
        <span class="sr-only">
            {% trans "Back to overview" %}
        </span>
        <span class="{% cradmin_icon 'devilry-pageheader-back' %}" aria-hidden="true"></span>
    </a>
    {{ block.super }}
{% endblock pageheader-inner %}

{% block content %}

    {% comment %}
        Adds support for downloading the current results as Excel-spreadsheets.
    {% endcomment %}
    <div class="container">
{#        <div class="container devilry-dashboard-container-withtopmargin">#}
        <div class="devilry-dashboard-container devilry-dashboard-container-withtopmargin">
            <h3>
                {% trans 'Download the current results' context 'devilry_admin period all results overview' %}
            </h3>
            <p>
                {% blocktrans trimmed with context='devilry_admin period all results overview' %}
                    Clicking the "Download results"-button will send you to a download view, and a report
                    will be generated on an xlsx-format(Excel). The download will start automatically once the
                    report is generated.
                {% endblocktrans %}
            </p>
            <p>
                {% blocktrans trimmed with context='devilry_admin period all results overview' %}
                    The report will contain three different workheets, "Grades", "Points" and
                    "Passed Failed"
                {% endblocktrans %}:
            </p>
            <ul>
                <li>
                    {% blocktrans trimmed with context='devilry_admin period all results overview' %}
                        <strong>"Grades"</strong>, a worksheet containing the current
                        grading/status for each assignment as shown in the table below.
                    {% endblocktrans %}
                </li>
                <li>
                    {% blocktrans trimmed with context='devilry_admin period all results overview' %}
                        <strong>"Points"</strong>, a worksheet showing the grading-points for each assignment formatted as
                        number-fields. Fields for each assignment where the student has not received a grading is empty.
                    {% endblocktrans %}
                </li>
                <li>
                    {% blocktrans trimmed with context='devilry_admin period all results overview' %}
                        <strong>"Passed Failed"</strong>, a worksheet showing if the student have passed or failed each
                        assignment formatted as boolean-fields. Fields for each assignment where the student has not
                        received a grading is empty.
                    {% endblocktrans %}
                </li>
            </ul>
            <form action="{% cradmin_appurl 'download_report' %}" method="POST">
                {% csrf_token %}
                <input type="hidden" name="report_options" value="{{ report_options }}">
                <input class="btn btn-primary" type="submit" name="confirm" value="{% trans "Download results" %}"/>
            </form>
        </div>
    </div>
    {{ block.super }}

{% endblock content %}

{% block listbuilderlist %}
    {% if listbuilder_list.has_items %}
        {% cradmin_render_renderable listbuilder_list %}
    {% else %}
        {% block no-items-wrapper %}
            <p class="cradmin-legacy-listing-no-items-message cradmin-legacy-listbuilderview-no-items-message">
                {% block no-items-paragraph-contents %}
                    {{ no_items_message }}
                {% endblock no-items-paragraph-contents %}
            </p>
        {% endblock no-items-wrapper %}
    {% endif %}
{% endblock listbuilderlist %}
