{% extends "admin/base_site.html" %}
{% load i18n admin_urls static %}

{% block extrahead %}
    {{ block.super }}
    {{ media }}
    <script src="{% static 'admin/js/cancel.js' %}" async></script>
{% endblock %}

{% block bodyclass %}{{ block.super }} app-{{ opts.app_label }} model-{{ opts.model_name }} delete-confirmation{% endblock %}

{% block breadcrumbs %}
    <div class="px-4">
        <div class="container mb-6 mx-auto -my-3 lg:mb-12">
            <ul class="flex flex-wrap">
                {% url 'admin:index' as link %}
                {% trans 'Home' as name %}
                {% include 'unfold/helpers/breadcrumb_item.html' with link=link name=name %}

                {% url 'admin:app_list' app_label=opts.app_label as link %}
                {% include 'unfold/helpers/breadcrumb_item.html' with link=link name=opts.app_config.verbose_name %}

                {% url opts|admin_urlname:'changelist' as link %}
                {% include 'unfold/helpers/breadcrumb_item.html' with link=link name=opts.verbose_name_plural|capfirst %}

                {% url opts|admin_urlname:'change' object.pk|admin_urlquote as link %}
                {% include 'unfold/helpers/breadcrumb_item.html' with link='' name=object|truncatewords:"18" %}
            </ul>
        </div>
    </div>
{% endblock %}

{% block content %}
    {% if perms_lacking %}
        <div class="border border-base-200 rounded-default shadow-xs dark:border-base-800">
            <p class="font-semibold p-4 text-font-important-light dark:text-font-important-dark">
                {% blocktranslate with escaped_object=object %}Deleting the {{ object_name }} '{{ escaped_object }}' would result in deleting related objects, but your account doesn't have permission to delete the following types of objects:{% endblocktranslate %}
            </p>

            <div class="border-base-200 border-t p-4 dark:border-base-800">
                <ul class="leading-relaxed">
                    {% for obj in perms_lacking %}
                        <li>
                            {{ obj }}
                        </li>
                    {% endfor %}
                </ul>
            </div>
        </div>
    {% elif protected %}
        <div class="border border-base-200 rounded-default shadow-xs dark:border-base-800">
            <p class="font-semibold p-4 text-font-important-light dark:text-font-important-dark">
                {% blocktranslate with escaped_object=object %}Deleting the {{ object_name }} '{{ escaped_object }}' would require deleting the following protected related objects:{% endblocktranslate %}
            </p>

            <div class="border-t border-base-200  order-t p-4 dark:border-base-800">
                <ul class="leading-relaxed">
                    {% for obj in protected %}
                        <li>
                            {{ obj }}
                        </li>
                    {% endfor %}
                </ul>
            </div>
        </div>
    {% else %}
        <div class="border border-base-200 rounded-default shadow-xs dark:border-base-800">
            <p class="font-semibold p-4 text-font-important-light dark:text-font-important-dark">
                {% blocktranslate with escaped_object=object %}Are you sure you want to delete the {{ object_name }} "{{ escaped_object }}"? All of the following related items will be deleted:{% endblocktranslate %}
            </p>

            {% include "admin/includes/object_delete_summary.html" %}

            <div class="border-base-200 border-t p-4 dark:border-base-800">
                <h2 class="font-semibold mb-2 text-font-important-light dark:text-font-important-dark">
                    {% translate "Objects" %}
                </h2>

                <ul class="leading-relaxed text-sm">
                    {{ deleted_objects|unordered_list }}
                </ul>
            </div>

            <form method="post" class="border-base-200 border-t px-4 py-3 dark:border-base-800">
                {% csrf_token %}

                <div class="flex items-center">
                    <input type="hidden" name="post" value="yes">

                    {% if is_popup %}
                        <input type="hidden" name="{{ is_popup_var }}" value="1">
                    {% endif %}

                    {% if to_field %}
                        <input type="hidden" name="{{ to_field_var }}" value="{{ to_field }}">
                    {% endif %}

                    {% include "unfold/helpers/delete_submit_line.html" %}
                </div>
            </form>
        </div>
    {% endif %}
{% endblock %}
