{% extends "base.html" %}
{% load i18n %}
{% load crispy_forms_tags %}

{% block content %}
    <div class="card bg-light shadow">
        <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 %}