{{!
    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/>.

    Edwiser RemUI
    @package theme_remui
    @copyright (c) 2023 WisdmLabs (https://wisdmlabs.com/)
    @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
}}
{{!
    @template core_courseformat/local/courseindex/section

    Displays a course index section entry.

    Example context (json):
    {
        "title": "General",
        "id": 23,
        "uniqid": "0",
        "number": 1,
        "sectionurl": "#",
        "indexcollapsed": 0,
        "current": 1,
        "visible": 1,
        "hasrestrictions": 0,
        "cms": [
            {
                "id": 10,
                "name": "Glossary of characters",
                "url": "#",
                "visible": 1,
                "isactive": 0
            },
            {
                "id": 11,
                "name": "World Cinema forum",
                "url": "#",
                "visible": 1,
                "isactive": 0
            },
            {
                "id": 12,
                "name": "Announcements",
                "url": "#",
                "visible": 0,
                "isactive": 1
            }
        ]
    }
}}
<div
    class="courseindex-section w-100 {{#current}}current{{/current}}  {{#component}}delegated-section{{/component}}"
    id="course-index-section-{{id}}"
    data-for="section"
    data-id="{{id}}"
    data-number="{{number}}"
    role="treeitem"
    aria-owns="courseindexcollapse{{number}}"
>
    <div class="courseindex-item d-flex align-items-center
            {{^visible}}dimmed{{/visible}}
            {{#hasrestrictions}}restrictions{{/hasrestrictions}}
            courseindex-section-title"
        id="courseindexsection{{number}}"
        data-for="section_item"
    >
            <a data-bs-toggle="collapse"
            href="#courseindexcollapse{{number}}"
            class="courseindex-chevron d-none icons-collapse-expand {{#indexcollapsed}}collapsed{{/indexcollapsed}}"
            aria-expanded="{{^indexcollapsed}}true{{/indexcollapsed}}{{#indexcollapsed}}false{{/indexcollapsed}}"
            aria-controls="courseindexcollapse{{number}}"
            tabindex="-1"
        >
        <a href="{{{sectionurl}}}"
            class="courseindex-link text-truncate text-link-semibold"
            data-action="togglecourseindexsection"
            data-for="section_title"
            tabindex="-1"
            title=" {{{title}}}"
        >
            {{{title}}}
        </a>
  <div class="edw-title-icon-wrapper">
    <span class="current-badge badge badge-primary  px-2 rounded-pill">
        {{highlighted}}
    </span>
    <span class="courseindex-locked " data-for="cm_name">
        {{#pix}} t/locked, core {{/pix}}
    </span>
    <span class="dragicon "><span class="edw-icon edw-edw-icon edw-icon-Move"></span></span>
    <a data-bs-toggle="collapse"
    href="#courseindexcollapse{{number}}"
    class="courseindex-chevron icons-collapse-expand {{#indexcollapsed}}collapsed{{/indexcollapsed}} p-0"
    aria-expanded="{{^indexcollapsed}}true{{/indexcollapsed}}{{#indexcollapsed}}false{{/indexcollapsed}}"
    aria-controls="courseindexcollapse{{number}}"
    tabindex="-1"
>
    <span class="collapsed-icon icon-no-margin"
        title="{{#str}} expand, core {{/str}}">
        <span class="dir-rtl-hide"><span class="edw-icon edw-icon-Down-Arrow"></span></span>
        <span class="dir-ltr-hide"><span class="edw-icon edw-icon-Down-Arrow"></span></span>
        <span class="sr-only">{{#str}} expand, core {{/str}}</span>
    </span>
    <span class="expanded-icon icon-no-margin "
        title="{{#str}} collapse, core {{/str}}">
        <span class="edw-icon edw-icon-UpArrow"></span>
        <span class="sr-only">{{#str}} collapse, core {{/str}}</span>
    </span>
</a>
  </div>
    </div>
    <div id="courseindexcollapse{{number}}"
        class="courseindex-item-content collapse {{^indexcollapsed}}show{{/indexcollapsed}}"
        aria-labelledby="courseindexsection{{number}}" role="group"
    >
        <ul class="courseindex-sectioncontent unlist" data-for="cmlist" data-id="{{id}}" role="group">
            {{#cms}}
            {{> core_courseformat/local/courseindex/cm }}
            {{/cms}}
        </ul>
    </div>
</div>
{{#js}}
require(['core_courseformat/local/courseindex/section'], function(component) {
    component.init('#course-index-section-{{id}}');
});
{{/js}}
