{# -*- coding: utf-8 -*-

  This file is part of Invenio.
  Copyright (C) 2023 TU Wien.

  Invenio is free software; you can redistribute it and/or modify it
  under the terms of the MIT License; see LICENSE file for more details.
#}

{# allows to have conversation/record tab #}
{% extends "invenio_requests/community-submission/index.html" %}

{% set title = _("Access request") %}

{% from "invenio_requests/macros/request_header.html" import inclusion_request_header %}

{% block page_body %}
  {%- if not (current_user and current_user.is_authenticated) %}
    <div class=rel-mt-2>
      {{ super.super() }}
    </div>
  {% else %}
    {{ super.super() }}
  {% endif %}
  {%- block request_body %}
    <div class="ui container request-detail-page">

      {%- block request_header %}
        {%- if current_user and current_user.is_authenticated %}
          {# only display the header for the receiver #}
          {%- set back_button_url = url_for("invenio_app_rdm_users.requests") %}
          {{ inclusion_request_header(
        back_button_url=back_button_url,
        back_button_text=_("Back to requests"),
        request=invenio_request,
        accepted=request_is_accepted
      ) }}

        {%- else %}
          <div class="ui grid rel-mt-2">
            <div class="twelve wide column">
              <strong>Access level:</strong>
              {{ invenio_request.payload.permission }}

            </div>
            <div id="request-actions" class="four wide column text-align-right">
            </div>
          </div>
        {%- endif %}

        <div class="ui container rel-mt-2">
          {%- block user_dashboard_body %}
          {%- endblock user_dashboard_body %}
        </div>

        <div class="ui divider"></div>

      {%- endblock request_header %}

      {%- block request_timeline %}
        {{ super() }}
      {%- endblock request_timeline %}

    </div>
  {% endblock request_body %}
{% endblock page_body %}
