{{!
    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": "#"
    }
}}

<a id="top"></a>
<div class="clearfix">
    <div class="float-start">
        <h2>{{{policy.name}}}</h2>
    </div>
    {{# numpolicy }}
        <div class="float-end">
            {{# str }} steppolicies, tool_policy,
                { "numpolicy": {{# quote }}{{numpolicy}}{{/quote }}, "totalpolicies": {{# quote }}{{totalpolicies}}{{/ quote }} }
            {{/ str }}
        </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-primary">{{#str}} next {{/str}}</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">{{#str}} edit {{/str}}</a>
    {{/editurl}}
    {{#accepturl}}
        <a role="button" href="{{accepturl}}" class="btn btn-primary">{{#str}} iagree, tool_policy, {{{policy.name}}} {{/str}}</a>
    {{/accepturl}}
    {{#declineurl}}
        <a role="button" href="{{declineurl}}" class="btn btn-link">{{#str}} idontagree, tool_policy, {{{policy.name}}} {{/str}}</a>
    {{/declineurl}}

    <div class="float-end">
        <a href="#top">
            {{# str }} backtotop, tool_policy {{/ str }}
            <i class="icon text-primary fa fa-caret-up" title="{{# str }} backtotop, tool_policy {{/ str }}" ></i>
        </a>
    </div>
</div>
