{{!
    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 tool_policy/page_viewdoc

    Template for viewing a policy version document.

    Classes required for JS:
    -

    Data attributes required for JS:
    -

    Context variables required for this template:
    * policy - version document object.

    Example context (json):
    {
        "numpolicy": 1,
        "totalpolicies": 2,
        "policy": {
            "name": "Terms &amp; conditions",
            "summary": "Policy <u>summary</u>",
            "content": "Policy <em>content</em>"
        },
        "returnurl": "#",
        "editurl": "#",
        "accepturl": "#"
    }
}}
<div class="rui-book-wrapper wrapper-fw">
    <a id="top"></a>
    <div class="clearfix">
        <div class="float-left">
            <h2>{{{policy.name}}}</h2>
        </div>
        {{# numpolicy }}
            <div class="float-right">
                <span class="badge-sq badge-light">
                    <svg class="mr-2" width="20" height="20" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
                        <path d="M12.75 4.75H7.75C6.64543 4.75 5.75 5.64543 5.75 6.75V17.25C5.75 18.3546 6.64543 19.25 7.75 19.25H16.25C17.3546 19.25 18.25 18.3546 18.25 17.25V10.25M12.75 4.75V8.25C12.75 9.35457 13.6454 10.25 14.75 10.25H18.25M12.75 4.75L18.25 10.25" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>
                        <path d="M8.75 15.75H15.25" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>
                        <path d="M8.75 12.75H11.25" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>
                    </svg>
                    {{# str }} steppolicies, tool_policy,
                        { "numpolicy": {{# quote }}{{numpolicy}}{{/quote }}, "totalpolicies": {{# quote }}{{totalpolicies}}{{/ quote }} }
                    {{/ str }}
                </span>
            </div>
        {{/ numpolicy }}
    </div>


    {{# numpolicy }}
        <div class="clearfix mt-2">
            <h3>{{# str }}readpolicy, tool_policy, {{{policy.name}}} {{/ str }}</h3>
        </div>
    {{/ numpolicy }}

    <hr>

    <div class="policy_document mt-1">
        <div class="policy_document_summary clearfix mb-1">
            {{{policy.summary}}}
        </div>
        <div class="policy_document_content mt-2">
            {{{policy.content}}}
        </div>
    </div>

    <hr>

    <div class="policy_buttons">
        {{#returnurl}}
            {{# numpolicy }}
                <a role="button" href="{{returnurl}}" class="btn btn-success">
                    <span class="mr-2">{{#str}} next {{/str}}</span>
                    <svg width="24" height="24" fill="none" viewBox="0 0 24 24">
                        <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M5.75 12.8665L8.33995 16.4138C9.15171 17.5256 10.8179 17.504 11.6006 16.3715L18.25 6.75"></path>
                    </svg>
                </a>
            {{/ numpolicy }}
            {{^ numpolicy }}
                <a role="button" href="{{returnurl}}" class="btn btn-primary">{{#str}} back {{/str}}</a>
            {{/ numpolicy }}
        {{/returnurl}}
        {{#editurl}}
            <a role="button" href="{{editurl}}" class="btn btn-secondary">{{#str}} edit {{/str}}</a>
        {{/editurl}}
        {{#accepturl}}
            <a role="button" href="{{accepturl}}" class="btn btn-success">
                <svg width="24" height="24" fill="none" viewBox="0 0 24 24">
                    <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M5.75 12.8665L8.33995 16.4138C9.15171 17.5256 10.8179 17.504 11.6006 16.3715L18.25 6.75"></path>
                </svg>
                <span class="ml-2">{{#str}} iagree, tool_policy, {{{policy.name}}} {{/str}}</span>
            </a>
        {{/accepturl}}
        {{#declineurl}}
            <a role="button" href="{{declineurl}}" class="btn btn-danger">
                <svg width="24" height="24" fill="none" viewBox="0 0 24 24">
                    <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M17.25 6.75L6.75 17.25"></path>
                    <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M6.75 6.75L17.25 17.25"></path>
                </svg>
                <span class="ml-2">{{#str}} idontagree, tool_policy, {{{policy.name}}} {{/str}}</span>
            </a>
        {{/declineurl}}

        <div class="float-right">
            <a href="#top" class="btn btn-secondary">
                <span class="mr-2">{{# str }} backtotop, tool_policy {{/ str }}</span>
                <svg xmlns="http://www.w3.org/2000/svg"  width="20" height="20" fill="none" viewBox="0 0 24 24">
                    <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17.25 10.25L12 4.75L6.75 10.25"></path>
                    <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 19.25V5.75"></path>
                </svg>
            </a>
        </div>
    </div>
</div>
