Improve add-on products

This commit is contained in:
Raphael Michel
2017-03-19 14:33:45 +01:00
parent 5bcfb958f0
commit b52f2f5a9e
36 changed files with 802 additions and 131 deletions

View File

@@ -257,7 +257,8 @@ class EventSettingsForm(SettingsForm):
)
max_items_per_order = forms.IntegerField(
min_value=1,
label=_("Maximum number of items per order")
label=_("Maximum number of items per order"),
help_text=_("Add-on products will not be counted.")
)
reservation_time = forms.IntegerField(
min_value=0,
@@ -607,6 +608,10 @@ class TicketSettingsForm(SettingsForm):
required=True,
widget=forms.DateTimeInput(attrs={'class': 'datetimepicker'})
)
ticket_download_addons = forms.BooleanField(
label=_("Offer to download tickets separately for add-on products"),
required=False
)
def prepare_fields(self):
# See clean()

View File

@@ -265,3 +265,7 @@ class ItemAddOnForm(I18nModelForm):
'min_count',
'max_count',
]
help_texts = {
'min_count': _('Be aware that setting a minimal number makes it impossible to buy this product if all '
'available add-ons are sold out.')
}

View File

@@ -76,6 +76,9 @@ class VoucherForm(I18nModelForm):
else:
self.instance.variation = None
self.instance.quota = None
if self.instance.item.category and self.instance.item.category.is_addon:
raise ValidationError(_('It is currently not possible to create vouchers for add-on products.'))
else:
self.instance.quota = Quota.objects.get(pk=quotaid, event=self.instance.event)
self.instance.item = None

View File

@@ -9,6 +9,7 @@
{% bootstrap_form_errors form %}
{% bootstrap_field form.ticket_download layout="horizontal" %}
{% bootstrap_field form.ticket_download_date layout="horizontal" %}
{% bootstrap_field form.ticket_download_addons layout="horizontal" %}
{% for provider in providers %}
<div class="panel panel-default ticketoutput-panel">
<div class="panel-heading">

View File

@@ -48,6 +48,13 @@
{% if position.variation %}
{{ position.variation }}
{% endif %}
{% if position.addon_to %}
<em>
{% blocktrans trimmed with posid=position.addon_to.positionid %}
Add-On to position #{{ posid }}
{% endblocktrans %}
</em>
{% endif %}
</h3>
</div>
<div class="panel-body">
@@ -89,6 +96,11 @@
<input name="{{ position.form.prefix }}-operation" type="radio" value="cancel"
{% if position.form.operation.value == "cancel" %}checked="checked"{% endif %}>
{% trans "Remove from order" %}
{% if position.addons.exists %}
<em class="text-danger">
{% trans "Removing this position will also remove all add-ons to this position." %}
</em>
{% endif %}
</label>
</div>
</div>

View File

@@ -166,7 +166,11 @@
{% for line in items.positions %}
<div class="row-fluid product-row">
<div class="col-md-9 col-xs-6">
#{{ line.positionid }}
{% if line.addon_to %}
<span class="addon-signifier">+</span>
{% else %}
#{{ line.positionid }}
{% endif %}
<strong>{{ line.item.name }}</strong>
{% if line.variation %}
{{ line.variation }}