{{!
    This file is part of Moodle - https://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 local_treestudyplan/cfg-grades

    Template for rendering configuration page for grades and scales.

    Classes required for JS:
    * float

    Data attributes required for JS:
    * none

    Context variables required for this template:
    * none

    Example context (json):
    {
        "scales": [
            {
                "id": 1,
                "title": "Scale name",
                "options": [
                    {
                        "title": "Scale value",
                        "value": 1,
                        "disabled": false,
                        "selected": true
                    }
                ]
            }
        ],
        "grades": [
            {
                "points": 100,
                "threshold": 55
            }
        ]
    }
}}
<div class="local_treestudyplan_cfg_grades">
    <form method="post">
        <input name="action" value="update" type="hidden">
        <h2>{{#str}} cfg_grades_desc_head, local_treestudyplan {{/str}}</h2>
        <p>{{#str}} cfg_grades_desc, local_treestudyplan {{/str}}</p>
        <h2>{{#str}} cfg_grades_scales, local_treestudyplan {{/str}}</h2>
        <div class="flexible-wrap"><div class="table-responsive">
            <table class="generaltable m-roomtable">
            <thead>
                <tr>
                    <th class="header c0" scope="col">{{#str}} scale, core {{/str}}</th>
                    <th class="header c1 lastcol" scope="col">{{#str}} min_completed, local_treestudyplan {{/str}}</th>
                </tr>
            </thead>
            <tbody>
            {{#scales}}
                <tr>
                    <td class="cell c0">{{name}}</td>
                    <td class="cell c1 lastcol">
                        <select name="s_{{id}}_min_completed" autocomplete="off">
                            {{#options}}
                            <option value="{{value}}"
                                    {{#disabled}} disabled {{/disabled}}
                                    {{#selected}} selected {{/selected}}
                            >{{title}}</option>
                            {{/options}}
                        </select>
                    </td>
                </tr>
            {{/scales}}
            </tbody>
            </table>
        </div></div>
        <h2>{{#str}} cfg_grades_grades, local_treestudyplan {{/str}}</h2>
        <div class="flexible-wrap"><div class="table-responsive">
            <table class="generaltable m-roomtable">
            <thead>
                <tr>
                    <th class="header c0">{{#str}} grade_points, local_treestudyplan {{/str}}</th>
                    <th class="header c1">{{#str}} min_completed, local_treestudyplan {{/str}}</th>
                    <th class="header c2 lastcol">{{#str}} delete, core {{/str}}</th>
                </tr>
            </thead>
            <tbody>
                {{#grades}}
                <tr>
                    <td class="cell c0">{{points}}</td>
                    <td class="cell c1">
                        <input  class="float"
                                autocomplete="off"
                                type="text"
                                name="g_{{points}}_min_completed"
                                value="{{threshold}}">
                    </td>
                    <td class="cell c2 lastcol">
                        <input name="g_{{points}}_delete" type="checkbox">
                    </td>
                </tr>
                {{/grades}}
                <tr class="lastrow">
                    <td class="cell c0">
                        <input name="g_new_gradepoints" value="" type="text" class="float" autocomplete="off">
                    </td>
                    <td class="cell c1 lastcol" colspan="2">
                        <input name="g_new_min_completed" value="" type="text" class="float" autocomplete="off">
                    </td>
                </tr>
            </tbody>
            </table>
        </div></div>
        <input value="{{#str}} save, core {{/str}}" type="submit" class="btn btn-primary">
    </form>
</div>