Added filtering to the voucher list

This commit is contained in:
Raphael Michel
2016-07-30 13:56:43 +02:00
parent b7ad2cdc39
commit 650f2412c2
3 changed files with 51 additions and 10 deletions

View File

@@ -0,0 +1,16 @@
{% extends "pretixcontrol/event/base.html" %}
{% load i18n %}
{% load bootstrap3 %}
{% block title %}{% trans "Vouchers" %}{% endblock %}
{% block content %}
<h1>{% trans "Vouchers" %}</h1>
<ul class="nav nav-pills">
<li {% if "event.vouchers" == url_name %}class="active"{% endif %}>
<a href="{% url 'control:event.vouchers' organizer=request.event.organizer.slug event=request.event.slug %}">
{% trans "All Vouchers" %}
</a>
</li>
</ul>
{% block inside %}
{% endblock %}
{% endblock %}

View File

@@ -1,20 +1,38 @@
{% extends "pretixcontrol/items/base.html" %}
{% extends "pretixcontrol/vouchers/base.html" %}
{% load i18n %}
{% block title %}{% trans "Vouchers" %}{% endblock %}
{% block inside %}
<h1>{% trans "Vouchers" %}</h1>
<p>
{% blocktrans trimmed %}
Vouchers allow you to assign tickets to specific persons for a lower price. They also enable you to
reserve some quota for your very special guests.
{% endblocktrans %}
</p>
<form class="form-inline helper-display-inline" action="" method="get">
<p>
<input type="text" name="search" class="form-control" placeholder="{% trans "Search voucher" %}"
value="{{ request.GET.search }}">
<input type="text" name="tag" class="form-control" placeholder="{% trans "Filter by tag" %}"
value="{{ request.GET.tag }}">
<select name="status" class="form-control">
<option value="">{% trans "All vouchers" %}</option>
<option value="v" {% if request.GET.status == "v" %}selected="selected"{% endif %}>{% trans "Valid" %}</option>
<option value="r" {% if request.GET.status == "r" %}selected="selected"{% endif %}>{% trans "Redeemd" %}</option>
<option value="e" {% if request.GET.status == "e" %}selected="selected"{% endif %}>{% trans "Expired" %}</option>
</select>
<button class="btn btn-primary" type="submit">{% trans "Filter" %}</button>
</p>
</form>
{% if vouchers|length == 0 %}
<div class="empty-collection">
<p>
{% blocktrans trimmed %}
You haven't created any vouchers yet.
{% endblocktrans %}
{% if request.GET.search or request.GET.tag or request.GET.status %}
{% trans "Your search did not match any vouchers." %}
{% else %}
{% blocktrans trimmed %}
You haven't created any vouchers yet.
{% endblocktrans %}
{% endif %}
</p>
<a href="{% url "control:event.vouchers.add" organizer=request.event.organizer.slug event=request.event.slug %}"
@@ -30,11 +48,6 @@
class="btn btn-default"><i class="fa fa-plus"></i>
{% trans "Create multiple new vouchers" %}</a>
</p>
<form class="form-inline helper-display-inline" action="" method="get">
<input type="text" name="search" class="form-control" placeholder="{% trans "Search voucher" %}"
value="{{ request.GET.search }}">
<button class="btn btn-primary" type="submit">{% trans "Filter" %}</button>
</form>
<div class="table-responsive">
<table class="table table-hover table-quotas">
<thead>