{{!
    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 block_eledia_coursesearch/nav-grouping-selector

    This template renders grouping dropdown.

    Example context (json):
    {
        "allincludinghidden": false,
        "all": true,
        "inprogress": false,
        "future": false,
        "past": false,
        "favourites": false,
        "hidden": false,
        "displaygroupingallincludinghidden": false,
        "displaygroupingall": true,
        "displaygroupinginprogress": true,
        "displaygroupingfuture": true,
        "displaygroupingpast": true,
        "displaygroupingfavourites": true,
        "displaygroupinghidden": true,
        "displaygroupingselector": true
    }
}}
{{#displaygroupingselector}}
    <div class="col-md-3">
    <div class="dropdown mb-3">
        <button id="groupingdropdown" type="button" class="btn btn-outline-secondary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" aria-label="{{#str}} aria:groupingdropdown, block_eledia_coursesearch {{/str}}">
            <span data-active-item-text>
                {{#all}}{{#str}} all, block_eledia_coursesearch {{/str}}{{/all}}
                {{#inprogress}}{{#str}} inprogress, block_eledia_coursesearch {{/str}}{{/inprogress}}
                {{#future}}{{#str}} future, block_eledia_coursesearch {{/str}}{{/future}}
                {{#past}}{{#str}} past, block_eledia_coursesearch {{/str}}{{/past}}
                {{selectedcustomfield}}
            </span>
        </button>
        <ul class="dropdown-menu" role="menu" data-show-active-item data-skip-active-class="true" data-active-item-text aria-labelledby="groupingdropdown">
            {{#displaygroupingall}}
            <li class="dropdown-divider" role="presentation">
                <span class="filler">&nbsp;</span>
            </li>
            <li>
                <a class="dropdown-item" href="#" data-filter="grouping" data-value="all" data-pref="all" aria-label="{{#str}} aria:allcourses, block_eledia_coursesearch {{/str}}" role="menuitem" {{#all}}aria-current="true"{{/all}}>
                    {{#str}} all, block_eledia_coursesearch {{/str}}
                </a>
            </li>
            {{/displaygroupingall}}
            {{#displaygroupinginprogress}}
            <li class="dropdown-divider" role="presentation">
                <span class="filler">&nbsp;</span>
            </li>
            <li>
                <a class="dropdown-item" href="#" data-filter="grouping" data-value="inprogress" data-pref="inprogress" aria-label="{{#str}} aria:inprogress, block_eledia_coursesearch {{/str}}" role="menuitem" {{#inprogress}}aria-current="true"{{/inprogress}}>
                    {{#str}} inprogress, block_eledia_coursesearch {{/str}}
                </a>
            </li>
            {{/displaygroupinginprogress}}
            {{#displaygroupingfuture}}
                {{^displaygroupinginprogress}}
                <li class="dropdown-divider" role="presentation">
                    <span class="filler">&nbsp;</span>
                </li>
                {{/displaygroupinginprogress}}
            <li>
                <a class="dropdown-item" href="#" data-filter="grouping" data-value="future" data-pref="future" aria-label="{{#str}} aria:future, block_eledia_coursesearch {{/str}}" role="menuitem" {{#future}}aria-current="true"{{/future}}>
                    {{#str}} future, block_eledia_coursesearch {{/str}}
                </a>
            </li>
            {{/displaygroupingfuture}}
            {{#displaygroupingpast}}
                {{^displaygroupinginprogress}}
                    {{^displaygroupingfuture}}
                    <li class="dropdown-divider" role="presentation">
                        <span class="filler">&nbsp;</span>
                    </li>
                    {{/displaygroupingfuture}}
                {{/displaygroupinginprogress}}
            <li>
                <a class="dropdown-item" href="#" data-filter="grouping" data-value="past" data-pref="past" aria-label="{{#str}} aria:past, block_eledia_coursesearch {{/str}}" role="menuitem" {{#past}}aria-current="true"{{/past}}>
                    {{#str}} past, block_eledia_coursesearch {{/str}}
                </a>
            </li>
            {{/displaygroupingpast}}
        </ul>
    </div>
    </div>
    {{/displaygroupingselector}}
