mirror of
https://github.com/pretix/pretix.git
synced 2026-05-09 15:54:03 +00:00
Added option to show remaining quota to users
This commit is contained in:
@@ -5,9 +5,9 @@
|
||||
</div>
|
||||
{% elif avail < 100 %}
|
||||
<div class="col-md-2 col-xs-6 availability-box unavailable">
|
||||
<strong>{% trans "Unavailable" %}</strong><br />
|
||||
<strong>{% trans "Reserved" %}</strong><br />
|
||||
<small>
|
||||
{% trans "This item is currently unavailable but might become available again." %}
|
||||
{% trans "All remaining products are reserved but might become available again." %}
|
||||
</small>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
{% load i18n %}
|
||||
{% if avail.0 > 0 and avail.1 != None %}
|
||||
<p><small>
|
||||
{% blocktrans trimmed with num=avail.1 %}
|
||||
{{ num }} currently available
|
||||
{% endblocktrans %}
|
||||
</small></p>
|
||||
{% endif %}
|
||||
@@ -96,6 +96,9 @@
|
||||
<div class="row-fluid product-row variation">
|
||||
<div class="col-md-8 col-xs-12">
|
||||
{{ var }}
|
||||
{% if event.settings.show_quota_left %}
|
||||
{% include "pretixpresale/event/fragment_quota_left.html" with avail=var.cached_availability %}
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="col-md-2 col-xs-6 price">
|
||||
{{ event.currency }} {{ var.price|floatformat:2 }}
|
||||
@@ -109,7 +112,7 @@
|
||||
{% if var.cached_availability.0 == 100 %}
|
||||
<div class="col-md-2 col-xs-6 availability-box available">
|
||||
<input type="number" class="form-control input-item-count" placeholder="0" min="0"
|
||||
max="{{ var.cached_availability.1 }}"
|
||||
max="{{ var.order_max }}"
|
||||
name="variation_{{ item.id }}_{{ var.id }}">
|
||||
</div>
|
||||
{% else %}
|
||||
@@ -132,7 +135,10 @@
|
||||
</a>
|
||||
{% endif %}
|
||||
<strong>{{ item.name }}</strong>
|
||||
{% if item.description %}<p>{{ item.description }}</p>{% endif %}
|
||||
{% if item.description %}<p class="description">{{ item.description }}</p>{% endif %}
|
||||
{% if event.settings.show_quota_left %}
|
||||
{% include "pretixpresale/event/fragment_quota_left.html" with avail=item.cached_availability %}
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="col-md-2 col-xs-6 price">
|
||||
{{ event.currency }} {{ item.price|floatformat:2 }}
|
||||
@@ -146,7 +152,7 @@
|
||||
{% if item.cached_availability.0 == 100 %}
|
||||
<div class="col-md-2 col-xs-6 availability-box available">
|
||||
<input type="number" class="form-control input-item-count" placeholder="0" min="0"
|
||||
max="{{ item.cached_availability.1 }}" name="item_{{ item.id }}">
|
||||
max="{{ item.order_max }}" name="item_{{ item.id }}">
|
||||
</div>
|
||||
{% else %}
|
||||
{% include "pretixpresale/event/fragment_availability.html" with avail=item.cached_availability.0 %}
|
||||
|
||||
@@ -30,16 +30,16 @@ class EventIndex(EventViewMixin, CartMixin, TemplateView):
|
||||
item.has_variations = item.variations.exists()
|
||||
if not item.has_variations:
|
||||
item.cached_availability = list(item.check_quotas())
|
||||
item.cached_availability[1] = min((item.cached_availability[1]
|
||||
if item.cached_availability[1] is not None else sys.maxsize),
|
||||
int(self.request.event.settings.max_items_per_order))
|
||||
item.order_max = min(item.cached_availability[1]
|
||||
if item.cached_availability[1] is not None else sys.maxsize,
|
||||
int(self.request.event.settings.max_items_per_order))
|
||||
item.price = item.default_price
|
||||
else:
|
||||
for var in item.available_variations:
|
||||
var.cached_availability = list(var.check_quotas())
|
||||
var.cached_availability[1] = min(var.cached_availability[1]
|
||||
if var.cached_availability[1] is not None else sys.maxsize,
|
||||
int(self.request.event.settings.max_items_per_order))
|
||||
var.order_max = min(var.cached_availability[1]
|
||||
if var.cached_availability[1] is not None else sys.maxsize,
|
||||
int(self.request.event.settings.max_items_per_order))
|
||||
var.price = var.default_price if var.default_price is not None else item.default_price
|
||||
if len(item.available_variations) > 0:
|
||||
item.min_price = min([v.price for v in item.available_variations])
|
||||
|
||||
Reference in New Issue
Block a user