{#
## This file is part of Zenodo.
## Copyright (C) 2015, 2016 CERN.
##
## Zenodo 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.
##
## Zenodo 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 Zenodo. If not, see <http://www.gnu.org/licenses/>.
##
## In applying this licence, CERN does not waive the privileges and immunities
## granted to it by virtue of its status as an Intergovernmental Organization
## or submit itself to any jurisdiction.
#}

{%- extends config.ACCESSREQUESTS_SETTINGS_TEMPLATE %}

{%- block settings_content %}
{%- from "zenodo_accessrequests/_macro.html" import render_field with context %}
<div class="panel-group panel-bot-margin">
  <div class="panel panel-default">
    <div class="panel-heading">
      <i class="fa fa-edit fa-fw"></i>
      <strong>{{ _('Pending access request') }}</strong>
    </div>
    <div class="panel-body">
      <div class="row">
        <div class="col-md-6">
          <legend>Record</legend>
          <p><a href="{{ url_for('invenio_records_ui.recid', pid_value=accessrequest.recid) }}">{{ record['title'] }}</a> {% if "doi" in record %}<small class="text-muted">(DOI: {{record["doi"] }})</small>{% endif %}</p>

          {% if record.get('access_conditions') %}
            <h5>Conditions</h5>
            <p>{{ record["access_conditions"]|safe }}</p>
          {% endif %}
        </div>

        <div class="col-md-6">
          <legend>Decision</legend>
          <form action="." method="POST" role="form">
            {{form.csrf_token}}
            {{render_field(form.message)}}
            {{render_field(form.expires_at)}}

            <div class="center-block">
              {{form.accept(class_="btn btn-default")}}
              {{form.reject(class_="btn btn-default")}}
            </div>
          </form>
        </div>
      </div>
      <div class="row">
        <div class="col-md-12">
          <br />
          <div class="well">
            <legend>Request</legend>
            <dl>
              <dt>Full name</dt>
              <dd>{{accessrequest.sender_full_name}}</dd>
              <dt>Email address</dt>
              <dd><a href="mailto:{{accessrequest.sender_email}}">{{accessrequest.sender_email}}</a></dd>
              <dt>Jusitification</dt>
              <dd>{{accessrequest.justification|nl2br}}</dd>
            </dl>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
{% endblock %}

