Introduce cancellation requests (#1627)

* Allow to adjust the cancellation fee without JS

* Introduce cancellation requests

* ignore→delete

* Change a few things after Martin's review

* Add a few tests
This commit is contained in:
Raphael Michel
2020-03-25 14:13:55 +01:00
committed by GitHub
parent 173a23722a
commit 8a6334bd86
24 changed files with 352 additions and 33 deletions

View File

@@ -15,6 +15,7 @@
<fieldset>
<legend>{% trans "Paid orders" %}</legend>
{% bootstrap_field form.cancel_allow_user_paid layout="control" %}
{% bootstrap_field form.cancel_allow_user_paid_require_approval layout="control" %}
{% bootstrap_field form.cancel_allow_user_paid_keep layout="control" %}
{% bootstrap_field form.cancel_allow_user_paid_keep_percentage layout="control" %}
{% bootstrap_field form.cancel_allow_user_paid_keep_fees layout="control" %}

View File

@@ -34,6 +34,15 @@
class="btn btn-primary">{% trans "Show pending refunds" %}</a>
</div>
{% endif %}
{% if has_cancellation_requests %}
<div class="alert alert-warning">
{% blocktrans trimmed %}
This event contains <strong>requested cancellations</strong> that you should take care of.
{% endblocktrans %}
<a href="{% url "control:event.orders" event=request.event.slug organizer=request.event.organizer.slug %}?status=rc"
class="btn btn-primary">{% trans "Show orders requesting cancellation" %}</a>
</div>
{% endif %}
{% if has_pending_approvals %}
<div class="alert alert-warning">
{% blocktrans trimmed %}

View File

@@ -0,0 +1,32 @@
{% extends "pretixcontrol/event/base.html" %}
{% load i18n %}
{% block title %}
{% trans "Ignore cancellation request" %}
{% endblock %}
{% block content %}
<h1>
{% trans "Ignore cancellation request" %}
</h1>
<p>{% blocktrans trimmed %}
Do you really want to remove this cancellation request? The user will not be informed automatically, but you
will have the option to email them individually in the next step.
{% endblocktrans %}</p>
<form method="post" href="">
{% csrf_token %}
<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, delete request" %}
</button>
</div>
<div class="clearfix"></div>
</div>
</form>
{% endblock %}

View File

@@ -112,6 +112,40 @@
<div class="row">
<div class="col-xs-12 col-lg-10">
{% for cr in order.cancellation_requests.all %}
<div class="panel panel-warning items">
<div class="panel-heading">
<h3 class="panel-title">
{% trans "Cancellation request" %}
</h3>
</div>
<div class="panel-body">
{% trans "The customer asked you to cancel the order with the following settings:" %}
<dl class="dl-horizontal">
<dt>{% trans "Refund method" %}</dt>
<dd>
{% if cr.refund_as_giftcard %}
{% trans "Gift card" %}
{% else %}
{% trans "Original payment method" %}
{% endif %}
</dd>
<dt>{% trans "Cancellation fee" %}</dt>
<dd>{{ cr.cancellation_fee|money:request.event.currency }}</dd>
</dl>
<div class="text-right">
<a href="{% url "control:event.order.cancellationrequests.delete" event=request.event.slug organizer=request.event.organizer.slug code=order.code req=cr.pk %}"
class="btn btn-default btn-lg" data-toggle="tooltip">
{% trans "Delete request" %}
</a>
<a href="{% url "control:event.order.transition" event=request.event.slug organizer=request.event.organizer.slug code=order.code %}?status=c&req={{ cr.pk }}" class="btn btn-primary btn-lg">
{% trans "Cancel order" %}
</a>
</div>
</div>
</div>
{% endfor %}
<div class="panel panel-primary items">
<div class="panel-heading">
<h3 class="panel-title">

View File

@@ -94,7 +94,7 @@
<td>
<div class="input-group">
<input type="text" name="refund-new-giftcard"
title="" class="form-control" value="{{ 0|floatformat:2 }}">
title="" class="form-control" value="{{ giftcard_proposal|floatformat:2 }}">
<span class="input-group-addon">
{{ request.event.currency }}
</span>

View File

@@ -128,6 +128,9 @@
</td>
<td>{{ o.datetime|date:"SHORT_DATETIME_FORMAT" }}</td>
<td class="text-right flip">
{% if o.has_cancellation_request %}
<span class="label label-warning">{% trans "CANCELLATION REQUESTED" %}</span>
{% endif %}
{% if o.has_external_refund or o.has_pending_refund %}
<span class="label label-danger">{% trans "REFUND PENDING" %}</span>
{% elif o.has_pending_refund %}