Allow customers to change to a different product variation (#1719)

This commit is contained in:
Raphael Michel
2020-07-20 16:36:24 +02:00
committed by GitHub
parent c8ef825de5
commit e7b9c49620
17 changed files with 952 additions and 132 deletions

View File

@@ -312,92 +312,110 @@
{% endif %}
<div class="clearfix"></div>
</div>
{% if order.cancel_allowed and order.user_cancel_allowed %}
{% if order.user_change_allowed or order.user_cancel_allowed %}
<div class="panel panel-primary panel-cancellation">
<div class="panel-heading">
<h3 class="panel-title">
{% trans "Cancellation" context "action" %}
{% trans "Change or cancel your order" context "action" %}
</h3>
</div>
<div class="panel-body">
{% if order.status == "p" and order.total != 0 %}
{% if order.user_cancel_fee >= order.total %}
<ul class="list-group">
{% if order.user_change_allowed %}
<li class="list-group-item">
<p>
{% if request.event.settings.cancel_allow_user_paid_require_approval %}
{% blocktrans trimmed %}
You can request to cancel this order, but you will not receive a refund.
{% endblocktrans %}
{% else %}
{% blocktrans trimmed %}
You can cancel this order, but you will not receive a refund.
{% endblocktrans %}
{% endif %}
{% trans "This will invalidate all tickets in this order." %}
{% blocktrans trimmed %}
If you want to make changes to the products you bought, you can click on the button to change your order.
{% endblocktrans %}
</p>
{% elif order.user_cancel_fee %}
<p>
{% if request.event.settings.cancel_allow_user_paid_require_approval %}
{% blocktrans trimmed with fee=order.user_cancel_fee|money:request.event.currency %}
You can request to cancel this order. If your request is approved, a cancellation
fee of <strong>{{ fee }}</strong> will be kept and you will receive a refund of
the remainder.
{% endblocktrans %}
{% else %}
{% blocktrans trimmed with fee=order.user_cancel_fee|money:request.event.currency %}
You can cancel this order. In this case, a cancellation fee of <strong>{{ fee }}</strong>
will be kept and you will receive a refund of the remainder.
{% endblocktrans %}
{% endif %}
{% if request.event.settings.cancel_allow_user_paid_refund_as_giftcard == "force" %}
{% trans "The refund will be issued in form of a gift card that you can use for further purchases." %}
{% elif request.event.settings.cancel_allow_user_paid_refund_as_giftcard == "option" %}
{% trans "The refund can be issued to your original payment method or as a gift card." %}
{% else %}
{% trans "The refund will be issued to your original payment method." %}
{% endif %}
{% trans "This will invalidate all tickets in this order." %}
</p>
{% else %}
<p>
{% if request.event.settings.cancel_allow_user_paid_require_approval %}
{% blocktrans trimmed %}
You can request to cancel this order. If your request is approved, you get a full
refund.
{% endblocktrans %}
{% else %}
{% blocktrans trimmed %}
You can cancel this order and receive a full refund.
{% endblocktrans %}
{% endif %}
{% if request.event.settings.cancel_allow_user_paid_refund_as_giftcard == "force" %}
{% trans "The refund will be issued in form of a gift card that you can use for further purchases." %}
{% elif request.event.settings.cancel_allow_user_paid_refund_as_giftcard == "option" %}
{% trans "The refund can be issued to your original payment method or as a gift card." %}
{% else %}
{% trans "The refund will be issued to your original payment method." %}
{% endif %}
{% trans "This will invalidate all tickets in this order." %}
</p>
{% endif %}
<a href="{% eventurl event 'presale:event.order.cancel' secret=order.secret order=order.code %}"
class="btn btn-danger">
<span class="fa fa-remove"></span>
{% trans "Cancel order" %}
</a>
{% else %}
<p>
{% blocktrans trimmed %}
You can cancel this order using the following button.
{% endblocktrans %}
{% trans "This will invalidate all tickets in this order." %}
</p>
<a href="{% eventurl event 'presale:event.order.cancel' secret=order.secret order=order.code %}"
class="btn btn-danger">
<span class="fa fa-remove"></span>
{% trans "Cancel order" %}
</a>
<a href="{% eventurl event 'presale:event.order.change' secret=order.secret order=order.code %}"
class="btn btn-default">
<span class="fa fa-edit"></span>
{% trans "Change order" %}
</a>
</li>
{% endif %}
</div>
{% if order.user_cancel_allowed %}
<li class="list-group-item">
{% if order.status == "p" and order.total != 0 %}
{% if order.user_cancel_fee >= order.total %}
<p>
{% if request.event.settings.cancel_allow_user_paid_require_approval %}
{% blocktrans trimmed %}
You can request to cancel this order, but you will not receive a refund.
{% endblocktrans %}
{% else %}
{% blocktrans trimmed %}
You can cancel this order, but you will not receive a refund.
{% endblocktrans %}
{% endif %}
{% trans "This will invalidate all tickets in this order." %}
</p>
{% elif order.user_cancel_fee %}
<p>
{% if request.event.settings.cancel_allow_user_paid_require_approval %}
{% blocktrans trimmed with fee=order.user_cancel_fee|money:request.event.currency %}
You can request to cancel this order. If your request is approved, a cancellation
fee of <strong>{{ fee }}</strong> will be kept and you will receive a refund of
the remainder.
{% endblocktrans %}
{% else %}
{% blocktrans trimmed with fee=order.user_cancel_fee|money:request.event.currency %}
You can cancel this order. In this case, a cancellation fee of <strong>{{ fee }}</strong>
will be kept and you will receive a refund of the remainder.
{% endblocktrans %}
{% endif %}
{% if request.event.settings.cancel_allow_user_paid_refund_as_giftcard == "force" %}
{% trans "The refund will be issued in form of a gift card that you can use for further purchases." %}
{% elif request.event.settings.cancel_allow_user_paid_refund_as_giftcard == "option" %}
{% trans "The refund can be issued to your original payment method or as a gift card." %}
{% else %}
{% trans "The refund will be issued to your original payment method." %}
{% endif %}
{% trans "This will invalidate all tickets in this order." %}
</p>
{% else %}
<p>
{% if request.event.settings.cancel_allow_user_paid_require_approval %}
{% blocktrans trimmed %}
You can request to cancel this order. If your request is approved, you get a full
refund.
{% endblocktrans %}
{% else %}
{% blocktrans trimmed %}
You can cancel this order and receive a full refund.
{% endblocktrans %}
{% endif %}
{% if request.event.settings.cancel_allow_user_paid_refund_as_giftcard == "force" %}
{% trans "The refund will be issued in form of a gift card that you can use for further purchases." %}
{% elif request.event.settings.cancel_allow_user_paid_refund_as_giftcard == "option" %}
{% trans "The refund can be issued to your original payment method or as a gift card." %}
{% else %}
{% trans "The refund will be issued to your original payment method." %}
{% endif %}
{% trans "This will invalidate all tickets in this order." %}
</p>
{% endif %}
<a href="{% eventurl event 'presale:event.order.cancel' secret=order.secret order=order.code %}"
class="btn btn-danger">
<span class="fa fa-remove"></span>
{% trans "Cancel order" %}
</a>
{% else %}
<p>
{% blocktrans trimmed %}
You can cancel this order using the following button.
{% endblocktrans %}
{% trans "This will invalidate all tickets in this order." %}
</p>
<a href="{% eventurl event 'presale:event.order.cancel' secret=order.secret order=order.code %}"
class="btn btn-danger">
<span class="fa fa-remove"></span>
{% trans "Cancel order" %}
</a>
{% endif %}
</li>
{% endif %}
</ul>
</div>
{% endif %}
{% endblock %}

View File

@@ -0,0 +1,80 @@
{% extends "pretixpresale/event/base.html" %}
{% load i18n %}
{% load bootstrap3 %}
{% load rich_text %}
{% block title %}{% trans "Modify order" %}{% endblock %}
{% block content %}
<h2>
{% blocktrans trimmed with code=order.code %}
Change order: {{ code }}
{% endblocktrans %}
</h2>
<form method="post" href="">
{% csrf_token %}
{% for position, positions in formgroups.items %}
<div class="panel panel-default items">
<div class="panel-heading">
<h3 class="panel-title">
<strong>{{ position.item }}</strong>
{% if position.variation %}
{{ position.variation }}
{% endif %}
</h3>
</div>
<div class="panel-body">
<div class="form-order-change form-horizontal">
{% if position.subevent %}
<div class="form-group">
<label class="col-md-3 control-label">
{% trans "Date" context "subevent" %}
</label>
<div class="col-md-9 form-control-text">
<ul class="addon-list">
{{ pos.subevent.name }} &middot; {{ pos.subevent.get_date_range_display }}
{% if pos.event.settings.show_times %}
<span class="fa fa-clock-o"></span>
{{ pos.subevent.date_from|date:"TIME_FORMAT" }}
{% endif %}
</ul>
</div>
</div>
{% endif %}
{% for p in positions %}
{% if p.pk != position.pk %}
{# Add-Ons #}
<legend>+ {{ p.item.name }}{% if p.variation %} {{ p.variation.value }}{% endif %}</legend>
{% endif %}
{% if p.attendee_name %}
<div class="form-group">
<label class="col-md-3 control-label">
{% trans "Attendee name" %}
</label>
<div class="col-md-9 form-control-text">
{{ p.attendee_name }}
</div>
</div>
{% endif %}
{% bootstrap_form p.form layout="checkout" %}
{% endfor %}
</div>
</div>
</div>
{% endfor %}
<div class="row checkout-button-row">
<div class="col-md-4">
<a class="btn btn-block btn-default btn-lg"
href="{{ view.get_order_url }}">
{% trans "Cancel" %}
</a>
</div>
<div class="col-md-4 col-md-offset-4">
<button class="btn btn-block btn-primary btn-lg" type="submit">
{% trans "Save changes" %}
</button>
</div>
<div class="clearfix"></div>
</div>
</form>
{% endblock %}