{{!
    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 report_customsql/category_query

    Moodle template for the list of valid options in an autocomplate form element.

    Classes required for JS:
    * none

    Data attributes required for JS:
    * none

    Context variables required for this template:
    * displayname string Display name.
    * url string Url to the query.
    * timenote string to say if there are identity fields to show.
    * capability string Capability text.

    Example context (json):
    {
      "displayname": "Query 1",
      "url": "http://example.com/report/customsql/view.php?id=1",
      "canedit": true,
      "timenote": "<span class='admin_note'>This query was last run on Monday, 30 August 2021, 5:30 PM.</span>",
      "capability": "Only administrators (moodle/site:config)",
      "editbutton": {
        "url": "http://example.com/report/customsql/edit.php?id=1",
        "img": "Edit button img"
       },
       "deletebutton": {
         "url": "http://example.com/green/report/customsql/delete.php?id=1",
         "img": "Delete button img"
       }
    }
}}

<p>
    <a href="{{url}}">{{{displayname}}}</a> {{{timenote}}}
    {{#canedit}}
        <span class="admin_note">{{#str}}availableto, report_customsql, {{capability}} {{/str}}</span>
        {{#editbutton}}
            <a href="{{url}}" title="{{#str}}editreportx, report_customsql, {{displayname}}{{/str}}">
                {{{img}}}
            </a>
        {{/editbutton}}
        {{#deletebutton}}
            <a href="{{url}}" title="{{#str}}deletereportx, report_customsql, {{{displayname}}}{{/str}}">
                {{{img}}}
            </a>
        {{/deletebutton}}
    {{/ canedit }}
</p>
