{% extends "wagtailadmin/admin_base.html" %}
{% load wagtailadmin_tags i18n static %}

{% block titletag %}{{view.get_header_title}}{% endblock %}

{% block extra_css %}
{{ block.super }}
{{ form.media.css }}
<link rel="stylesheet" href="{% static 'wagtail_fedit/css/furniture.css' %}">
<base target="_blank">
{% endblock %}

{% block extra_js %}
<script src="{% versioned_static 'wagtailadmin/js/modal-workflow.js' %}"></script>
{% block page_js %}{% include "wagtailadmin/pages/_editor_js.html" %}{% endblock %}
{{ block.super }}
{{ form.media.js }}
{% endblock %}

{% block furniture %}

    <main class="content-wrapper w-overflow-x-hidden" id="main">
        {% block header %}
            <header id="modal-header">
                <h1 id="modal-title">{{ view.get_header_title }}</h1>
            </header>
        {% endblock %}
        <div class="messages" role="status">
            {# Always show messages div so it can be appended to by JS #}
            {% if messages or form.non_field_errors %}
                <ul>
                    {% if form.non_field_errors %}
                        {% for error in form.non_field_errors %}
                            <li class="error">{{ error }}</li>
                        {% endfor %}
                    {% endif %}
                    {% for message in messages %}
                        <li class="{{ message.tags }}">{{ message }}</li>
                    {% endfor %}
                </ul>
            {% endif %}
        </div>

        <div class="nice-padding">
    
            {% if help_text %}
                {% panel id="wagtail-fedit-help-text" icon="help" heading=help_text.heading %}
                    {% help_block status=help_text.status %}
                        <p><strong>{{ help_text.title }}</strong></p>
                        <p>{{ help_text.text }}</p>
                    {% endhelp_block %}
                {% endpanel %}
            {% endif %}

            {% translate "Locked" as locked_heading %}
            {% if locked and not locked_for_user %}
                {% panel id="wagtail-fedit-lock-text" icon="help" heading=locked_heading %}
                    {% help_block status="info" %}
                        <p>{% translate "This object is locked" %}</p>
                        <p>{% translate "You are still able to edit this object." %}</p>
                    {% endhelp_block %}
                {% endpanel %}
            {% endif %}

            {% if locked_for_user %}
                {% panel id="wagtail-fedit-lock-text" icon="help" heading=locked_heading %}
                    {% help_block status="info" %}
                        <p>{% translate "This object is locked and cannot be edited." %}</p>
                    {% endhelp_block %}
                {% endpanel %}
            {% else %}
            
                {% block content %}

                    

                {% endblock %}
                
            {% endif %}
        </div>
    </main>
    {% block sidebar_root %}
        <aside>
            <div class="fedit-sidebar-logo">
                {% block sidebar_logo %}{% endblock %}
            </div>
            <div class="fedit-sidebar">
                {% block sidebar %}
                    {% if admin_edit_url %}
                        <a href="{{ admin_edit_url }}" class="fedit-menu-item fedit-sidebar-icon" aria-label="{% translate "Edit in Wagtail Admin" %}" target="_blank">
                            {% icon name="link-external" %}
                        </a>
                    {% endif %}
                    <button type="submit" form="wagtail-fedit-form" class="fedit-menu-item fedit-sidebar-icon wagtail-fedit-save-button bottom" aria-label="{% translate "Save" %}">
                        <svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" class="icon" title="{% translate "Save" %}" viewBox="0 0 16 16">
                            <!-- The MIT License (MIT) -->
                            <!-- Copyright (c) 2011-2024 The Bootstrap Authors -->
                            <path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0m-3.97-3.03a.75.75 0 0 0-1.08.022L7.477 9.417 5.384 7.323a.75.75 0 0 0-1.06 1.06L6.97 11.03a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 0 0-.01-1.05z"/>
                        </svg>
                    </button>
                    <button type="button" class="fedit-menu-item fedit-sidebar-icon wagtail-fedit-cancel-button" aria-label="{% translate "Close" %}">
                        <svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" class="icon" title="{% translate "Close" %}" viewBox="0 0 16 16">
                            <!-- The MIT License (MIT) -->
                            <!-- Copyright (c) 2011-2024 The Bootstrap Authors -->
                            <path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0M5.354 4.646a.5.5 0 1 0-.708.708L7.293 8l-2.647 2.646a.5.5 0 0 0 .708.708L8 8.707l2.646 2.647a.5.5 0 0 0 .708-.708L8.707 8l2.647-2.646a.5.5 0 0 0-.708-.708L8 7.293z"/>
                        </svg>
                    </button>
                {% endblock %}
            </div>
        </aside>
    {% endblock %}
{% endblock %}