{{!
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_admin
    displays lists of glossaries in admin.

    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:
      * settingsurl
      * backtosettings
      * tokensettingsurl
      * tokensettings
      * glossaries
          ** glossaryid
          ** name
          ** sourcelang
          ** targetlang
          ** entrycount
          ** entrycountlink
          ** lastused
          ** glossaryselectvisibilityplaceholder
          ** shared

    Example context (json):
    {
    "settingsurl":"url",
    "backtosettings":"title",
    "tokensettingsurl":"url",
    "tokensettings":"title",
    "glossaries": [
        {
        "glossaryid": "uuid",
        "name": "myglossary",
        "sourcelang": "en",
        "targetlang": "ja",
        "entrycount": "3",
        "tokenid": "uuid",
        "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 april 2025",
        "glossaryselectvisibilityplaceholder": "0",
        "shared": "<option value='3'>3</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>"
    }
    ]
    }
}}
<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:visibility, local_deepler{{/str}}</th>
        <th>{{#str}}glossary:pool, local_deepler{{/str}}</th>
        <th>{{#str}}glossary:lastused, 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><select
                        class="form-select"
                        data-id="local_deepler/glossary_visibility"
                        data-glossary="{{glossaryid}}"
                        aria-label="{{glossaryselectvisibilityplaceholder}}">{{{shared}}}</select>
                </td>
            <td>{{tokenid}}</td>
            <td>{{lastused}}</td>
            <td>{{{actions}}}</td>
        </tr>
    {{/glossaries}}
    </tbody>
</table>
<div class="mb-3 pt-4">
    <a href="{{settingsurl}}" target="_self">{{backtosettings}}</a><br><a href="{{tokensettingsurl}}" target="_self">{{tokensettings}}</a>
</div>
