{{!
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 local_deepler/glossary_selector

    Classes required for JS: none

    Data attributes required for JS:
    - id=local_deepler/glossary_entriesviewer_page

    Context variables required for this template:
    - glossaryid
    - hasglossaries
    - glossaryselectplaceholder
    - glossaryselect
    - glossaries
    - glossarylistempty
    - glossarynotselected
    - linkentries

    Example context (json):
    {
    "glossarynotselected":"No glossary selected",
    "glossaryid": "1111-2222",
    "hasglossaries": true,
    "glossaryselectplaceholder": "Enter a glossary name",
    "glossaryselect": "Select a glossary",
    "linkentries":"<a href='#' data-id='local_deepler/glossary_entriesviewer_page'><i class='fa fa-view'></i></a>",
    "glossaries": [
        {
            "name": "My glossary",
            "glossaryid": "987987-0980"
        },
        {
            "name": "My other glossary",
            "glossaryid": "9999-999"
        }
    ],
    "glossarylistempty": "There are no glossaries available with this language pair."
    }
}}
<div class="glossary-selector">
    <p class="form-label">{{#str}}glossary:id,local_deepler{{/str}}</p>
        <div class="row">
        <select id="local_deepler__glossary"
                class="form-select col-10"
                data-id="local_deepler/glossary_id"
                aria-label="{{glossaryselectplaceholder}}"
            {{^hasglossaries}}disabled{{/hasglossaries}}
        >
            <option value="">{{glossarynotselected}}</option>
            {{#glossaries}}
                <option value="{{glossaryid}}">{{name}}</option>
            {{/glossaries}}
        </select>
    <span class="col-1">
    {{#hasglossaries}}{{{linkentries}}}{{/hasglossaries}}
    </span>
        </div>
    {{^hasglossaries}}
        <em>{{glossarylistempty}}</em>
    {{/hasglossaries}}
</div>
