Waiting list: Bulk deletion

This commit is contained in:
Raphael Michel
2021-05-25 22:18:06 +02:00
parent cb42457683
commit 5029213bc5
6 changed files with 179 additions and 61 deletions

View File

@@ -0,0 +1,40 @@
{% extends "pretixcontrol/event/base.html" %}
{% load i18n %}
{% load bootstrap3 %}
{% block title %}{% trans "Delete entries" %}{% endblock %}
{% block content %}
<h1>{% trans "Delete entries" %}</h1>
<form action="" method="post" class="form-horizontal">
{% csrf_token %}
{% if allowed %}
<p>{% blocktrans %}Are you sure you want to delete the following entries?{% endblocktrans %}</p>
<ul>
{% for s in allowed %}
<li>
{{ s }}
<input type="hidden" name="entry" value="{{ s.pk }}">
</li>
{% endfor %}
</ul>
{% endif %}
{% if forbidden %}
<p>{% blocktrans trimmed %}The following entries can't be deleted as they already have a voucher attached.{% endblocktrans %}</p>
<ul>
{% for s in forbidden %}
<li>
{{ s }}
<input type="hidden" name="entry" value="{{ s.pk }}">
</li>
{% endfor %}
</ul>
{% endif %}
<div class="form-group submit-group">
<a href="{% url "control:event.orders.waitinglist" organizer=request.event.organizer.slug event=request.event.slug %}" class="btn btn-default btn-cancel">
{% trans "Cancel" %}
</a>
<button type="submit" class="btn btn-danger btn-save" value="delete_confirm" name="action">
{% trans "Delete" %}
</button>
</div>
</form>
{% endblock %}

View File

@@ -126,12 +126,20 @@
{% trans "Download list" %}</a>
</form>
</p>
<form method="post" action="?next={{ request.get_full_path|urlencode }}">
<form action="{% url "control:event.orders.waitinglist.action" organizer=request.event.organizer.slug event=request.event.slug %}?next={{ request.get_full_path|urlencode }}" method="post">
{% csrf_token %}
<input name="subevent" type="hidden" value="{{ request.GET.subevent }}">
<input name="item" type="hidden" value="{{ request.GET.item }}">
<input name="status" type="hidden" value="{{ request.GET.status }}">
<div class="table-responsive">
<table class="table table-condensed table-hover">
<thead>
<tr>
<th>
{% if "can_change_orders" in request.eventpermset %}
<label aria-label="{% trans "select all rows for batch-operation" %}" class="batch-select-label"><input type="checkbox" data-toggle-table/></label>
{% endif %}
</th>
{% if request.event.settings.waiting_list_names_asked %}
<th>{% trans "Name" %}</th>
{% endif %}
@@ -148,10 +156,27 @@
<th>{% trans "Voucher" %}</th>
<th></th>
</tr>
{% if "can_change_orders" in request.eventpermset and page_obj.paginator.num_pages > 1 %}
<tr class="table-select-all warning hidden">
<td>
<input type="checkbox" name="__ALL" id="__all" data-results-total="{{ page_obj.paginator.count }}">
</td>
<td colspan="5">
<label for="__all">
{% trans "Select all results on other pages as well" %}
</label>
</td>
</tr>
{% endif %}
</thead>
<tbody>
{% for e in entries %}
<tr>
<td>
{% if "can_change_orders" in request.eventpermset %}
<label aria-label="{% trans "select row for batch-operation" %}" class="batch-select-label"><input type="checkbox" name="entry" class="batch-select-checkbox" value="{{ s.pk }}"/></label>
{% endif %}
</td>
{% if request.event.settings.waiting_list_names_asked %}
<td>{{ e.name|default:"" }}</td>
{% endif %}
@@ -233,6 +258,13 @@
</tbody>
</table>
</div>
{% if "can_change_orders" in request.eventpermset %}
<div class="batch-select-actions">
<button type="submit" class="btn btn-danger btn-save" name="action" value="delete">
<i class="fa fa-trash"></i>{% trans "Delete selected" %}
</button>
</div>
{% endif %}
</form>
{% include "pretixcontrol/pagination.html" %}
{% endblock %}