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

    Displays a course index course-module entry.

    Example context (json):
    {
    "id": "12",
    "name": "Announcements",
    "url": "#",
    "visible": 1,
    "isactive": 1,
    "uniqid": "0",
    "accessvisible": 1,
    "hascmrestrictions": 0
    }
}}
<li class="courseindex-item
        {{#isactive}}active{{/isactive}}
        {{#hascmrestrictions}}restrictions{{/hascmrestrictions}}
        {{^accessvisible}}dimmed{{/accessvisible}}
        {{#indent}} indented {{/indent}}

        {{#hasdelegatedsection}}py-0{{/hasdelegatedsection}}

        {{#url}} d-flex {{/url}} {{^url}} d-flex-noedit {{/url}}"
    id="course-index-cm-{{id}}"
    data-for="cm"
    data-id="{{id}}"
    role="treeitem"
>
    {{^hasdelegatedsection}}
        <div class="edw-section-content-wrapper text-truncate align-items-center">
        <span class="completioninfo" data-for="cm_completion" data-value="NaN"></span>
        {{#uservisible}}
        <a
            class="courseindex-link text-truncate text-link-regular"
            {{#url}} href="{{{url}}}" {{/url}}{{^url}} href="#{{{anchor}}}" data-anchor="true" {{/url}}
            data-for="cm_name"
            tabindex="-1"
        >
            {{{name}}}
        </a>
        {{/uservisible}}
        {{^uservisible}}
        <a class="courseindex-link text-truncate text-link-regular" href="#{{{anchor}}}" data-for="cm_name" tabindex="-1" data-anchor="true">
            {{{name}}}
        </a>
        {{/uservisible}}
        </div>
        <div class="edw-section-content-icon-wrapper align-items-center">
            <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>
        </div>
    {{/hasdelegatedsection}}
    {{#hasdelegatedsection}}
        {{#sectioninfo}}
            {{> core_courseformat/local/courseindex/section}}
        {{/sectioninfo}}
    {{/hasdelegatedsection}}
</li>
{{#js}}
require(['core_courseformat/local/courseindex/cm'], function(component) {
    component.init('#course-index-cm-{{id}}');
});
{{/js}}
