{{!
    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 format_edwiservideoformat/local/header

    Edwiser Video Format course header template.

    Context variables required for this template:
    * coursefullname - Course full name
    * coursecategoryname - Course category name
    * headercourseimage - Course header image URL
    * percentage - Course completion percentage
    * teachers - Array of enrolled teachers
    * resumeactivityurl - Resume activity URL (if available)
    * startactivityurl - Start activity URL (if available)
    * headerbgposition - Background position setting
    * headerbgsize - Background size setting
    * headeroverlayopacity - Header overlay opacity setting

    Example context (json):
    {
        "coursefullname": "Course Name",
        "coursecategoryname": "Category Name",
        "headercourseimage": "image_url",
        "percentage": 75,
        "teachers": [],
        "resumeactivityurl": "activity_url",
        "startactivityurl": "activity_url",
        "headerbgposition": "center",
        "headerbgsize": "cover",
        "headeroverlayopacity": 0.7
    }
}}

<div class="edwiservideoformat-header-wrapper d-none">
    <header id="page-header" class="d-print-none hasbackground design-1 position-relative"
        style="background: url('{{headercourseimage}}'); background-position: {{headerbgposition}}; background-size: {{headerbgsize}}; background-repeat: no-repeat;">
        <div class="position-absolute w-100 h-100" style="background: linear-gradient(180deg, rgba(0, 0, 0, 0.0) -24.52%, #000000 97.67%); left:0%; bottom:0%; opacity: {{headeroverlayopacity}}; border-radius: inherit;"></div>
        <div class="align-self-end" style="z-index:1;">
            {{{turneditingonswitch}}}
            {{{bulkbutton}}}
        </div>
        <div class="w-100 header-wrapper" style="z-index:1;">
            <div class="d-flex flex-wrap w-100">
                <div class="d-flex align-items-center w-100">
                    <div class="dashboard-bar-wrapper w-100">
                        <div class="header-main-section">
                            <div class="category">
                                <span class="badge">
                                    {{{coursecategoryname}}}
                                </span>
                            </div>
                            <div class="page-context-header p-0 m-0">
                                <div class="page-header-headings p-0">
                                    <h1 class="h2 header-heading coursepage design-1 m-0">{{{coursefullname}}}</h1>
                                </div>
                            </div>
                        </div>
                        <div class="header-sub-section">
                            <div class="rating-instructor-wrapper">
                                {{#rnrdesign}}
                                <div class="edw-ratings-wrapper">
                                    {{{rnrdesign}}}
                                </div>
                                {{/rnrdesign}}
                                {{#teachers}}
                                <div class="instructor-info stat-container position-relative">
                                    {{#instructors}}
                                    <div class="position-relative">
                                        <a class="view-user-profile-link" href="{{teacherprofileurl}}" class="" title="{{name}}"></a>
                                        {{{avatars}}}
                                        <span class="titles">{{name}}</span>
                                    </div>
                                    {{/instructors}}
                                    {{#teachercount}}
                                        <a class="view-all-instructorslink" href="{{participantspageurl}}" class="">view all</a>
                                    {{/teachercount}}
                                </div>
                                {{/teachers}}
                            </div>
                            {{#coursecompletionstatus}}
                            <div class="progress-resume-wrapper">
                                <div class="progressbar-text-wrapper">
                                    <div class="progress progress-rounded">
                                        <div class="progress-bar bg-green-600"
                                            style="width: {{{percentage}}}%; height: 100%;" role="progressbar">
                                            <span class="sr-only">{{{percentage}}}% Complete</span>
                                        </div>
                                    </div>
                                    <span>{{{percentage}}}% Complete</span>
                                </div>
                                {{#resumeactivityurl}}
                                <a class="btn btn-primary bold" href="{{{resumeactivityurl}}}"
                                    role="button">{{#str}}resumetoactivity, format_edwiservideoformat{{/str}}</a>
                                {{/resumeactivityurl}}
                                {{#startactivityurl}}
                                <a class="btn btn-primary bold" href="{{{startactivityurl}}}"
                                    role="button">{{#str}}startactivity, format_edwiservideoformat{{/str}}</a>
                                {{/startactivityurl}}
                            </div>
                            {{/coursecompletionstatus}}
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </header>
</div>
{{#courseheaderdesign}}
{{#js}}
require(['format_edwiservideoformat/headerreplaces'], function(HEADERREPLACE) {
    HEADERREPLACE.init();
});
{{/js}}
{{/courseheaderdesign}}
