{{!
    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 koperedashboard_pages/menu_edit

    Example context (json):
    {
        "actionurl": "http://moodlesite/..."
    }
}}

{{!
    @template koperedashboard_pages/menu_edit
}}
<div class="kopere_dashboard-card kopere_dashboard-pages-form">
    {{#haserror}}
        <div class="alert alert-danger">{{{error}}}</div>
    {{/haserror}}

    <form method="post" action="{{{actionurl}}}">
        <input type="hidden" name="sesskey" value="{{{sesskey}}}">
        <input type="hidden" id="id" name="id" value="{{{id}}}">

        <div class="form-group">
            <label for="title">{{#str}}field_title, koperedashboard_pages{{/str}}</label>
            <input type="text" class="form-control" id="title" name="title" value="{{{title}}}" required>
        </div>

        <div class="form-group">
            <label for="link">{{#str}}field_link, koperedashboard_pages{{/str}}</label>
            <input type="text" class="form-control" id="link" name="link" value="{{{link}}}" required>
            <small class="form-text text-muted">{{#str}}field_link_help, koperedashboard_pages{{/str}}</small>
        </div>

        <div class="form-group">
            <label for="menuid">{{#str}}field_parent_menu, koperedashboard_pages{{/str}}</label>
            <select class="form-control" id="menuid" name="menuid">
                {{#menuoptions}}
                    <option value="{{{key}}}" {{#selected}}selected{{/selected}}>{{{value}}}</option>
                {{/menuoptions}}
            </select>
        </div>

        <div class="form-group">
            <label for="icon">{{#str}}field_icon, koperedashboard_pages{{/str}}</label>
            <input type="text" class="form-control" id="icon" name="icon" value="{{{icon}}}" placeholder="article">
            <small class="form-text text-muted">{{#str}}field_icon_help, koperedashboard_pages{{/str}}</small>
        </div>

        <div class="form-check mb-3">
            <input type="checkbox" class="form-check-input" id="inheader" name="inheader" value="1"
                   {{#inheader}}checked{{/inheader}}>
            <label class="form-check-label" for="inheader">{{#str}}field_inheader, koperedashboard_pages{{/str}}</label>
        </div>

        <div class="kopere_dashboard-pages-form-actions">
            <button type="submit" class="btn btn-primary">{{#str}}savechanges{{/str}}</button>
            <a class="btn btn-outline-secondary" href="{{{cancelurl}}}">{{#str}}cancel{{/str}}</a>
        </div>
    </form>
</div>
