{{!
   This file is part of Totara LMS

   Copyright (C) 2016 onwards Totara Learning Solutions LTD

   This program 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.

   This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
}}
{{!

    @template block_current_learning/program_row

    Creates the row in the current learning block for programs and certifications.

    Classes required for JS:
    * none

    Data attributes required for JS:
    * none

    Context variables required for this template:
    * component string The component name
    * type string The learning type
    * id string The item id
    * shortname string The program/certification shortname
    * fullname string The program/certification  fullname
    * description string The program/certification  description
    * url_view string The url of the program/certification
    * progress array The progress summary and percentage data
    * dueinfo array The duedate data
    * coursesets array The coursesets data
    * template string The mustache template for the learning item

    Example context (json):
    {
        "component": "totara_program",
        "type": "program",
        "id": "10",
        "shortname": "P101",
        "fullname": "First aid &amp; health &amp; safety",
        "description": "",
        "url_view": "/totara/program/view.php?id=1",
        "progress": {
            "summary": "Not yet started",
            "percentage": 0
        },
        "dueinfo": null,
        "coursesets_header_text": "1 completed set and 1 optional set",
        "coursesets": [
            {
                "name": " First aid & health & safety",
                "completion_text": "Complete all courses to progress",
                "nextsetoperator": "",
                "courses": [
                    {
                        "component": "core_course",
                        "type": "course",
                        "id": "24",
                        "shortname": "Understanding basic needs",
                        "fullname": "Understanding basic needs",
                        "description": "",
                        "url_view": "/course/view.php?id=1",
                        "progress": {
                            "summary": "",
                            "percentage": null
                        }
                    },
                    {
                        "component": "core_course",
                        "type": "course",
                        "id": "25",
                        "shortname": "The three Bs",
                        "fullname": "The three Bs",
                        "description": "",
                        "url_view": "/course/view.php?id=1",
                        "progress": {
                            "summary": "",
                            "percentage": null
                        }
                    }
                ]
            }
        ],
        "template": "block_current_learning/program_row"
    }
}}
<li id="block_current_learning-program-{{id}}" class="block_current_learning-item block_current_learning-program">
    <div class="block_current_learning-row-item">
        <span class="expand-collapse-icon-wrap collapsed" data-toggle="collapse" data-target="#block_current_learning-program-{{id}}-detail" aria-expanded="false" aria-controls="block_current_learning-program-{{id}}-detail">
            <span class="collapsed-icon">{{#flex_icon}}collapsed{{/flex_icon}}</span>
            <span class="expanded-icon">{{#flex_icon}}caret-down{{/flex_icon}}</span>
        </span>
        <span data-toggle="tooltip" data-placement="top" data-container="body" title="{{title}}">
            {{#flex_icon}}{{icon}}{{/flex_icon}}
        </span>
        <a href="{{url_view}}">
            <h3>{{{fullname}}}</h3>
        </a>
        <span class="pull-right info">
            {{#dueinfo}}
                <span class="label {{state}}" data-toggle="tooltip" data-placement="top" title="{{tooltip}}">
                    {{#alert}}{{#flex_icon}}warning{{/flex_icon}}{{/alert}} {{duetext}}
                </span>
            {{/dueinfo}}
            {{#progress}}
                <span class="label label-default">{{summary}}</span>
            {{/progress}}
        </span>
    </div>
    <div class="collapse" id="block_current_learning-program-{{id}}-detail">
        <div class="current_learning-bundle">
            {{#coursesets_header_text}}
                <div class="current_learning-set-stamp">
                    <p class="status-complete">{{#flex_icon}}check{{/flex_icon}}{{coursesets_header_text}}</p>
                </div>
            {{/coursesets_header_text}}
            {{#coursesets}}
                <div class="current_learning-set">
                    <h4>{{{name}}}<span class="pull-right info">{{completion_text}}</span></h4>
                    {{#courses}}
                        <div class="current_learning-course">
                            <a href="{{url_view}}">{{{fullname}}}</a>
                            {{#points}}
                                <span class="points">{{points}}</span>
                            {{/points}}
                            {{#progress}}
                                <span class="pull-right info">
                                    {{#duetext}}
                                        <span class="label label-{{tooltip-state}}" data-toggle="tooltip" data-placement="top" title="{{tooltip}}">
                                            {{duetext}}
                                        </span>
                                    {{/duetext}}
                                    {{#pbar}}
                                        {{> core/progress_bar }}
                                    {{/pbar}}
                                    {{^pbar}}
                                        <span class="label label-default">{{summarytext}}</span>
                                    {{/pbar}}
                                </span>
                            {{/progress}}
                        </div>
                    {{/courses}}
                </div>
                {{#nextsetoperator}}
                    <p class="current_learning-operator">
                        {{#nextseticon}}
                            {{#flex_icon}}{{nextseticon}}{{/flex_icon}}
                        {{/nextseticon}}
                        {{^nextseticon}}
                            <span>{{nextsetoperator}}</span>
                        {{/nextseticon}}
                        <span class="sr-only">{{nextsetoperator}}</span>
                    </p>
                {{/nextsetoperator}}
            {{/coursesets}}
            {{#unavailable_coursesets}}
                <div class="current_learning-set-stamp">
                    <p class="status-unavailable">{{#flex_icon}}ban{{/flex_icon}}{{unavailable_coursesets}}</p>
                </div>
            {{/unavailable_coursesets}}
        </div>
    </div>
</li>

