{{!
    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_rows

    grading_tracker_render_rows layout template.

    Context variables required for this template (data):

    {
        "id": int,
        "suspended":        bool,
        "class_row":        string,
        "course_name":      string, // short name, course code
        "course_fullname":  string
        "course_url":       url,
        "classname":        string, // group
        "gradername_url":   url,
        "gradername":       string,
        "username":         string, // student
        "username_url":     url,
        "cm_name":          string, // course module
        "module":           string, // module type
        "mod_url":          url, // url to activity
        "activity_url":     string, // custom url by ativity name
        "show_cm_name":     string, // short cm name
        "attempt":          int,
        "tags":             string,
        "expanded":         bool,
        "deadline":         int, // date
        "deadline_url":     url,
        "timestart":        int, // date
        "timeend":          int, // date
        "workdays":         int, // date
        "show_timegrade":   bool,
        "timegrade":        int, // date
        "class_status":     strint, // status as string
        "status_sort":      int, // status as int value to sort
        "str_status":       string, // status as text for user
        "action_menu":      html,
        "bug":              bool,
        "show_bugreport":   bool,
        "bug_report":       string,
        "academic_integrity.class": string, // optional
        "academic_integrity.title": string, // optional
    }
}}
{{#data}}
<tr data-id="{{id}}" class="record {{{class_row}}}">
    <td class="course_name">
        {{#action_menu}}
            <span class="checkbox-container">
                <input type="checkbox" name="checkbox_tag[{{{id}}}]" class="ned_tags_checkbox" value="0" data-id="{{{id}}}">
            </span>
        {{/action_menu}}
        <div>
            {{#course_name}}
                <a href="{{{course_url}}}" title="{{{course_fullname}}}">
                    {{{course_name}}}
                </a>
            {{/course_name}}
        </div>
    </td>
    {{#show_ids}}
        <td class="ids">{{id}}</td>
    {{/show_ids}}
    <td class="classname">
        <div>
            {{{classname}}}
        </div>
    </td>
    <td class="gradername">
        <div>
            {{#gradername_url}}
                <a href="{{{gradername_url}}}">
                    {{{gradername}}}
                </a>
            {{/gradername_url}}
            {{^gradername_url}}
                {{{gradername}}}
            {{/gradername_url}}
        </div>
    </td>
    <td class="username">
        {{#student}}
            {{#suspended}}
                <div class="suspended-user" title="{{#str}}suspended, block_ned_teacher_tools{{/str}}">S</div>
            {{/suspended}}
            {{{student}}}
        {{/student}}
    </td>
    {{#expanded}}
        <td class="last-check" data-sort-value="{{{last_check_raw}}}"
            {{#timemodified}} title="{{#userdate}} {{timemodified}}, %d %B %Y (%A) @ %I:%M %p {{/userdate}}" {{/timemodified}}
        >
            {{{last_check}}}
        </td>
    {{/expanded}}
    <td class="cm_name" data-sort-value="{{{cm_name}}}" title="{{{cm_name}}}">
        <div>
            {{#cm_name}}
                {{#module}}
                    <a href="{{{mod_url}}}" title="{{module}}" class="mod_url">
                        {{#pix}} icon, {{module}}, {{module}} {{/pix}}
                    </a>
                {{/module}}
                <a href="{{{activity_url}}}" class="activity_url" target="_blank">{{{show_cm_name}}}</a>
            {{/cm_name}}
            {{#attempt}}
                <span class="attemptnumber">R{{{attempt}}}</span>
            {{/attempt}}
            {{#latest}}
                <i class="fa fa-flag green" aria-hidden="true" title="{{#str}}gt:last_attempt, block_ned_teacher_tools{{/str}}"></i>
            {{/latest}}
        </div>
    </td>
    <td class="type">
        <div class="add-tag-icon" data-tags="{{{tags}}}" title="{{{tags}}}"></div>
    </td>
    {{#expanded}}
        <td class="deadline" data-sort-value="{{{deadline}}}">
            <div title="{{#deadline}}{{#userdate}} {{deadline}}, %d %B %Y (%A) @ %I:%M %p {{/userdate}}{{/deadline}}">
                {{#proxy}}
                    <span class="dimmed dimmed_text">{{#str}}gt:proxy_deadline, block_ned_teacher_tools{{/str}}</span>
                {{/proxy}}
                {{^proxy}}
                    <a href="{{{deadline_url}}}">
                        {{#deadline}}
                            {{#userdate}} {{deadline}}, %d %b %Y @ %I:%M %p {{/userdate}}
                        {{/deadline}}
                        {{^deadline}}
                            -
                        {{/deadline}}
                    </a>
                {{/proxy}}
            </div>
        </td>
        <td class="timestart" data-sort-value="{{{timestart}}}">
            <div title="{{#timestart}}{{#userdate}} {{timestart}}, %d %B %Y (%A) @ %I:%M %p {{/userdate}}{{/timestart}}">
                {{#timestart}}
                    {{#userdate}} {{timestart}}, %d %b %Y @ %I:%M %p {{/userdate}}
                {{/timestart}}
                {{^timestart}}
                    <i class="fa fa-exclamation-triangle red" aria-hidden="true" title="{{#str}}nosubmission, block_ned_teacher_tools{{/str}}"></i>
                {{/timestart}}
            </div>
        </td>
    {{/expanded}}
    <td class="timeend" data-sort-value="{{{timeend}}}">
        <div title="{{#timeend}}{{#userdate}} {{timeend}}, %d %B %Y (%A) @ %I:%M %p {{/userdate}}{{/timeend}}">
            {{#timeend}}
                {{#userdate}} {{timeend}}, %d %b %Y @ %I:%M %p {{/userdate}}
            {{/timeend}}
            {{^uncounted}}{{#workdays}}
                <span class="workdays {{class_status}}">[{{{workdays}}}{{#str}}days_short, block_ned_teacher_tools{{/str}}]</span>
            {{/workdays}}{{/uncounted}}
            {{^timestart}}
                <i class="fa fa-exclamation-triangle red" aria-hidden="true" title="{{#str}}nosubmission, block_ned_teacher_tools{{/str}}"></i>
            {{/timestart}}
        </div>
    </td>
    {{#expanded}}
        {{#show_timegrade}}
            <td class="timegrade" data-sort-value="{{{timegrade}}}">
                <div>
                    {{#timegrade}}
                        {{#userdate}} {{timegrade}}, %d %b %Y @ %I:%M %p {{/userdate}}
                    {{/timegrade}}
                </div>
            </td>
        {{/show_timegrade}}
    {{/expanded}}
    {{#show_uncounted_reason}}
        <td class="uncounted_reason">
            <div class="usertext">{{{uncounted_reason}}}</div>
        </td>
    {{/show_uncounted_reason}}
    {{#show_bugreport}}
        <td class="bug_report">
            <div class="usertext">{{{bug_report}}}</div>
        </td>
    {{/show_bugreport}}
    {{#show_note}}
        <td class="note">
            <div class="usertext">{{{note}}}</div>
        </td>
    {{/show_note}}
    <td class="status" data-sort-value="{{{status_sort}}}">
        <div class="{{class_status}}">{{{str_status}}}</div>
        {{{action_menu}}}
        <div class="status-plus">
            {{#bug}}
                <i class="fa fa-bug" title="{{{bug_report}}}"></i>
            {{/bug}}
            {{#uncounted}}
                <i class="fa fa-bar-chart" title="{{#str}}uncounted_reason_help, block_ned_teacher_tools{{/str}} {{{uncounted_reason}}}"></i>
            {{/uncounted}}
            {{#gthidden}}
                <i class="fa fa-low-vision" title="{{{note}}}"></i>
            {{/gthidden}}
        </div>
    </td>
</tr>
{{/data}}
