{{!
    This file is part of mod_openbook for 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 mod_openbook/overrides

    Openbook resource folder's overrides template.

    The purpose of this template is to the contents of the overrides.

    Example context (json):
    {
        "newoverrideurl": "https://example.com/mod/openbook/overrides_edit.php?add=1",
        "addoverridetitle": "Add new override",
        "usergroupcoltitle": "User / Group",
        "identityheaders": [
            { "colclass": "colemail", "header": "Email address" },
            { "colclass": "colidnumber", "header": "ID number" }
        ],
        "overridesempty": false,
        "overrides": [
            {
                "userurl": "https://example.com/user/view.php?id=2",
                "fullname": "Alice Dupont",
                "identityvalues": [
                    { "value": "alice@example.com" },
                    { "value": "A12345" }
                ],
                "submissionoverride": "Submission deadline extended by 3 days",
                "approvaloverride": "Requires approval from supervisor",
                "editurl": "https://example.com/mod/openbook/overrides_edit.php?id=12",
                "deleteurl": "https://example.com/mod/openbook/overrides_delete.php?id=12"
            },
            {
                "userurl": "https://example.com/group/view.php?id=5",
                "fullname": "Group A",
                "identityvalues": [],
                "submissionoverride": "Extended deadline",
                "approvaloverride": "Auto-approved",
                "editurl": "https://example.com/mod/openbook/overrides_edit.php?id=13",
                "deleteurl": "https://example.com/mod/openbook/overrides_delete.php?id=13"
            }
        ]
    }
}}
<div class="">
    <a href="{{newoverrideurl}}" class="btn btn-primary">{{addoverridetitle}}</a>
    <table class="table w-100 mt-2">
        <thead>
            <tr>
                <th>{{usergroupcoltitle}}</th>
                {{#identityheaders}}
                    <th class="{{colclass}}">{{header}}</th>
                {{/identityheaders}}
                <th>{{#str}}overrides,openbook{{/str}}</th>
                <th>{{#str}}action{{/str}}</th>
            </tr>
        </thead>
        <tbody>
            {{#overridesempty}}
                <tr>
                    <td colspan="99">{{#str}}overrides:empty,openbook{{/str}}</td>
                </tr>
            {{/overridesempty}}
            {{^overridesempty}}
                {{#overrides}}
                    <tr>
                        <td>{{#userurl}}<a href="{{.}}" title="{{fullname}}">{{/userurl}}{{fullname}}{{#userurl}}</a>{{/userurl}}</td>
                        {{#identityvalues}}
                            <td>{{value}}</td>
                        {{/identityvalues}}
                        <td><div class="">{{submissionoverride}}</div><div class="">{{approvaloverride}}</div>
                            <div class="">{{securewindowoverride}}</div></td>
                        <td><a href="{{editurl}}">{{#pix}}t/edit{{/pix}}</a><a href="{{deleteurl}}">{{#pix}}t/delete{{/pix}}</a></td>
                {{/overrides}}
            {{/overridesempty}}
        </tbody>
    </table>
</div>