rework backoffice part 1; ticket checkin and badge handout views still need some work

This commit is contained in:
Thomas Steen Rasmussen 2017-12-12 21:57:17 +01:00
parent 0806ff138e
commit 8595377066
12 changed files with 161 additions and 13 deletions

View file

@ -3,18 +3,31 @@
{% load static from staticfiles %}
{% load imageutils %}
{% block content %}
<div class="row">
<h2>BornHack Backoffice</h2>
<div class="lead">
Please select your desired action below.
Welcome to the promised land! Please select your desired action below:
</div>
</div>
<div class="row">
<p>
<ul>
<li><a href="{% url 'backoffice:infodesk_index' %}">Infodesk</a></li>
</ul>
</p>
<div class="list-group">
<a href="{% url 'backoffice:product_handout' %}" class="list-group-item">
<h4 class="list-group-item-heading">Hand Out Products</h4>
<p class="list-group-item-text">Use this view to mark products such as merchandise, cabins, fridges and so on as handed out.</p>
</a>
<a href="{% url 'backoffice:ticket_checkin' %}" class="list-group-item">
<h4 class="list-group-item-heading">Check-In Tickets</h4>
<p class="list-group-item-text">Use this view to check-in tickets when participants arrive.</p>
</a>
<a href="{% url 'backoffice:badge_handout' %}" class="list-group-item">
<h4 class="list-group-item-heading">Hand Out Badges</h4>
<p class="list-group-item-text">Use this view to mark badges as handed out.</p>
</a>
</div>
</div>
{% endblock content %}

View file

@ -0,0 +1,52 @@
{% extends 'base.html' %}
{% load commonmark %}
{% load static from staticfiles %}
{% load imageutils %}
{% block extra_head %}
<script src="{% static "js/jquery.dataTables.min.js" %}"></script>
<link rel="stylesheet" href="{% static 'css/jquery.dataTables.min.css' %}">
{% endblock extra_head %}
{% block content %}
<div class="row">
<h2>Hand Out Badges</h2>
<div class="lead">
Use this view to hand out badges to participants. Use the search field to search for username, email, products, order ID, ticket UUID, etc. To check in participants go to the <a href="{% url 'backoffice:ticket_checkin' %}">Ticket Checkin view</a> instead. To hand out merchandise and other products go to the <a href="{% url 'backoffice:product_handout' %}">Hand Out Products</a> view instead.
</div>
<div>
This table shows all (Shop|Discount|Sponsor)Tickets which are badge_handed_out=False. Tickets must be checked in before they are shown in this list.
</div>
</div>
<br>
<div class="row">
<table class="table table-hover">
<thead>
<tr>
<th>Ticket</th>
<th>User</th>
<th>Email</th>
<th>Name</th>
<th>Product</th>
</tr>
</thead>
<tbody>
{% for ticket in tickets %}
<tr>
<td>{{ ticket.uuid }}</td>
<td>{{ ticket.order.user }}</td>
<td>{{ ticket.order.user.email }}</td>
<td>{{ ticket.name }}</td>
<td>{{ ticket.email }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<script>
$(document).ready(function(){
$('.table').DataTable();
});
</script>
{% endblock content %}

View file

@ -8,21 +8,25 @@
{% endblock extra_head %}
{% block content %}
<div class="row">
<h2>Infodesk Backoffice</h2>
<h2>Hand Out Products</h2>
<div class="lead">
Paid (and not later refunded) orders with at least one product that is not yet handed out
Use this view to hand out products to participants. Use the search field to search for username, email, products, order ID etc. To check in participants go to the <a href="{% url 'backoffice:ticket_checkin' %}">Ticket Checkin view</a> instead. To hand out badges go to the <a href="{% url 'backoffice:badge_handout' %}">Badge Handout view</a> instead.
</div>
<div>
This table shows all OrderProductRelations which are handed_out=False (not including unpaid, cancelled and refunded orders). The table is initally sorted by order ID but the sorting can be changed by clicking the column headlines (if javascript is enabled).
</div>
</div>
<br>
<div class="row">
<table class="table table-hover">
<thead>
<tr>
<th>Order</th>
<th>User</th>
<th>Email</th>
<th>OPR Id</th>
<th>Product</th>
<th>Quantity</th>
<th>Handed Out?</th>
</tr>
</thead>
<tbody>
@ -30,10 +34,10 @@
<tr>
<td><a href="/admin/shop/order/{{ productrel.order.id }}/change/">Order #{{ productrel.order.id }}</a></td>
<td>{{ productrel.order.user }}</td>
<td>{{ productrel.order.user.email }}</td>
<td>{{ productrel.id }}</td>
<td>{{ productrel.product.name }}</td>
<td>{{ productrel.quantity }}</td>
<td>{{ productrel.handed_out }}</td>
</tr>
{% endfor %}
</tbody>

View file

@ -0,0 +1,52 @@
{% extends 'base.html' %}
{% load commonmark %}
{% load static from staticfiles %}
{% load imageutils %}
{% block extra_head %}
<script src="{% static "js/jquery.dataTables.min.js" %}"></script>
<link rel="stylesheet" href="{% static 'css/jquery.dataTables.min.css' %}">
{% endblock extra_head %}
{% block content %}
<div class="row">
<h2>Ticket Check-In</h2>
<div class="lead">
Use this view to check in participants. Use the search field to search for username, email, products, order ID, ticket UUID, etc. To hand out badges go to the <a href="{% url 'backoffice:badge_handout' %}">Badge Handout view</a> instead. To hand out other products go to the <a href="{% url 'backoffice:product_handout' %}">Hand Out Products</a> view instead.
</div>
<div>
This table shows all (Shop|Discount|Sponsor)Tickets which are checked_in=False.
</div>
</div>
<br>
<div class="row">
<table class="table table-hover">
<thead>
<tr>
<th>Ticket</th>
<th>User</th>
<th>Email</th>
<th>Name</th>
<th>Product</th>
</tr>
</thead>
<tbody>
{% for ticket in tickets %}
<p>{{ ticket }}
<tr>
<td><a href="/admin/tickets/{{ ticket }}/{{ ticket.uuid }}/change/">{{ ticket }}</a></td>
<td>{{ ticket.order.user }}</td>
<td>{{ ticket.order.user.email }}</td>
<td>{{ ticket.name }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<script>
$(document).ready(function(){
$('.table').DataTable();
});
</script>
{% endblock content %}

View file

@ -3,6 +3,8 @@ from .views import *
urlpatterns = [
url(r'^$', BackofficeIndexView.as_view(), name='index'),
url(r'infodesk/$', InfodeskView.as_view(), name='infodesk_index'),
url(r'product_handout/$', ProductHandoutView.as_view(), name='product_handout'),
url(r'badge_handout/$', BadgeHandoutView.as_view(), name='badge_handout'),
url(r'ticket_checkin/$', TicketCheckinView.as_view(), name='ticket_checkin'),
]

View file

@ -5,6 +5,8 @@ from django.conf import settings
from django.utils.decorators import method_decorator
from django.http import HttpResponseForbidden
from shop.models import OrderProductRelation
from tickets.models import ShopTicket, SponsorTicket, DiscountTicket
from itertools import chain
import logging
logger = logging.getLogger("bornhack.%s" % __name__)
@ -20,7 +22,29 @@ class BackofficeIndexView(StaffMemberRequiredMixin, TemplateView):
template_name = "backoffice_index.html"
class InfodeskView(StaffMemberRequiredMixin, ListView):
template_name = "infodesk.html"
class ProductHandoutView(StaffMemberRequiredMixin, ListView):
template_name = "product_handout.html"
queryset = OrderProductRelation.objects.filter(handed_out=False, order__paid=True, order__refunded=False, order__cancelled=False).order_by('order')
class BadgeHandoutView(StaffMemberRequiredMixin, ListView):
template_name = "badge_handout.html"
context_object_name = 'tickets'
def get_queryset(self, **kwargs):
shoptickets = ShopTicket.objects.filter(badge_handed_out=False)
sponsortickets = SponsorTicket.objects.filter(badge_handed_out=False)
discounttickets = DiscountTicket.objects.filter(badge_handed_out=False)
return list(chain(shoptickets, sponsortickets, discounttickets))
class TicketCheckinView(StaffMemberRequiredMixin, ListView):
template_name = "ticket_checkin.html"
context_object_name = 'tickets'
def get_queryset(self, **kwargs):
shoptickets = ShopTicket.objects.filter(checked_in=False)
sponsortickets = SponsorTicket.objects.filter(checked_in=False)
discounttickets = DiscountTicket.objects.filter(checked_in=False)
return list(chain(shoptickets, sponsortickets, discounttickets))

Binary file not shown.

After

Width:  |  Height:  |  Size: 160 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 201 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 B

View file

@ -89,6 +89,7 @@ class DiscountTicket(BaseTicket):
def shortname(self):
return "discount"
class ShopTicket(BaseTicket):
order = models.ForeignKey('shop.Order', related_name='shoptickets')
product = models.ForeignKey('shop.Product')