forked from CGM_Public/pretix_original
Widget: Support for seated waiting list
This commit is contained in:
@@ -243,6 +243,7 @@ class WidgetAPIProductList(EventListMixin, View):
|
||||
voucher=self.voucher,
|
||||
channel=self.request.sales_channel.identifier,
|
||||
base_qs=qs,
|
||||
require_seat=None,
|
||||
memberships=(
|
||||
self.request.customer.usable_memberships(
|
||||
for_event=self.subevent or self.request.event,
|
||||
@@ -252,7 +253,7 @@ class WidgetAPIProductList(EventListMixin, View):
|
||||
)
|
||||
|
||||
grps = []
|
||||
for cat, g in item_group_by_category(items):
|
||||
for cat, g in item_group_by_category([i for i in items if not i.requires_seat]):
|
||||
grps.append({
|
||||
'id': cat.pk if cat else None,
|
||||
'name': str(cat.name) if cat else None,
|
||||
@@ -312,7 +313,7 @@ class WidgetAPIProductList(EventListMixin, View):
|
||||
} for item in g
|
||||
]
|
||||
})
|
||||
return grps, display_add_to_cart, len(items)
|
||||
return grps, display_add_to_cart, len(items), items
|
||||
|
||||
def post_process(self, data):
|
||||
data['poweredby'] = get_powered_by(self.request, safelink=False)
|
||||
@@ -711,14 +712,30 @@ class WidgetAPIProductList(EventListMixin, View):
|
||||
fail = True
|
||||
|
||||
if not fail and (ev.presale_is_running or request.event.settings.show_items_outside_presale_period):
|
||||
data['items_by_category'], data['display_add_to_cart'], data['itemnum'] = self._get_items()
|
||||
data['items_by_category'], data['display_add_to_cart'], data['itemnum'], items = self._get_items()
|
||||
data['display_add_to_cart'] = data['display_add_to_cart'] and ev.presale_is_running
|
||||
else:
|
||||
items = []
|
||||
data['items_by_category'] = []
|
||||
data['display_add_to_cart'] = False
|
||||
data['itemnum'] = 0
|
||||
|
||||
data['has_seating_plan'] = ev.seating_plan is not None
|
||||
data['has_seating_plan_waitinglist'] = False
|
||||
if request.event.settings.waiting_list_enabled and ev.presale_is_running:
|
||||
for i in items:
|
||||
if not i.allow_waitinglist or not i.requires_seat:
|
||||
continue
|
||||
|
||||
if i.has_variations:
|
||||
for v in i.available_variations:
|
||||
if v.cached_availability[0] != Quota.AVAILABILITY_OK:
|
||||
data['has_seating_plan_waitinglist'] = True
|
||||
break
|
||||
else:
|
||||
if i.cached_availability[0] != Quota.AVAILABILITY_OK:
|
||||
data['has_seating_plan_waitinglist'] = True
|
||||
break
|
||||
|
||||
vouchers_exist = self.request.event.get_cache().get('vouchers_exist')
|
||||
if vouchers_exist is None:
|
||||
|
||||
@@ -53,6 +53,7 @@ var strings = {
|
||||
'next_week': django.pgettext('widget', 'Next week'),
|
||||
'previous_week': django.pgettext('widget', 'Previous week'),
|
||||
'show_seating': django.pgettext('widget', 'Open seat selection'),
|
||||
'seating_plan_waiting_list': django.pgettext('widget', 'Some or all ticket categories are currently sold out. If you want, you can add yourself to the waiting list. We will then notify if seats are available again.'),
|
||||
'load_more': django.pgettext('widget', 'Load more'),
|
||||
'days': {
|
||||
'MO': django.gettext('Mo'),
|
||||
@@ -793,6 +794,17 @@ Vue.component('pretix-widget-event-form', {
|
||||
+ strings['show_seating']
|
||||
+ '</button>'
|
||||
+ '</div>'
|
||||
+ '<div class="pretix-widget-seating-waitinglist" v-if="this.$root.has_seating_plan && this.$root.has_seating_plan_waitinglist">'
|
||||
+ '<div class="pretix-widget-seating-waitinglist-text">'
|
||||
+ strings['seating_plan_waiting_list']
|
||||
+ '</div>'
|
||||
+ '<div class="pretix-widget-seating-waitinglist-button-wrap">'
|
||||
+ '<button class="pretix-widget-seating-waitinglist-button" @click.prevent.stop="$root.startseating">'
|
||||
+ strings['waiting_list']
|
||||
+ '</button>'
|
||||
+ '</div>'
|
||||
+ '<div class="pretix-widget-clear"></div>'
|
||||
+ '</div>'
|
||||
+ '<category v-for="category in this.$root.categories" :category="category" :key="category.id"></category>'
|
||||
+ '<div class="pretix-widget-action" v-if="$root.display_add_to_cart">'
|
||||
+ '<button @click="$parent.buy" type="submit" :disabled="buy_disabled">{{ this.buy_label }}</button>'
|
||||
@@ -812,6 +824,7 @@ Vue.component('pretix-widget-event-form', {
|
||||
+ '<div class="pretix-widget-voucher-button-wrap">'
|
||||
+ '<button @click="$parent.redeem">' + strings.redeem + '</button>'
|
||||
+ '</div>'
|
||||
+ '<div class="pretix-widget-clear"></div>'
|
||||
+ '</div>'
|
||||
+ '</form>'
|
||||
+ '</div>'
|
||||
@@ -1472,6 +1485,7 @@ var shared_root_methods = {
|
||||
root.cart_exists = data.cart_exists;
|
||||
root.vouchers_exist = data.vouchers_exist;
|
||||
root.has_seating_plan = data.has_seating_plan;
|
||||
root.has_seating_plan_waitinglist = data.has_seating_plan_waitinglist;
|
||||
root.itemnum = data.itemnum;
|
||||
}
|
||||
root.poweredby = data.poweredby;
|
||||
@@ -1479,7 +1493,7 @@ var shared_root_methods = {
|
||||
root.loading--;
|
||||
root.trigger_load_callback();
|
||||
}
|
||||
if (root.parent_stack.length > 0 && root.has_seating_plan && root.categories.length === 0 && !root.frame_dismissed && root.useIframe && !root.error) {
|
||||
if (root.parent_stack.length > 0 && root.has_seating_plan && root.categories.length === 0 && !root.frame_dismissed && root.useIframe && !root.error && !root.has_seating_plan_waitinglist) {
|
||||
// If we're on desktop and someone selects a seating-only event in a calendar, let's open it right away,
|
||||
// but only if the person didn't close it before.
|
||||
root.startseating()
|
||||
@@ -1727,7 +1741,8 @@ var create_widget = function (element) {
|
||||
itemcount: 0,
|
||||
overlay: null,
|
||||
poweredby: "",
|
||||
has_seating_plan: false
|
||||
has_seating_plan: false,
|
||||
has_seating_plan_waitinglist: false,
|
||||
}
|
||||
},
|
||||
created: function () {
|
||||
|
||||
@@ -331,6 +331,28 @@
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.pretix-widget-seating-waitinglist {
|
||||
margin: 15px 0;
|
||||
}
|
||||
|
||||
.pretix-widget-seating-waitinglist-text {
|
||||
padding: 0 15px;
|
||||
width: 75%;
|
||||
box-sizing: border-box;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.pretix-widget-seating-waitinglist-button-wrap {
|
||||
padding: 0 15px;
|
||||
width: 25%;
|
||||
box-sizing: border-box;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.pretix-widget-seating-waitinglist-button {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.pretix-widget-item-with-picture .pretix-widget-main-item-row .pretix-widget-item-title-and-description {
|
||||
margin-left: 70px;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user