Add global order search

This commit is contained in:
Raphael Michel
2017-06-05 20:50:06 +02:00
parent 513f8e66f5
commit a02823ca38
7 changed files with 281 additions and 1 deletions

View File

@@ -189,6 +189,13 @@
{% trans "Organizers" %}
</a>
</li>
<li>
<a href="{% url 'control:search.orders' %}"
{% if url_name == "search.orders" %}class="active"{% endif %}>
<i class="fa fa-search fa-fw"></i>
{% trans "Order search" %}
</a>
</li>
{% for nav in nav_global %}
<li>
<a href="{{ nav.url }}" {% if nav.active %}class="active"{% endif %}

View File

@@ -0,0 +1,68 @@
{% extends "pretixcontrol/base.html" %}
{% load i18n %}
{% load eventurl %}
{% load urlreplace %}
{% block title %}{% trans "Order search" %}{% endblock %}
{% block content %}
<h1>{% trans "Order search" %}</h1>
<form class="form-inline" action="" method="get">
<div class="input-group search-line">
<input type="text" name="query" class="form-control" placeholder="{% trans "Search for..." %}"
value="{{ request.GET.query }}" autofocus>
<span class="input-group-btn">
<button class="btn btn-primary" type="submit">{% trans "Search" %}</button>
</span>
</div>
</form>
<div class="table-responsive">
<table class="table table-condensed table-hover">
<thead>
<tr>
<th>{% trans "Order code" %}
<a href="?{% url_replace request 'ordering' '-code' %}"><i class="fa fa-caret-down"></i></a>
<a href="?{% url_replace request 'ordering' 'code' %}"><i class="fa fa-caret-up"></i></a></th>
<th>{% trans "Event" %}
<a href="?{% url_replace request 'ordering' '-event' %}"><i class="fa fa-caret-down"></i></a>
<a href="?{% url_replace request 'ordering' 'event' %}"><i class="fa fa-caret-up"></i></a></th>
<th>{% trans "User" %}
<a href="?{% url_replace request 'ordering' '-email' %}"><i class="fa fa-caret-down"></i></a>
<a href="?{% url_replace request 'ordering' 'email' %}"><i class="fa fa-caret-up"></i></a></th>
<th>{% trans "Order total" %}
<a href="?{% url_replace request 'ordering' '-total' %}"><i class="fa fa-caret-down"></i></a>
<a href="?{% url_replace request 'ordering' 'total' %}"><i class="fa fa-caret-up"></i></a></th>
<th>{% trans "Order date" %}
<a href="?{% url_replace request 'ordering' '-datetime' %}"><i class="fa fa-caret-down"></i></a>
<a href="?{% url_replace request 'ordering' 'datetime' %}"><i class="fa fa-caret-up"></i></a></th>
<th>{% trans "Status" %}
<a href="?{% url_replace request 'ordering' '-status' %}"><i class="fa fa-caret-down"></i></a>
<a href="?{% url_replace request 'ordering' 'status' %}"><i class="fa fa-caret-up"></i></a></th>
</tr>
</thead>
<tbody>
{% for o in orders %}
<tr>
<td>
<strong>
<a href="{% url "control:event.order" event=o.event.slug organizer=o.event.organizer.slug code=o.code %}">
{{ o.event.slug|upper }}-{{ o.code }}
</a>
</strong>
</td>
<td>{{ o.event.name }}</td>
<td>{{ o.email }}</td>
<td>{{ o.total|floatformat:2 }} {{ o.event.currency }}</td>
<td>{{ o.datetime|date:"SHORT_DATETIME_FORMAT" }}</td>
<td>{% include "pretixcontrol/orders/fragment_order_status.html" with order=o %}</td>
</tr>
{% empty %}
<tr>
<td colspan="6" class="text-center"><em>
{% trans "We couldn't find any orders that you have access to and that match your search query." %}
</em></td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% include "pretixcontrol/pagination.html" %}
{% endblock %}