diff --git a/src/backoffice/templates/index.html b/src/backoffice/templates/index.html index 94e2be04..1a5c46bf 100644 --- a/src/backoffice/templates/index.html +++ b/src/backoffice/templates/index.html @@ -57,6 +57,10 @@

Village Gear To Order

Use this view to generate a list of village gear that needs to be ordered

+ +

Shop Ticket Overview

+

Use this to list shop tickets

+
{% endif %} {% if perms.camps.economyteam_permission %} diff --git a/src/backoffice/templates/shop_ticket_overview.html b/src/backoffice/templates/shop_ticket_overview.html new file mode 100644 index 00000000..4ddeea65 --- /dev/null +++ b/src/backoffice/templates/shop_ticket_overview.html @@ -0,0 +1,39 @@ +{% extends 'base.html' %} +{% load commonmark %} +{% load static from staticfiles %} +{% load imageutils %} +{% block extra_head %} + + +{% endblock extra_head %} +{% block content %} +
+

Shop Tickets

+
+
+ + +
+ + + + + + + + + + + + {% for ticket in shop_tickets %} + + + + + + + {% endfor %} + +
Ticket TypeProductOrder commentPaid?
{{ ticket.ticket_type.name }}{{ ticket.product.name }}{{ ticket.order.comment|default:"None" }}{{ ticket.order.paid }}
+ +{% endblock content %} diff --git a/src/backoffice/urls.py b/src/backoffice/urls.py index dd6fefd5..0bd02423 100644 --- a/src/backoffice/urls.py +++ b/src/backoffice/urls.py @@ -12,6 +12,7 @@ urlpatterns = [ path("", ScanTicketsView.as_view(), name="scan_tickets"), ] )), + path("shop_tickets/", ShopTicketOverview.as_view(), name="shop_ticket_overview"), path("product_handout/", ProductHandoutView.as_view(), name="product_handout"), path("badge_handout/", BadgeHandoutView.as_view(), name="badge_handout"), path("ticket_checkin/", TicketCheckinView.as_view(), name="ticket_checkin"), diff --git a/src/backoffice/views.py b/src/backoffice/views.py index a689a523..ba68b881 100644 --- a/src/backoffice/views.py +++ b/src/backoffice/views.py @@ -1,27 +1,26 @@ -import logging, os +import logging +import os from itertools import chain -import qrcode -from django.contrib.auth.mixins import PermissionRequiredMixin, UserPassesTestMixin, LoginRequiredMixin +from django.conf import settings +from django.contrib import messages +from django.contrib.auth.mixins import LoginRequiredMixin from django.contrib.auth.models import User -from django.views.generic import TemplateView, ListView, DetailView -from django.views.generic.edit import CreateView, UpdateView, DeleteView +from django.core.files import File +from django.db.models import Sum from django.shortcuts import redirect, get_object_or_404 from django.urls import reverse -from django.contrib import messages from django.utils import timezone -from django.db.models import Sum -from django.conf import settings -from django.core.files import File +from django.views.generic import TemplateView, ListView, DetailView +from django.views.generic.edit import CreateView, UpdateView, DeleteView from camps.mixins import CampViewMixin -from shop.models import OrderProductRelation, Invoice, Order -from tickets.models import ShopTicket, SponsorTicket, DiscountTicket +from economy.models import Chain, Credebtor, Expense, Reimbursement, Revenue from profiles.models import Profile from program.models import SpeakerProposal, EventProposal -from economy.models import Chain, Credebtor, Expense, Reimbursement, Revenue -from utils.mixins import RaisePermissionRequiredMixin +from shop.models import OrderProductRelation, Order from teams.models import Team +from tickets.models import ShopTicket, SponsorTicket, DiscountTicket, TicketType from .mixins import * logger = logging.getLogger("bornhack.%s" % __name__) @@ -633,3 +632,17 @@ class ScanTicketsView(LoginRequiredMixin, InfoTeamPermissionMixin, CampViewMixin order = Order.objects.get(id=request.POST.get('mark_as_paid')) order.mark_as_paid() messages.success(request, "Order #{} has been marked as paid!".format(order.id)) + + +class ShopTicketOverview(LoginRequiredMixin, CampViewMixin, ListView): + + model = ShopTicket + + template_name = "shop_ticket_overview.html" + + context_object_name = "shop_tickets" + + def get_context_data(self, *, object_list=None, **kwargs): + kwargs['ticket_types'] = TicketType.objects.filter(camp=self.camp) + return super().get_context_data(object_list=object_list, **kwargs) + diff --git a/src/tickets/models.py b/src/tickets/models.py index 5580cda3..08a0bdbc 100644 --- a/src/tickets/models.py +++ b/src/tickets/models.py @@ -56,10 +56,13 @@ class BaseTicket(CampRelatedModel, UUIDModel): class Meta: abstract = True + camp_filter = 'ticket_type__camp' + @property def camp(self): return self.ticket_type.camp + def save(self, **kwargs): self.token = self._get_token() self.badge_token = self._get_badge_token()