{{!
    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/approvaltooltip

    Openbook resource folder's approvaltooltip template.

    The purpose of this template is to the contents of the approval tool-tip for group approval.

    Classes required for JS:
    * none

    Data attributes required for JS:
    * none

    Context variables required for this template:
    * id ID of related element
    * approval Array with name & time pairs.
    * rejected Array with name & time paris.
    * pending Array with name & time pairs.

    Example context (json):
    {
        "id": 7,
        "status": { "approved": false,
                    "rejected": true,
                    "pending": false },
        "approval": [
            { "name": "John Doe", "time": "04.11.2016 15:37" },
            { "name": "Jane Doe", "time": "01.11.2016 09:42" }
        ],
        "rejected": [
            { "name": "Jessica Jones", "time": "07.10.2016 10:46" },
            { "name": "Luke Cage", "time": "13.10.2016 09:42" }
        ],
        "pending": [
            { "name": "Barry Allen", "time": "-" },
            { "name": "Bruce Banner", "time": "-" }
        ]
    }

}}
<div class="openbookoverlay" role="tooltip">
    <table class="table table-sm w-100">
        <tr>
            <th>
                {{#str}}obtaingroupapproval_title, mod_openbook{{/str}}
            </th>
        </tr>
        {{#status}}
            <tr>
                <th>{{# str }} status, mod_openbook {{/ str }}&nbsp;&mdash;&nbsp;{{# str }} total, mod_openbook {{/ str }}: </th>
                <td>
                    {{#approved}}<i class="fa fa-check fa-fw text-success" title="{{# str }} approved, mod_openbook {{/ str }}"></i>{{!
                    }}<!-- ({{# str }} approved, mod_openbook {{/ str }}) -->{{/approved}}
                    {{#rejected}}<i class="fa fa-times fa-fw text-danger" title="{{# str }} rejected, mod_openbook {{/ str }}"></i>{{!
                    }}<!-- ({{# str }} rejected, mod_openbook {{/ str }}) -->{{/rejected}}
                    {{#pending}}<i class="fa fa-question fa-fw text-warning" title="{{# str }} pending, mod_openbook {{/ str }}"></i>{{!
                    }}<!-- ({{# str }} pending, mod_openbook {{/ str }}) -->{{/pending}}
                </td>
            </tr>
        {{/status}}
        <tr>
            <th class="mb-0">{{# str }} status, mod_openbook {{/ str }}&nbsp;&mdash;&nbsp;{{!
                }}{{# str }} details, mod_openbook {{/ str }}:</th>
            <td></td>
        </tr>
        {{#approved}}
            <tr>
                <td>{{name}}</td>
                <td><i class="fa fa-check fa-fw text-success" title="{{# str }} approved, mod_openbook {{/ str }}"></i> {{!
                }}<!-- ({{# str }} approved, mod_openbook {{/ str }}) -->
                    {{time}}
                </td>
            </tr>
        {{/approved}}
        {{#rejected}}
            <tr>
                <td>{{name}}</td>
                <td><i class="fa fa-times fa-fw text-danger" title="{{# str }} rejected, mod_openbook {{/ str }}"></i>{{!
                }}<!-- ({{# str }} rejected, mod_openbook {{/ str }}) -->
                    {{time}}
                </td>
            </tr>
        {{/rejected}}
        {{#pending}}
            <tr>
                <td>{{name}}</td>
                <td><i class="fa fa-question fa-fw text-warning" title="{{# str }} pending, mod_openbook {{/ str }}"></i>{{!
                }}<!-- ({{# str }} pending, mod_openbook {{/ str }}) -->
                </td>
            </tr>
        {{/pending}}
    </table>
</div>
