{{!
    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 mod_certificatebeautiful/certificatebeautiful_view-extra

    Example context (json):
    {
      "uniqid": "abc123",
      "url-view": "https://example.com/view_certificate",
      "url-delete": "https://example.com/delete_certificate"
    }
}}
{{#download}}
    <div id="box-link-{{uniqid}}" class="text-nowrap">
        <a href="{{{url-view}}}" target="_blank"
           class="btn btn-success certificatebeautiful-report-btn-small">
            {{#str}}report_view_certificate,certificatebeautiful{{/str}}</a>
        <a href="{{{url-validate}}}" target="_blank"
           class="btn btn-info certificatebeautiful-report-btn-small">
            {{#str}}validate_certificate_validate,certificatebeautiful{{/str}}</a>
        {{#url-delete}}
            <span id="delete-{{uniqid}}"
                  class="btn btn-danger ml-2 certificatebeautiful-report-btn-small">
                {{#str}}report_delete_certificate,certificatebeautiful{{/str}}</span>
        {{/url-delete}}
    </div>

    {{#url-delete}}
        <div id="box-confirm-{{uniqid}}"
             class="alert alert-danger m-0 certificatebeautiful-report-extra-width"
             style="display:none;min-width: 254px;">
            <p class="text-center">{{#str}}report_confirm_delete_certificate,certificatebeautiful{{/str}}</p>
            <p class="text-center text-nowrap">
                <a href="{{{url-delete}}}"
                   class="btn btn-danger certificatebeautiful-report-btn-small">{{#str}}yes{{/str}}</a>
                <a id="cancel-{{uniqid}}" href="{{url-delete}}"
                   class="btn btn-info certificatebeautiful-report-btn-small">{{#str}}cancel{{/str}}</a>
            </p>
        </div>
    {{/url-delete}}
    {{#js}}
        require(["jquery"], function($) {
            $("#delete-{{uniqid}}").click(function() {
                $("#box-confirm-{{uniqid}}").show(200);
                $("#box-link-{{uniqid}}").hide(200);
            });

            $("#cancel-{{uniqid}}").click(function() {
                $("#box-confirm-{{uniqid}}").hide(200);
                $("#box-link-{{uniqid}}").show(200);
            });
        });
    {{/js}}
{{/download}}

{{#create}}
    <div class="text-nowrap">
        <a href="{{{url-create}}}" target="_blank"
           class="btn btn-primary certificatebeautiful-report-btn-small"
           onclick="setTimeout(function(){location.reload()},1000)">
            {{#str}}report_create_certificate,certificatebeautiful{{/str}}</a>
    </div>
{{/create}}
