{{!
    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 report_competency/report

    Moodle template competency breakdown report.

    This template includes ajax functionality, so it cannot be shown in the template library.
}}
<div data-region="competency-breakdown-report" data-courseid="{{course.id}}" data-userid="{{user.id}}" data-moduleid="{{moduleid}}">
<div data-region="configurecoursecompetencies">
{{#pushratingstouserplans}}
    <p class="alert">
    {{#str}}coursecompetencyratingsarepushedtouserplans, tool_lp{{/str}}
    </p>
{{/pushratingstouserplans}}
{{^pushratingstouserplans}}
    <p class="alert alert-info">
    {{#str}}coursecompetencyratingsarenotpushedtouserplans, tool_lp{{/str}}
    </p>
{{/pushratingstouserplans}}
</div>
<div class="row-fluid">
<span class="col-md-6">
    <table class="table table-bordered">
        <summary class="accesshide">
            <p>{{#str}}coursecompetencybreakdownsummary, report_competency{{/str}}</p>
        </summary>
        <tr>
            <th scope="col">
                <span>{{#str}}competency, report_competency{{/str}}</span>
            </th>
            <th scope="col">
                <span>{{#str}}rating, report_competency{{/str}}</span>
            </th>
        </tr>
        {{#usercompetencies}}
        <tr>
            {{#competency}}
            <td>
                <a href="#" data-action="competency-dialogue" data-id="{{competency.id}}">
                    {{{competency.shortname}}} <em data-id="{{competency.id}}">{{competency.idnumber}}</em>
                </a>
            </td>
            {{/competency}}
            {{#usercompetencycourse}}
            <td class="alert {{#proficiency}}alert-success{{/proficiency}}"
                data-user-competency="true"
                data-userid="{{user.id}}"
                data-competencyid="{{competencyid}}"
                data-courseid="{{course.id}}">
                {{> report_competency/user_competency_summary}}
            </td>
            {{/usercompetencycourse}}
        </tr>
        {{/usercompetencies}}
    </table>
</span>
</div>
</div>
{{#js}}
require(['tool_lp/competencydialogue'], function(Compdialogue) {
    Compdialogue.init();
});
require(['report_competency/grading_popup'], function(Popup) {
    (new Popup('[data-region=competency-breakdown-report]', '[data-user-competency=true]'));
});
{{/js}}
