{{!
    This file is part of Moodle - http://moodle.org/

    Moodle is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Moodle is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
}}
{{!
    @template block_ned_teacher_tools/grading_tracker_render

    grading_tracker_render layout template.

    Context variables required for this template:
    * sitename - The name of the site
    * output - The core renderer for the page
    * bodyattributes - attributes for the body tag as a string of html attributes

    Example context (json):
    {
        "messages": []html,
        "links":    {'link' => url, 'name' => string},
        "school_name": string,
        "schools":  {'link' => url, 'name' => string},
        "crews":    {'link' => url, 'name' => string},
        "forms":    []html,
        "tables":    []html,
        "manage":   bool,
        "buttons":  {"primary": bool, "add_class": string, "link": url, "name": string}
    }
}}
<div class="notifications {{^notifications}}empty{{/notifications}}">
    {{#notifications}}
        {{{.}}}
    {{/notifications}}
</div>
<div class="grading-tracker-render">
    <div class="control-panel control-panel1 {{^control_panel1}}empty{{/control_panel1}}">
        {{#control_panel1}}
            {{{.}}}
        {{/control_panel1}}
    </div>
    <div class="control-panel control-panel2 {{^control_panel2}}empty{{/control_panel2}}">
        {{#control_panel2}}
            {{{.}}}
        {{/control_panel2}}
    </div>
    <div class="control-panel control-panel3">
        <div class="information">
            <span class="about" aria-label="{{#str}}aboutgt, block_ned_teacher_tools{{/str}}"
                  data-title="{{#str}}aboutgt, block_ned_teacher_tools{{/str}}"
                  data-class="gt-about"
                  data-template="block_ned_teacher_tools/grading_tracker_about_modal"
            >
                <i class="fa fa-info-circle"></i> {{#str}}aboutgt, block_ned_teacher_tools{{/str}}
            </span>
            <span class="admin-links">
                {{#admin_links}}
                    {{{.}}}
                {{/admin_links}}
            </span>
        </div>
        <div class="control-panel control-panel-elements">
            {{#control_panel3}}
                {{{.}}}
            {{/control_panel3}}
        </div>
        {{#overview}}
            <div class="statisticdate">
                {{#statisticdate}}
                    {{#str}}gradingtracker_statisticdate, block_ned_teacher_tools{{/str}}: {{#userdate}} {{statisticdate}}, %d %b %Y {{/userdate}}
                {{/statisticdate}}
                {{^statisticdate}}{{#is_admin}}
                    <i>{{#str}}gradingtracker_statisticdate:error, block_ned_teacher_tools{{/str}}</i>
                {{/is_admin}}{{/statisticdate}}
            </div>
        {{/overview}}
    </div>
    <div class="control-panel control-panel4">
        {{#pager}}
            <div class="pager">
                {{{pager}}}
            </div>
        {{/pager}}
        {{#download_element}}
            <div class="download-element my-1 ml-auto row">{{{download_element}}} {{{download_unlimited}}}</div>
        {{/download_element}}
    </div>
    <div class="table-container">
        <div class="table-div">
        {{#main_table}}
            <table class="generaltable nedtable {{#expanded}}expanded{{/expanded}} {{#summary}}summary{{/summary}} {{{table_class}}}">
                <thead class="back_sort">
                    <tr>
                        {{! table columns should be the same to
                            \block_ned_teacher_tools\output\grading_tracker_render::get_columns()
                        }}
                        {{#headers}}
                            {{{.}}}
                        {{/headers}}
                    </tr>
                </thead>
                <tbody>
                    {{> block_ned_teacher_tools/grading_tracker_render_rows }}
                </tbody>
            </table>
        {{/main_table}}
        {{#overview}}
            <table class="generaltable nedtable overview">
                <thead>
                <tr>
                    {{! table columnst should be the same to
                        \block_ned_teacher_tools\output\grading_tracker_render::get_columns()
                    }}
                    <th scope="col">{{#str}}gradername, block_ned_teacher_tools{{/str}}</th>
                    <th scope="col">{{#str}}students, block_ned_teacher_tools{{/str}}</th>
                    <th scope="col">{{#str}}waitingforgrade_grade, block_ned_teacher_tools{{/str}}</th>
                    <th scope="col">{{#str}}currentlyoverdue, block_ned_teacher_tools{{/str}}</th>
                    <th scope="col">{{#str}}overdue36, block_ned_teacher_tools{{/str}}</th>
                    <th scope="col">{{#str}}totalgradedlate, block_ned_teacher_tools{{/str}}</th>
                    <th scope="col">{{#str}}late_grade_36hrs, block_ned_teacher_tools{{/str}}</th>
                    <th scope="col">{{#str}}ontime_grade, block_ned_teacher_tools{{/str}}</th>
                    {{#show_gpd}}
                        <th scope="col" title="{{#str}}average_gpd_long, block_ned_teacher_tools{{/str}}">
                            {{#str}}average_gpd, block_ned_teacher_tools{{/str}}
                        </th>
                    {{/show_gpd}}
                    <th scope="col">{{#str}}successrate, block_ned_teacher_tools{{/str}}</th>
                </tr>
                </thead>
                <tbody>
                {{#data}}
                    <tr class="{{{class_status}}} {{#active}}active{{/active}}">
                        <td class="gradername">
                            {{#gradername}}
                                {{#gradername_url}}
                                    <a href="{{{gradername_url}}}">
                                        {{{gradername}}}
                                    </a>
                                {{/gradername_url}}
                                {{^gradername_url}}
                                    {{{gradername}}}
                                {{/gradername_url}}
                            {{/gradername}}
                        </td>
                        <td class="students">
                            {{{students}}}
                        </td>
                        <td class="waitingforgrade">
                            {{{waitingforgrade}}}
                        </td>
                        <td class="totaloverdue">
                            {{{overdue}}}
                        </td>
                        <td class="overdue36">
                            {{{overdue36}}}
                        </td>
                        <td class="late">
                            {{{late}}}
                        </td>
                        <td class="late36">
                            {{{late36}}}
                        </td>
                        <td class="ontime">
                            {{{ontime}}}
                        </td>
                        {{#show_gpd}}
                            <td class="gpd">
                                {{{gpd}}}
                            </td>
                        {{/show_gpd}}
                        <td class="rate">
                            {{{rate}}}%
                        </td>
                    </tr>
                {{/data}}
                </tbody>
            </table>
        {{/overview}}
        </div>
    </div>
    {{#bulk_menu}}
        <div class="bulk-menu">{{#str}}bulk_action, block_ned_teacher_tools{{/str}} {{{bulk_menu}}}</div>
    {{/bulk_menu}}
    {{#pager}}
        <div class="pager">
            {{{pager}}}
        </div>
    {{/pager}}
</div>
{{#js}}
    require(['block_ned_teacher_tools/grading_tracker_render'], function(GTR) {
        GTR.init({{contextid}});
    });
{{/js}}
