{{!
    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 mod_verbalfeedback/list_participants

    Moodle template to the template library

    The purpose of this template is build the entire page for the template library (by including smaller templates).

    Classes required for JS:
    * none

    Data attributes required for JS:
    * none

    Context variables required for this template:
    * verbalfeedbackid - int The ID for the verbal feedback.
    * participants - array of all the members that will be given feedback. Each component has a name and an actions attribute.

    Example context (json):
    {
        "verbalfeedbackid": 1,
        "canperformactions": true,
        "participants": [
            {
                "name" : "Kurdapyo Dimagiba",
                "statuspending" : true,
                "respondlink": "#",
                "declinelink": "#"
            },
            {
                "name" : "Kurdapya Dimagiba",
                "statusinprogress" : true,
                "respondlink": "#",
                "declinelink": "#"
            },
            {
                "name" : "John Doe",
                "statusinprogress" : true,
                "undodeclinelink": "#"
            }
        ]
    }
}}
<div class="container-fluid" data-region="participantlist">
    <div class="row mt-3">
        <table class="flexible generaltable generalbox" id="participants">
            <thead>
                <tr>
                    <th>{{#str}}student, mod_verbalfeedback{{/str}}</th>
                    <th>{{#str}}status, mod_verbalfeedback{{/str}}</th>
                    <th>{{#str}}actions{{/str}}</th>
                </tr>
            </thead>
            <tbody>
            {{# participants }}
                <tr class="user unselectedrow">
                    <td class="align-middle">
                        {{ name }}
                    </td>
                    <td class="align-middle">
                        <span class="badge
                            {{#statuspending}}badge-secondary{{/statuspending}}
                            {{#statusinprogress}}badge-info{{/statusinprogress}}
                            {{#statusviewonly}}badge-info{{/statusviewonly}}
                            {{#statuscompleted}}badge-success{{/statuscompleted}}
                            {{#statusdeclined}}badge-warning{{/statusdeclined}}">
                            {{#statuspending}}{{#str}}statuspending, mod_verbalfeedback{{/str}}{{/statuspending}}
                            {{#statusinprogress}}{{#str}}statusinprogress, mod_verbalfeedback{{/str}}{{/statusinprogress}}
                            {{#statuscompleted}}{{#str}}statuscompleted, mod_verbalfeedback{{/str}}{{/statuscompleted}}
                            {{#statusdeclined}}{{#str}}statusdeclined, mod_verbalfeedback{{/str}}{{/statusdeclined}}
                            {{#statusviewonly}}{{#str}}statusviewonly, mod_verbalfeedback{{/str}}{{/statusviewonly}}
                        </span>
                    </td>
                    <td class="align-middle">
                        {{#canperformactions}}
                            {{#respondlink}}
                            <a class="btn btn-link pl-0" href="{{{respondlink}}}" title="{{#str}}providefeedback, mod_verbalfeedback{{/str}}">
                                {{#pix}} t/editstring, core, {{#str}}providefeedback, mod_verbalfeedback{{/str}} {{/pix}}
                            </a>
                            {{/respondlink}}
                            {{#declinelink}}
                            {{! <a class="btn btn-link" href="#" data-action="decline-feedback" data-statusid="((statusid))" data-userid="((userid))" data-name="((name))" title="((#str))decline, mod_verbalfeedback((/str))">
                            {{! ((#pix)) t/delete, core, ((#str))decline, mod_verbalfeedback((/str)) ((/pix))
                            {{! </a> }}
                            {{/declinelink}}
                            {{#undodeclinelink}}
                            {{! <a class="btn btn-link" href="#" data-action="undo-decline" data-statusid="((statusid))" data-userid="((userid))" title="((#str))undodecline, mod_verbalfeedback((/str))">
                            {{! ((#pix)) e/undo, core, ((#str))undodecline, mod_verbalfeedback((/str)) ((/pix))
                            {{! </a> }}
                            {{/undodeclinelink}}
                        {{/canperformactions}}
                        {{#reportslink}}
                            <a class="btn btn-link" href="{{{reportslink}}}" data-action="view-report" data-id="{{id}}" data-userid="{{userid}}" title="{{#str}}view{{/str}}">
                                {{#pix}} t/preview, core, {{#str}}viewfeedbackforuser, mod_verbalfeedback{{/str}} {{/pix}}
                            </a>
                        {{/reportslink}}
                    </td>
                </tr>
            {{/ participants }}
            </tbody>
        </table>
    </div>
</div>
{{#js}}
    require(['mod_verbalfeedback/view'], function(View) {
        new View({{verbalfeedbackid}});
    });
{{/js}}
