{{!
    @template block_ned_teacher_tools/deadline_manager_header_summary

    Context variables required for this template:
    * coursename - text
    * studentname - text
    * currentgrade - number, grade in % (without symbol '%')
    * groupname - text
    * reporturl - text, url to report
    * groupstartend - text
    * numberofconflicts - bool
    * studentname - text
    * numberofstudent - text
    * classroomteacher - text
    * onlineteacher - text

    >block_ned_teacher_tools/date_conflict_warning: -

}}
<div class="sp-menu">
    {{#groupname}}
        <div class="sp-section generalinfo">
            <div class="sp-title">{{# str }} classinfo, block_ned_teacher_tools {{/ str }}</div>
            <div>
                <span class="gi-label">{{# str }} class, block_ned_teacher_tools {{/ str }}:</span>
                <span class="gi-value">
                    {{groupname}}
                    {{#numberofstudent}}
                        - {{numberofstudent}} <a href="{{addstudenturl}}" target="_blank"><i class="fa fa-plus-circle" aria-hidden="true"></i></a>
                    {{/numberofstudent}}
                </span>
            </div>
            {{#classroomteacher}}
                <div>
                    <span class="gi-label">{{# str }} ct, block_ned_teacher_tools {{/ str }}:</span>
                    <span class="gi-value">{{{classroomteacher}}}</span>
                </div>
            {{/classroomteacher}}
            {{#onlineteacher}}
                <div>
                    <span class="gi-label">{{# str }} ot, block_ned_teacher_tools {{/ str }}:</span>
                    <span class="gi-value">{{{onlineteacher}}}</span>
                </div>
            {{/onlineteacher}}
            {{#groupstartend}}
                <div>
                    <span class="gi-label">{{# str }} startend, block_ned_teacher_tools {{/ str }}:</span>
                    <span class="gi-value">
                        {{#reporturl}}<a href="{{reporturl}}">{{groupstartend}}</a>{{/reporturl}}
                        {{^reporturl}}{{groupstartend}}{{/reporturl}}
                        {{#extendclassstudentenddate}}
                            <a href="{{groupediturl}}" target="_blank" data-action="classextensionmodal" data-groupid="{{groupid}}"><i class="fa fa-pencil" aria-hidden="true"></i></a>
                        {{/extendclassstudentenddate}}
                        {{#numberofconflicts}}
                            {{>block_ned_teacher_tools/date_conflict_warning}}
                        {{/numberofconflicts}}
                    </span>
                </div>
            {{/groupstartend}}
            {{#midtermdategroup}}
                <div>
                    <span class="gi-label">{{# str }} midtermdate, block_ned_teacher_tools {{/ str }}:</span>
                    <span class="gi-value">{{midtermdategroup}}</span>
                </div>
            {{/midtermdategroup}}
            {{#groupdaysleft}}
                <div>
                    <span class="gi-label">{{# str }} daysleft, block_ned_teacher_tools {{/ str }}:</span>
                    <span class="gi-value">{{groupdaysleft}}</span>
                </div>
            {{/groupdaysleft}}
        </div>
    {{/groupname}}

    {{#studentname}}
        <div class="sp-section generalinfo">
            <div class="sp-title">{{# str }} studentinfo, block_ned_teacher_tools {{/ str }}</div>
                <div>
                    <span class="gi-label">{{# str }} student, block_ned_teacher_tools {{/ str }}:</span>
                    <span class="gi-value">{{{studentname}}}</span>
                </div>
            {{#currentgrade}}
                <div>
                    <span class="gi-label">{{# str }} grade_, block_ned_teacher_tools {{/ str }}:</span>
                    <span class="gi-value">{{currentgrade}}%</span>
                </div>
            {{/currentgrade}}
            {{#studentstartend}}
                <div>
                    <span class="gi-label">{{# str }} startend, block_ned_teacher_tools {{/ str }}:</span>
                    <span class="gi-value">
                        {{#reporturl}}<a href="{{reporturl}}">{{studentstartend}}</a>{{/reporturl}}
                        {{^reporturl}}{{studentstartend}}{{/reporturl}}
                        {{#extendclassstudentenddate}}
                            <a href="#" target="_blank" data-action="studentextensionmodal" data-studentid="{{studentid}}" data-groupid="{{groupid}}"><i class="fa fa-pencil" aria-hidden="true"></i></a>
                        {{/extendclassstudentenddate}}
                        {{#numberofconflicts}}
                            {{>block_ned_teacher_tools/date_conflict_warning}}
                        {{/numberofconflicts}}
                    </span>
                </div>
            {{/studentstartend}}
            {{#midtermdateuser}}
                <div>
                    <span class="gi-label">{{# str }} midtermdate, block_ned_teacher_tools {{/ str }}:</span>
                    <span class="gi-value">{{midtermdateuser}}</span>
                </div>
            {{/midtermdateuser}}
            {{#studentdaysleft}}
                <div>
                    <span class="gi-label">{{# str }} daysleft, block_ned_teacher_tools {{/ str }}:</span>
                    <span class="gi-value">{{studentdaysleft}}</span>
                </div>
            {{/studentdaysleft}}
        {{#enabledeadlineextension}}
            <div>
                <span class="gi-label">{{# str }} extensions, block_ned_teacher_tools {{/ str }}:</span>
                <span class="gi-value">{{{numberofextensions}}}/{{{maxextensionperstudent}}}</span>
            </div>
        {{/enabledeadlineextension}}
    </div>
    {{/studentname}}

    {{#time_zone_info}}
        <div class="sp-section generalinfo">
            <div class="sp-title">{{# str }} timezoneinfo, block_ned_teacher_tools {{/ str }}</div>
            {{{time_zone_info}}}
        </div>
    {{/time_zone_info}}
    {{#hasdifferenttimezone}}
        <div class="alert alert-danger d-inline-block float-left h-100">{{# str }} differenttimezonewarning, block_ned_teacher_tools {{/ str }}</div>
    {{/hasdifferenttimezone}}
</div>
{{#js}}
    require(['block_ned_teacher_tools/timezone'], function(Timezone) {
        Timezone.init();
    });

    require(['block_ned_teacher_tools/classextension'], function(ClassExtension) {
        const class_modal = document.querySelector('[data-action=classextensionmodal]');
        if(!class_modal) return;

        $(class_modal).on('click', function(e) {
            e.preventDefault();
            var groupid = $(this).data('groupid');
            ClassExtension.init({{contextid}}, groupid);
        });
    });
    require(['block_ned_teacher_tools/studentextension'], function(StudentExtension) {
        const student_modal = document.querySelector('[data-action=studentextensionmodal]');
        if(!student_modal) return;

        $(student_modal).on('click', function(e) {
            e.preventDefault();
            var studentid = $(this).data('studentid');
            var groupid = $(this).data('groupid');
            StudentExtension.init({{contextid}}, studentid, groupid);
        });
    });
{{/js}}