{{!
    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 core/local/comboboxsearch/resultset

    Wrapping template for returned result items.

    Context variables required for this template:
    * results - Our returned results to render.
    * searchterm - The entered text to find these results.
    * hasresult - Allow the handling where no results exist for the returned search term.
    * noresults - Our fall through case if nothing matches.

    Example context (json):
    {
        "results": [
            {
                "id": 2,
                "name": "Foo bar",
                "link": "http://foo.bar/grade/report/grader/index.php?id=42&userid=2"
            },
            {
                "id": 3,
                "name": "Bar Foo",
                "link": "http://foo.bar/grade/report/grader/index.php?id=42&userid=3"
            }
        ],
        "searchterm": "Foo",
        "hasresults": true
    }
}}
<div class="d-flex flex-column mh-100 h-100">
    {{#hasresults}}
        <ul id="{{$listid}}list{{/listid}}-result-listbox" class="searchresultitemscontainer d-flex flex-column mw-100 position-relative py-2 list-group h-100 mx-0 {{$listclasses}}{{/listclasses}}" role="listbox" data-region="search-result-items-container" tabindex="-1" aria-label="{{#cleanstr}} aria:dropdowngrades, core_grades {{/cleanstr}}">
            {{$results}}
                {{#results}}
                    {{>core/local/comboboxsearch/resultitem}}
                {{/results}}
            {{/results}}
            {{$selectall}}{{/selectall}}
        </ul>
    {{/hasresults}}
    {{^hasresults}}
        <span class="small d-block px-2 my-2">{{#str}} noresultsfor, core, {{searchterm}}{{/str}}</span>
    {{/hasresults}}
</div>
