{{!
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_table
    displays lists of glossaries to user prefs.

    Classes required for JS: none

      Data attributes required for JS:
      * data-id='local_deepler/glossary_visibility'
      * data-glossary='GLOSSARY-UUID'
      Context variables required for this template:
      * glossaries
          * glossaryid
          * name
          * sourcelang
          * targetlang
          * entrycount
          * entrycountlink
          * lastused
          * glossaryselectvisibilityplaceholder
          * shared

    Example context (json):
{
    "glossaries": [
        {
            "glossaryid": "uuid",
            "name": "myglossary",
            "sourcelang": "en",
            "targetlang": "ja",
            "entrycount": "3",
            "entrycountlink": "<a href='#' class='action-icon' data-id='local_deepler/glossary_entriesviewer' data-source='en' data-target='ja'><i class='icon fa fa-magnifying-glass-plus fa-fw' title='View' role='img' aria-label='View'></i></a>",
            "lastused": "Monday 4 2024",
            "glossaryselectvisibilityplaceholder": "0",
            "shared": "<option value='1'>1</option>",
            "actions": "<a href='#' class='action-icon'><i class='icon fa fa-trash-can fa-fw ' title='Delete' role='img' aria-label='Delete'></i></a>"
        }
    ]
}
}}
<h4>{{#str}}glossary:private:title, local_deepler{{/str}}</h4>
<table class="generaltable">
    <thead>
    <tr>
        <th>{{#str}}glossary:name, local_deepler{{/str}}</th>
        <th>{{#str}}glossary:sourcelang, local_deepler{{/str}} &gt; {{#str}}glossary:targetlang, local_deepler{{/str}}</th>
        <th>{{#str}}glossary:nbentries, local_deepler{{/str}}</th>
        <th>{{#str}}glossary:lastused, local_deepler{{/str}}</th>
        <th>{{#str}}glossary:visibility, local_deepler{{/str}}</th>
        <th>{{#str}}glossary:actions, local_deepler{{/str}}</th>
    </tr>
    </thead>
    <tbody>
    {{#glossaries}}
        <tr>
            <td title="{{glossaryid}}"><strong>{{name}}</strong><br><small>{{glossaryid}}</small></td>
            <td>{{sourcelang}} &gt; {{targetlang}}</td>
            <td>{{entrycount}} {{{entrycountlink}}}</td>
            <td>{{lastused}}</td>
            <td><select
                    class="form-select"
                    data-id="local_deepler/glossary_visibility"
                    data-glossary="{{glossaryid}}"
                    aria-label="{{glossaryselectvisibilityplaceholder}}">{{{shared}}}</select>
            <td>{{{actions}}}</td>
        </tr>
    {{/glossaries}}
    </tbody>
</table>
