{{!
    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 mod_data/presets

    Form containing all database presets displayed within a table.

    Context variables required for this template:
    * formactionul - The form action url.
    * d - The database id.
    * presetstable - The HTML output of the table with presets

    Example context (json):
    {
        "formactionul": "http://www.example.com",
        "d": 1,
        "presetstable": "<table></table>"
    }
}}
<form method="post" action="{{formactionul}}" class="mt-4">
    <input type="hidden" name="d" value="{{d}}">
    <input type="hidden" name="mode" value="usepreset">
    <input type="hidden" name="action" value="select">
    {{{presetstable}}}
    <input type="submit" name="selectpreset" value="{{#str}}usepreset, mod_data{{/str}}" class="btn btn-primary mt-2">
</form>
{{#js}}
    require(['mod_data/selectpreset'], function(selectPreset) {
        selectPreset.init();
    });
{{/js}}
