{% extends "pretixcontrol/event/base.html" %}
{% load i18n %}
{% load bootstrap3 %}
{% load money %}
{% block title %}
    {% trans "Cancel order" %}
{% endblock %}
{% block content %}
    <h1>
        {% trans "Cancel order" %}
    </h1>
    <p>{% blocktrans trimmed %}
        Do you really want to cancel this order? You cannot revert this action.
    {% endblocktrans %}</p>
    {% if order.payment_refund_sum > 0 %}
        <p>{% blocktrans trimmed %}
            This will <strong>not</strong> automatically transfer the money back, but you will be offered options to
            refund the payment afterwards.
        {% endblocktrans %}</p>
    {% endif %}

    <form method="post" href="" class="">
        {% csrf_token %}
        <input type="hidden" name="status" value="c"/>
        {% bootstrap_form_errors form %}
        {% if form.cancellation_fee %}
            {% if fee %}
                {% with fee|money:request.event.currency as f %}
                    <p>{% blocktrans trimmed with fee="<strong>"|add:f|add:"</strong>"|safe %}
                        The configured cancellation fee for a self-service cancellation would be {{ fee }} for this
                        order, but for a cancellation performed by you, you need to set the cancellation fee here:
                    {% endblocktrans %}</p>
                {% endwith %}
            {% endif %}
            {% bootstrap_field form.cancellation_fee layout='' %}
        {% endif %}
        {% bootstrap_field form.send_email layout='' %}
        {% bootstrap_field form.comment layout='' %}
        {% if form.cancel_invoice %}
            {% bootstrap_field form.cancel_invoice layout='' %}
        {% endif %}
        <div class="row checkout-button-row">
            <div class="col-md-4">
                <a class="btn btn-block btn-default btn-lg"
                   href="{% url "control:event.order" event=request.event.slug organizer=request.event.organizer.slug code=order.code %}">
                    {% trans "No, take me back" %}
                </a>
            </div>
            <div class="col-md-4 col-md-offset-4">
                <button class="btn btn-block btn-danger btn-lg" type="submit">
                    {% trans "Yes, cancel order" %}
                </button>
            </div>
            <div class="clearfix"></div>
        </div>
    </form>
{% endblock %}
