{{!
    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 theme_eadtraining/course_management/category_listitem

    Example context (json):
    {
        "attributes": "class=\"category-list-item py-2\" data-category-id=\"12\"",
        "showcheckbox": true,
        "id": 12,

        "icon": "<span class=\"me-2\"><i class=\"icon fa fa-folder-open\" aria-hidden=\"true\"></i></span>",

        "viewurl": "/course/index.php?categoryid=12",
        "nameclass": "fw-semibold",
        "arialabel": "Abrir categoria Matemática",
        "name": "Matemática",

        "idnumber": "MAT-01",

        "hasactions": true,
        "actionshtml": "<div class=\"ms-2 dropdown\">...</div>",

        "countid": "categorycoursecount12",
        "coursecount": 8,
        "courseicon": "<i class=\"icon fa fa-graduation-cap ms-1\" aria-hidden=\"true\"></i>",

        "expanded": true,
        "childrenhtml": "<li class=\"category-list-item\" data-category-id=\"21\">...</li>"
    }
}}
<li {{{attributes}}}>
    <div class="clearfix">

        <div class="float-start {{^showcheckbox}}d-none{{/showcheckbox}}">
            <div class="custom-control custom-checkbox me-1">
                <input id="categorylistitem{{id}}"
                        type="checkbox"
                        name="bcat[]"
                        value="{{id}}"
                        class="bulk-action-checkbox custom-control-input"
                        data-action="select">
                <label class="custom-control-label" for="categorylistitem{{id}}">
                    <span class="sr-only">
                        {{#str}}bulkactionselect, moodle, {{{name}}}{{/str}}
                    </span>
                </label>
            </div>
        </div>

        {{{icon}}}

        <div class="d-flex flex-column">
            <a href="{{viewurl}}" class="{{nameclass}}"{{#arialabel}} aria-label="{{arialabel}}"{{/arialabel}}>
                {{{name}}}
            </a>
            <div class="float-end d-flex">
            <span class="text-muted idnumber">{{idnumber}}</span>

            {{#hasactions}}
                {{{actionshtml}}}
            {{/hasactions}}

            <span class="course-count text-muted" aria-labelledby="{{countid}}">
                <span>{{coursecount}}</span>
                <span class="accesshide" id="{{countid}}">{{#str}}courses, core{{/str}}</span>
                {{{courseicon}}}
            </span>
        </div>
        </div>
    </div>

    {{#expanded}}
        <ul class="ml" role="group" id="subcategoryof{{id}}">
            {{{childrenhtml}}}
        </ul>
    {{/expanded}}
</li>
