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

  This file is part of Invenio.
  Copyright (C) 2016-2025 CERN.

  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.
#}

{% extends "invenio_requests/details/index.html" %}

{% set active_dashboard_menu_item = 'requests' %}
{% set active_community_header_menu_item = 'requests' %}

{%- block request_header %}
    {% set back_button_url = url_for("invenio_app_rdm_users.requests") %}
  {% from "invenio_requests/macros/request_header.html" import inclusion_request_header %}
  {{ inclusion_request_header(
      request=invenio_request,
      record=record,
      accepted=request_is_accepted,
      back_button_url=back_button_url,
      back_button_text=_("Back to requests")
    ) }}

    <div class="twelve wide column mt-10">
      <p><strong>{{ _("Reason:") }}</strong> {{ invenio_request["payload"]["reason_label"] }}</p>
      {%- if invenio_request["payload"]["comment"] %}
        <p><strong>{{ _("Justification:") }}</strong> {{ invenio_request["payload"]["comment"] }}</p>
      {%- endif %}
    </div>
{%- endblock request_header %}

{% block request_timeline %}
  <div
    class="ui container rdm-tab-container fluid rel-pt-2 ml-0-mobile mr-0-mobile"
    id="request-request-deletion-tab-container"
  >
    <div
      class="ui secondary pointing menu rdm-tab-menu"
      id="request-deletion-request-tab"
    >
      <a
        class="active item"
        data-tab="conversation"
        role="tab"
        aria-selected="true"
        aria-controls="conversation-tab-panel"
        id="conversation-tab"
      >
        {{ _("Conversation") }}
      </a>

      {% if record_ui %}
        <a
          role="tab"
          class="item"
          data-tab="record"
          aria-selected="false"
          aria-controls="record-tab-panel"
          id="record-tab"
        >
          {{ _("Record") }}
        </a>
      {% endif %}
    </div>

    <div
      class="ui bottom attached tab segment active borderless p-0"
      data-tab="conversation"
      role="tabpanel"
      aria-labelledby="conversation-tab"
      id="conversation-tab-panel"
    >
      {{ super() }}
    </div>

    {# The record tab content needs to be last since the HTML structure is complex and breaks following tab contents #}
    {% if record_ui %}
      <div
        class="ui bottom attached tab segment borderless"
        data-tab="record"
        role="tabpanel"
        aria-labelledby="record-tab"
        id="record-tab-panel"
        hidden="hidden"
      >
        {% set use_theme_basic_template = false %}
        {% set preview_submission_request = true %}
        {% include config.APP_RDM_RECORD_LANDING_PAGE_TEMPLATE %}
      </div>
    {% endif %}

  </div>
{% endblock request_timeline %}
