{% extends 'oscar/dashboard/layout.html' %}
{% load currency_filters %}
{% load i18n %}

{% block body_class %}{{ block.super }} create-page{% endblock %}

{% block title %}
    {% if not voucher.voucher_set %}
    {% blocktrans with name=voucher.name %}Delete voucher '{{ name }}'?{% endblocktrans %} | {% trans "Vouchers" %} | {{ block.super }}
    {% else %}
    {% blocktrans with code=voucher.code %}Delete voucher '{{ code }}'?{% endblocktrans %} | {% trans "Vouchers" %} | {{ block.super }}
    {% endif %}
{% endblock %}

{% block breadcrumbs %}
    <nav aria-label="breadcrumb">
        <ol class="breadcrumb">
            <li class="breadcrumb-item"><a href="{% url 'dashboard:index' %}">{% trans "Dashboard" %}</a></li>
            <li class="breadcrumb-item"><a href="{% url 'dashboard:voucher-list' %}">{% trans "Vouchers" %}</a></li>
            <li class="breadcrumb-item"><a href="{% url 'dashboard:voucher-stats' pk=voucher.pk %}">{{ voucher }}</a></li>
            <li class="breadcrumb-item active" aria-current="page">{% trans "Delete?" %}</li>
        </ol>
    </nav>
{% endblock %}

{% block headertext %}
    {% if not voucher.voucher_set %}
    {% blocktrans with name=voucher.name %}Delete voucher '{{ name }}'?{% endblocktrans %}
    {% else %}
    {% blocktrans with code=voucher.code %}Delete voucher '{{ code }}' from set?{% endblocktrans %}
    {% endif %}
{% endblock %}

{% block dashboard_content %}
    <div class="table-header">
        <h2>{% trans "Voucher details" %}</h2>
    </div>
    <div class="card card-body bg-light">
        {% include "oscar/dashboard/vouchers/partials/voucher_details_table.html" %}
        <form id="delete_voucher_form" method="post">
            {% csrf_token %}
            <div class="form-actions">
                <button class="btn btn-danger" type="submit" data-loading-text="{% trans 'Deleting...' %}">{% trans "Delete" %}</button> {% trans "or" %}
                <a href="{% if not voucher.voucher_set %}{% url 'dashboard:voucher-list' %}{% else %}{% url 'dashboard:voucher-set-detail' pk=voucher.voucher_set.pk %}{% endif %}">{% trans "cancel" %}</a>
            </div>
        </form>
    </div>
{% endblock dashboard_content %}
