Added voucher tag statistics

This commit is contained in:
Raphael Michel
2016-07-30 15:41:59 +02:00
parent 650f2412c2
commit 168288e98a
5 changed files with 84 additions and 3 deletions

View File

@@ -10,6 +10,11 @@
{% trans "All Vouchers" %}
</a>
</li>
<li {% if "event.vouchers.tags" == url_name %}class="active"{% endif %}>
<a href="{% url 'control:event.vouchers.tags' organizer=request.event.organizer.slug event=request.event.slug %}">
{% trans "Tags" %}
</a>
</li>
</ul>
{% block inside %}
{% endblock %}

View File

@@ -0,0 +1,47 @@
{% extends "pretixcontrol/vouchers/base.html" %}
{% load i18n %}
{% block inside %}
<p>
{% blocktrans trimmed %}
If you add a "tag" to a voucher, you can here see statistics on their usage.
{% endblocktrans %}
</p>
{% if tags|length == 0 %}
<div class="empty-collection">
<p>
{% blocktrans trimmed %}
You haven't added any tags to vouchers yet.
{% endblocktrans %}
</p>
</div>
{% else %}
<div class="table-responsive">
<table class="table table-hover table-condensed">
<thead>
<tr>
<th>{% trans "Tag" %}</th>
<th>{% trans "Redeemed vouchers" %}</th>
</tr>
</thead>
<tbody>
{% for t in tags %}
<tr>
<td>
<strong><a
href="{% url "control:event.vouchers" organizer=request.event.organizer.slug event=request.event.slug %}?tag={{ t.tag|urlencode }}">
{{ t.tag }}
</a></strong> <small>({{ t.redeemed }} / {{ t.total }})</small>
</td>
<td>
<div class="progress">
<div class="progress-bar progress-bar-{{ t.percentage }}">
</div>
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endif %}
{% endblock %}