{{!
    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 competencies template.
}}
<div data-region="templatecompetenciespage">
    <h2>
        {{{template.shortname}}}
        {{#template.canmanage}}
            <a class="btn btn-sm btn-link" href="{{pluginbaseurl}}/edittemplate.php?id={{template.id}}&amp;pagecontextid={{pagecontextid}}">{{#pix}}t/edit, core, {{#str}}edittemplate, tool_lp{{/str}}{{/pix}}</a>
        {{/template.canmanage}}
    </h2>
    <div>{{{template.description}}}</div>
    {{#canmanagetemplatecompetencies}}
    <div data-region="actions" class="my-3">
        <button disabled class="btn btn-primary">{{#str}}addtemplatecompetencies, tool_lp{{/str}}</button>
    </div>
    {{/canmanagetemplatecompetencies}}
    <h3 class="mt-1">{{#str}}templatecompetencies, tool_lp{{/str}}</h3>
    {{#statistics}}
        {{> tool_lp/template_statistics }}
    {{/statistics}}
    <div data-region="templatecompetencies">
        <div class="managecompetencies">
            <div class="drag-parentnode">
                {{#competencies}}
                <div class="drag-samenode" data-id="{{competency.id}}">
                    <div class="rui-competencies-box">
                        {{#canmanagetemplatecompetencies}}
                        <span class="drag-handlecontainer float-left"></span>
                        <div class="float-sm-right">
                            <a href="#" class="btn btn-icon btn-danger" data-action="delete-competency-link" data-id="{{competency.id}}">
                                <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24">
                                    <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M6.75 7.75L7.59115 17.4233C7.68102 18.4568 8.54622 19.25 9.58363 19.25H14.4164C15.4538 19.25 16.319 18.4568 16.4088 17.4233L17.25 7.75"></path>
                                    <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M9.75 7.5V6.75C9.75 5.64543 10.6454 4.75 11.75 4.75H12.25C13.3546 4.75 14.25 5.64543 14.25 6.75V7.5"></path>
                                    <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M5 7.75H19"></path>
                                </svg>
                            </a>
                        </div>
                        {{/canmanagetemplatecompetencies}}
                        {{#competency}}
                            {{> tool_lp/competency_summary }}
                        {{/competency}}
                        <strong>{{#str}}linkedcourseslist, tool_lp{{/str}}</strong>
                        {{#hascourses}}
                        <ul class="inline list-inline mt-3 mb-0">
                        {{#linkedcourses}}
                            <li class="list-inline-item"><a href="{{viewurl}}?id={{id}}">{{{fullname}}} ({{{shortname}}})</a></li>
                        {{/linkedcourses}}
                        </ul>
                        {{/hascourses}}
                        {{^hascourses}}
                        <span class="badge badge-warning mt-3">{{#str}}nolinkedcourses, tool_lp{{/str}}</span>
                        {{/hascourses}}
                    </div>
                </div>
                {{/competencies}}
            </div>
        </div>
        {{^competencies}}
        <div class="mt-3 alert alert-warning d-inline-flex align-items-center">
            <span class="mr-2">
                <svg width="24" height="24" fill="none" viewBox="0 0 24 24">
                    <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M4.9522 16.3536L10.2152 5.85658C10.9531 4.38481 13.0539 4.3852 13.7913 5.85723L19.0495 16.3543C19.7156 17.6841 18.7487 19.25 17.2613 19.25H6.74007C5.25234 19.25 4.2854 17.6835 4.9522 16.3536Z"></path>
                    <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 10V12"></path>
                    <circle cx="12" cy="16" r="1" fill="currentColor"></circle>
                </svg>
            </span>
            {{#str}}nocompetenciesintemplate, tool_lp{{/str}}
        </div>
        {{/competencies}}
    </div>
    <div data-region="actions">
        {{#canmanagecompetencyframeworks}}
        <hr class="hr" />
        <div>
            <a class="btn btn-sm btn-secondary" href="{{manageurl}}">{{#str}}managecompetenciesandframeworks, tool_lp{{/str}}</a>
        </div>
        {{/canmanagecompetencyframeworks}}
    </div>
</div>
{{#js}}
require(['tool_lp/competencies'], function(mod) {
    (new mod({{template.id}}, 'template', {{pagecontextid}}));
});
{{/js}}
