{% 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-12">
        <div class="container mb-12 mx-auto -my-3">
            <ul class="flex">
                {% 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 rounded-md shadow-sm dark:border-gray-800">
            <p class="font-medium p-4 text-sm">
                {% 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-t p-4 dark:border-gray-800">
                <ul class="leading-relaxed text-gray-500 text-sm dark:text-gray-400">
                    {% for obj in perms_lacking %}
                        <li>
                            {{ obj }}
                        </li>
                    {% endfor %}
                </ul>
            </div>
        </div>
    {% elif protected %}
        <div class="border rounded-md shadow-sm dark:border-gray-800">
            <p class="font-medium p-4 text-sm">
                {% 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 p-4 dark:border-gray-800">
                <ul class="leading-relaxed text-gray-500 text-sm dark:text-gray-400">
                    {% for obj in protected %}
                        <li>
                            {{ obj }}
                        </li>
                    {% endfor %}
                </ul>
            </div>
        </div>
    {% else %}
        <div class="border rounded-md shadow-sm dark:border-gray-800">
            <p class="font-medium p-4 text-sm">
                {% 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-t p-4 dark:border-gray-800">
                <h2 class="font-medium mb-2 text-sm">
                    {% translate "Objects" %}
                </h2>

                <ul class="leading-relaxed text-gray-500 text-sm dark:text-gray-400">
                     {{ deleted_objects|unordered_list }}
                </ul>
            </div>

            <form method="post" class="border-t px-4 py-3 dark:border-gray-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 %}

                    <a href="#" class="button cancel-link text-sm text-gray-500 underline dark:text-gray-400">
                        {% translate "No, take me back" %}
                    </a>

                    <input type="submit" value="{% translate 'Yes, I’m sure' %}" class="bg-red-600 cursor-pointer font-medium ml-auto px-3 py-2 rounded-md text-sm text-white dark:bg-red-500/20 dark:text-red-500">
                </div>
            </form>
        </div>
    {% endif %}
{% endblock %}
