From 5ebaa63f6fb5dbf7e20226cc11e1772b016ed72e Mon Sep 17 00:00:00 2001 From: Phin Wolkwitz Date: Fri, 27 Oct 2023 21:49:12 +0200 Subject: [PATCH] Show quota list for all subevents --- .../pretixcontrol/event/new_index.html | 56 ++++++++++--------- src/pretix/control/views/new_dashboard.py | 12 +++- .../static/pretixcontrol/scss/_dashboard.scss | 5 ++ 3 files changed, 46 insertions(+), 27 deletions(-) diff --git a/src/pretix/control/templates/pretixcontrol/event/new_index.html b/src/pretix/control/templates/pretixcontrol/event/new_index.html index 89a551ed53..942b469b07 100644 --- a/src/pretix/control/templates/pretixcontrol/event/new_index.html +++ b/src/pretix/control/templates/pretixcontrol/event/new_index.html @@ -269,7 +269,7 @@

{% trans "Quotas" %}

-
+
@@ -287,33 +287,37 @@ + {% if request.event.has_subevents and not subevent %} {% for s in subevents %} - - - + + + + + {% endfor %} + {% endif %}
- - {{ s.name }}
- - #{{ s.pk }} - -
- {{ s.get_date_from_display }}
- - {{ s.date_from|date:"l" }} - -
- {% for q in s.first_quotas|slice:":3" %} - {% include "pretixcontrol/fragment_quota_box_paid.html" with quota=q %} - {% endfor %} - {% if s.first_quotas|length > 3 %} - - ··· - - {% endif %} -
+ + {{ s.name }}
+ + #{{ s.pk }} + +
+ {{ s.get_date_from_display }}
+ + {{ s.date_from|date:"l" }} + +
+ {% for q in s.first_quotas|slice:":3" %} + {% include "pretixcontrol/fragment_quota_box_paid.html" with quota=q %} + {% endfor %} + {% if s.first_quotas|length > 3 %} + + ··· + + {% endif %} +
diff --git a/src/pretix/control/views/new_dashboard.py b/src/pretix/control/views/new_dashboard.py index e51557149b..44e84c8493 100644 --- a/src/pretix/control/views/new_dashboard.py +++ b/src/pretix/control/views/new_dashboard.py @@ -3,7 +3,8 @@ import datetime from decimal import Decimal import dateutil -from django.db.models import DateTimeField, Max, OuterRef, Q, Subquery, Sum +from django.db.models import DateTimeField, Max, OuterRef, Q, Subquery, Sum, Prefetch, F +from django.db.models.functions import Coalesce from django.urls import reverse from django.utils import formats, timezone from django.utils.timezone import now @@ -93,6 +94,15 @@ class IndexView(EventPermissionRequiredMixin, ChartContainingView, TemplateView) cl.auto_checkin_sales_channels = [sales_channels[channel] for channel in cl.auto_checkin_sales_channels] ctx['checkinlists'] = qs + qs = self.request.event.subevents + if list: + qs = qs.prefetch_related( + Prefetch('quotas', + queryset=self.request.event.quotas.annotate(s=Coalesce(F('size'), 0)).order_by('-s'), + to_attr='first_quotas') + ) + ctx['subevents'] = qs + tickc = opqs.filter( order__event=self.request.event, item__admission=True, order__status__in=(Order.STATUS_PAID, Order.STATUS_PENDING), diff --git a/src/pretix/static/pretixcontrol/scss/_dashboard.scss b/src/pretix/static/pretixcontrol/scss/_dashboard.scss index 51c26baf4e..e09ea3f1f8 100644 --- a/src/pretix/static/pretixcontrol/scss/_dashboard.scss +++ b/src/pretix/static/pretixcontrol/scss/_dashboard.scss @@ -121,6 +121,11 @@ } } +.table-quotas { + max-height: 250px; + overflow: auto; +} + .widget-container.widget-container-event { padding: 0; cursor: pointer;