Add waiting list

This commit is contained in:
Raphael Michel
2016-03-31 19:00:41 +02:00
parent 8f5849a90c
commit c83f539bba
29 changed files with 1216 additions and 26 deletions

View File

@@ -84,6 +84,12 @@
{% trans "Export" %}
</a>
</li>
<li>
<a href="{% url 'control:event.orders.waitinglist' organizer=request.event.organizer.slug event=request.event.slug %}"
{% if url_name == "event.orders.waitinglist" %}class="active"{% endif %}>
{% trans "Waiting list" %}
</a>
</li>
</ul>
</li>
{% endif %}

View File

@@ -99,6 +99,20 @@
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" href="#waiting_list">
<strong>{% trans "Waiting list notification" %}</strong>
</a>
</h4>
</div>
<div id="waiting_list" class="panel-collapse collapse">
<div class="panel-body">
{% bootstrap_field form.mail_text_waiting_list layout="horizontal" %}
</div>
</div>
</div>
</div>
</fieldset>
<fieldset>

View File

@@ -42,6 +42,12 @@
{% bootstrap_field sform.attendee_names_required layout="horizontal" %}
{% bootstrap_field sform.cancel_allow_user layout="horizontal" %}
</fieldset>
<fieldset>
<legend>{% trans "Waiting list" %}</legend>
{% bootstrap_field sform.waiting_list_enabled layout="horizontal" %}
{% bootstrap_field sform.waiting_list_auto layout="horizontal" %}
{% bootstrap_field sform.waiting_list_hours layout="horizontal" %}
</fieldset>
<div class="form-group submit-group">
<button type="submit" class="btn btn-primary btn-save">
{% trans "Save" %}

View File

@@ -0,0 +1,145 @@
{% extends "pretixcontrol/event/base.html" %}
{% load i18n %}
{% load eventurl %}
{% load urlreplace %}
{% block title %}{% trans "Waiting list" %}{% endblock %}
{% block content %}
<h1>{% trans "Waiting list" %}</h1>
{% if not request.event.settings.waiting_list_enabled %}
<div class="alert alert-danger">
{% trans "The waiting list is disabled, so if the event is sold out, people cannot add themselves to this list. If you want to enable it, go to the event settings." %}
</div>
{% endif %}
<div class="row">
{% if request.eventperm.can_change_orders %}
<form method="post" class="col-md-6"
action="{% url "control:event.orders.waitinglist.auto" event=request.event.slug organizer=request.organizer.slug %}"
data-asynctask>
<div class="panel panel-default">
<div class="panel-heading">
{% trans "Send vouchers" %}
</div>
<div class="panel-body">
{% csrf_token %}
{% if request.event.settings.waiting_list_auto %}
<p>
{% blocktrans trimmed %}
You have configured that vouchers will automatically be sent to the persons on this list who waited
the longest as soon as capacity becomes available. It might take up to half an hour for the
vouchers to be sent after the capacity is available, so don't worry if entries do not disappear
here immediately. If you want, you can also send them out manually right now.
{% endblocktrans %}
</p>
{% else %}
<p>
{% blocktrans trimmed %}
You have configured that vouchers will <strong>not</strong> be sent automatically.
You can either send them one-by-one in an order of your choice by clicking the
buttons next to a line in this table (if sufficient quota is available) or you can
press the big button below this text to send out as many vouchers as currently
possible to the persons who waitet longest.
{% endblocktrans %}
</p>
{% endif %}
<button class="btn btn-large btn-primary" type="submit">
{% trans "Send as many vouchers as possible" %}
</button>
</div>
</div>
</form>
{% endif %}
<div class="{% if request.eventperm.can_change_orders %}col-md-6{% else %}col-md-12{% endif %}">
<div class="panel panel-default">
<div class="panel-heading">
{% trans "Sales estimate" %}
</div>
<div class="panel-body">
{% blocktrans trimmed with amount=estimate|floatformat:2 currency=request.event.currency %}
If you can make enough room at your event to fit all the persons on the waiting list in, you
could sell tickets worth an additional <strong>{{ amount }} {{ currency }}</strong>.
{% endblocktrans %}
</div>
</div>
</div>
</div>
<p>
<form class="form-inline helper-display-inline" action="" method="get">
<select name="status" class="form-control">
<option value="a"
{% if request.GET.status == "p" %}selected="selected"{% endif %}>{% trans "All entries" %}</option>
<option value="w"
{% if request.GET.status == "w" or not request.GET.status %}selected="selected"{% endif %}>{% trans "Waiting" %}</option>
<option value="s"
{% if request.GET.status == "s" %}selected="selected"{% endif %}>{% trans "Voucher assigned" %}</option>
</select>
<select name="item" class="form-control">
<option value="">{% trans "All products" %}</option>
{% for item in items %}
<option value="{{ item.id }}"
{% if request.GET.item|add:0 == item.id %}selected="selected"{% endif %}>
{{ item.name }}
</option>
{% endfor %}
</select>
<button class="btn btn-primary" type="submit">{% trans "Filter" %}</button>
</form>
</p>
<form method="post" action="">
{% csrf_token %}
<div class="table-responsive">
<table class="table table-condensed table-hover">
<thead>
<tr>
<th>{% trans "User" %}</th>
<th>{% trans "Product" %}</th>
<th>{% trans "On the list since" %}</th>
<th>{% trans "Status" %}</th>
<th>{% trans "Voucher" %}</th>
</tr>
</thead>
<tbody>
{% for e in entries %}
<tr>
<td>{{ e.email }}</td>
<td>
{{ e.item }}
{% if e.variation %}
{{ e.variation }}
{% endif %}
</td>
<td>{{ e.created|date:"SHORT_DATETIME_FORMAT" }}</td>
<td>
{% if e.voucher %}
<span class="label label-success">{% trans "Voucher assigned" %}</span>
{% elif e.availability.0 == 100 %}
<span class="label label-warning">
{% blocktrans with num=e.availability.1 %}
Waiting, product {{ num }}x available
{% endblocktrans %}
</span>
{% else %}
<span class="label label-danger">{% trans "Waiting, product unavailable" %}</span>
{% endif %}
</td>
<td>
{% if e.voucher %}
<a href="{% url "control:event.voucher" organizer=request.event.organizer.slug event=request.event.slug voucher=e.voucher.pk %}">
{{ e.voucher }}
</a>
{% elif not e.voucher and e.availability.0 == 100 %}
<button name="assign" value="{{ e.pk }}" class="btn btn-default btn-xs">
{% trans "Send a voucher" %}
</button>
{% endif %}
</td>
<td class="text-right">
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</form>
{% include "pretixcontrol/pagination.html" %}
{% endblock %}