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

{% block scripts %}
    {{ block.super }}
    <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="text-sm max-sm:hidden breadcrumbs">
        <ul>
            <li><a href="{% url 'admin:index' %}" class="link link-hover">{% trans 'Dashboard' %}</a></li>
            {% if has_view_permission %}
                <li><a class="link link-hover"
                       href="{% url opts|admin_urlname:'changelist' %}">{{ opts.verbose_name_plural|capfirst }}</a></li>
            {% else %}
                <li><a class="disabled" href="#">{{ opts.verbose_name_plural|capfirst }}</a></li>
            {% endif %}
            <li>{% if add %}{% blocktranslate with name=opts.verbose_name %}Add {{ name }}{% endblocktranslate %}
            {% else %}{{ object|truncatewords:"18" }}{% endif %}</li>
        </ul>
    </div>
{% endblock %}


{% block content %}
    <div class="card w-full p-5 bg-base-100 max-w-6xl mt-3 delete-confirmation">
        {% if perms_lacking %}
            <p>{% 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>
            <ul class="list list-disc list-inside">
                {% for obj in perms_lacking %}
                    <li class="list-row p-1">{{ obj }}</li>
                {% endfor %}
            </ul>
        {% elif protected %}
            <p>{% blocktranslate with escaped_object=object %}Deleting the {{ object_name }} '{{ escaped_object }}'
                would require deleting the following protected related objects:{% endblocktranslate %}</p>
            <ul class="list list-disc list-inside">
                {% for obj in protected %}
                    <li class="list-row p-1">{{ obj }}</li>
                {% endfor %}
            </ul>
        {% else %}
            <div role="alert" class="alert alert-error alert-soft">
                <p>{% 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>
            </div>
            <div class="object-delete-summary mt-3">
                {% include "admin/includes/object_delete_summary.html" %}
            </div>
            <div class="delete-related-objects mt-3">
                <h2 class="font-bold">{% translate "Objects" %}:</h2>
                <ul class="list list-disc list-inside">{{ deleted_objects|unordered_list }}</ul>
                <form method="post" class="mt-4">
                    {% csrf_token %}
                    <div class="flex justify-end space-x-4">
                        <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 %}
                        <button class="btn btn-soft btn-error" type="submit">{% translate 'Yes, I’m sure' %}</button>
                        <a href="#" class="btn btn-soft btn-default cancel-link">{% translate "No, take me back" %}</a>
                    </div>
                </form>
            </div>
        {% endif %}
    </div>
{% endblock %}
