{% extends "base.html" %}
{% comment %}
SPDX-License-Identifier: GPL-3.0-or-later
{% endcomment %}
{% load i18n crispy_forms_tags %}

{% block content %}
    <div class="card bg-light">
        <div class="card-header text-center">
            <h4>{% trans "Delete invoice" %}</h4>
        </div>
        {% if object.locked %}
            <div class="card-body">
            <div class="alert alert-danger">
                {% blocktrans %}This invoice is locked and can't be deleted.{% endblocktrans %}
            </div>
            </div>
        {% else %}
            <div class="card-body">
                <div class="alert alert-warning">
                    {% blocktrans %}Are you sure you want to delete this invoice? This action can't be undone.{% endblocktrans %}
                </div>
            </div>
        {% endif %}
        <div class="card-footer text-center">
            <form method="post">
                {% csrf_token %}
                <a class="btn btn-primary" href="{% url 'treasury:invoice_list' %}">{% trans "Return to invoices list" %}</a>
                {% if not object.locked %}
                    <button class="btn btn-danger" type="submit">{% trans "Delete" %}</button>
                {% endif %}
            </form>
        </div>
    </div>
{% endblock %}
