From 8751e6e5baa6b68b96c3e1727aa7d1ec70154798 Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Fri, 17 Sep 2021 10:20:30 +0200 Subject: [PATCH] Product list: Show "sold out" before expanding variations --- .../event/fragment_product_list.html | 19 +++++++++++++++++++ src/pretix/presale/views/event.py | 1 + .../static/pretixpresale/scss/_event.scss | 4 ++-- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/pretix/presale/templates/pretixpresale/event/fragment_product_list.html b/src/pretix/presale/templates/pretixpresale/event/fragment_product_list.html index 8ebd5f1c71..e08fb1900f 100644 --- a/src/pretix/presale/templates/pretixpresale/event/fragment_product_list.html +++ b/src/pretix/presale/templates/pretixpresale/event/fragment_product_list.html @@ -69,6 +69,25 @@
{% if not event.settings.show_variations_expanded %} + {% if item.best_variation_availability <= 10 %} + {% if not item.min_price %} + {% trans "FULLY BOOKED" %} + {% else %} + {% trans "SOLD OUT" %} + {% endif %} + {% if allow_waitinglist and item.allow_waitinglist %} +
+ {% trans "Waiting list" %} + {% endif %} +
+ {% elif avail < 100 %} + {% trans "Reserved" %} + {% if allow_waitinglist and item.allow_waitinglist %} +
+ {% trans "Waiting list" %} + {% endif %} +
+ {% endif %} {% trans "Show variants" %} diff --git a/src/pretix/presale/views/event.py b/src/pretix/presale/views/event.py index ffd7ab4d01..59719ca577 100644 --- a/src/pretix/presale/views/event.py +++ b/src/pretix/presale/views/event.py @@ -354,6 +354,7 @@ def get_grouped_items(event, subevent=None, voucher=None, channel='web', require v.display_price.gross for v in item.available_variations]) item.max_price = max([v.display_price.net if event.settings.display_net_prices else v.display_price.gross for v in item.available_variations]) + item.best_variation_availability = max([v.cached_availability[0] for v in item.available_variations]) item._remove = not bool(item.available_variations) diff --git a/src/pretix/static/pretixpresale/scss/_event.scss b/src/pretix/static/pretixpresale/scss/_event.scss index 5d706066c9..802e352e47 100644 --- a/src/pretix/static/pretixpresale/scss/_event.scss +++ b/src/pretix/static/pretixpresale/scss/_event.scss @@ -24,10 +24,10 @@ .availability-box { text-align: center; - &.gone { + &.gone, .gone { color: $alert-danger-text; } - &.unavailable { + &.unavailable, .unavailable { color: $alert-warning-text; } }