Check-in: Show more information (#3576)

* Check-in: Show more information

* Add change notes

* Rebase migration

* Add "expand" option to checkinrpc

* REmove accidental file

* Docs fixes

* REbase migration

* Rebase migration

* Fix typo

* REbase migration

* Make web-checkin look more like new android checkin
This commit is contained in:
Raphael Michel
2023-11-28 14:52:12 +01:00
committed by GitHub
parent ab28086779
commit 8a3b313cb6
35 changed files with 346 additions and 41 deletions

View File

@@ -133,6 +133,14 @@ class QuestionForm(I18nModelForm):
return val
def clean_show_during_checkin(self):
val = self.cleaned_data.get('show_during_checkin')
if val and self.cleaned_data.get('type') in Question.SHOW_DURING_CHECKIN_UNSUPPORTED:
raise ValidationError(_('This type of question cannot be shown during check-in.'))
return val
def clean_identifier(self):
val = self.cleaned_data.get('identifier')
Question._clean_identifier(self.instance.event, val, self.instance)
@@ -155,6 +163,7 @@ class QuestionForm(I18nModelForm):
'type',
'required',
'ask_during_checkin',
'show_during_checkin',
'hidden',
'identifier',
'items',
@@ -379,6 +388,7 @@ class ItemCreateForm(I18nModelForm):
'max_per_order',
'generate_tickets',
'checkin_attention',
'checkin_text',
'free_price',
'original_price',
'sales_channels',
@@ -703,6 +713,7 @@ class ItemUpdateForm(I18nModelForm):
'max_per_order',
'min_per_order',
'checkin_attention',
'checkin_text',
'generate_tickets',
'original_price',
'require_bundling',
@@ -751,6 +762,7 @@ class ItemUpdateForm(I18nModelForm):
'show_quota_left': ShowQuotaNullBooleanSelect(),
'max_per_order': forms.widgets.NumberInput(attrs={'min': 0}),
'min_per_order': forms.widgets.NumberInput(attrs={'min': 0}),
'checkin_text': forms.TextInput(),
}
@@ -869,6 +881,7 @@ class ItemVariationForm(I18nModelForm):
'require_membership_hidden',
'require_membership_types',
'checkin_attention',
'checkin_text',
'available_from',
'available_until',
'sales_channels',
@@ -884,6 +897,7 @@ class ItemVariationForm(I18nModelForm):
'require_membership_types': forms.CheckboxSelectMultiple(attrs={
'class': 'scrolling-multiple-choice'
}),
'checkin_text': forms.TextInput(),
}
def clean(self):

View File

@@ -265,12 +265,13 @@ class ExporterForm(forms.Form):
class CommentForm(I18nModelForm):
class Meta:
model = Order
fields = ['comment', 'checkin_attention', 'custom_followup_at']
fields = ['comment', 'checkin_attention', 'checkin_text', 'custom_followup_at']
widgets = {
'comment': forms.Textarea(attrs={
'rows': 3,
'class': 'helper-width-100',
}),
'checkin_text': forms.TextInput(),
'custom_followup_at': DatePickerWidget(),
}

View File

@@ -407,6 +407,7 @@ def pretixcontrol_logentry_display(sender: Event, logentry: LogEntry, **kwargs):
'pretix.event.order.custom_followup_at': _('The order\'s follow-up date has been updated.'),
'pretix.event.order.checkin_attention': _('The order\'s flag to require attention at check-in has been '
'toggled.'),
'pretix.event.order.checkin_text': _('The order\'s check-in text has been changed.'),
'pretix.event.order.pretix.event.order.valid_if_pending': _('The order\'s flag to be considered valid even if '
'unpaid has been toggled.'),
'pretix.event.order.payment.changed': _('A new payment {local_id} has been started instead of the previous one.'),

View File

@@ -85,11 +85,31 @@
{% endif %}
{% endif %}
{% if result.position %}
{% if result.position.require_attention %}
{% if result.require_attention %}
<p>
<span class="fa fa-info-circle fa-fw"></span> {% trans "Special attention required" %}
<strong>
<span class="fa fa-info-circle text-info fa-fw"></span>
{% trans "Special attention required" %}
</strong>
</p>
{% endif %}
{% for t in result.checkin_texts %}
<p>
<span class="fa fa-info-circle text-muted fa-fw"></span>
{{ t }}
</p>
{% endfor %}
{% if result.position_object %}
{% for a in result.position_object.answers.all %}
{% if a.question.show_during_checkin %}
<p>
<span class="fa fa-question-circle text-muted fa-fw"></span>
<strong>{{ a.question.question }}</strong>
{{ a }}
</p>
{% endif %}
{% endfor %}
{% endif %}
<p>
<span class="fa fa-ticket fa-fw"></span>
<a href="{% url "control:event.order" event=request.event.slug organizer=request.event.organizer.slug code=result.position.order %}">

View File

@@ -108,6 +108,7 @@
</div>
{% endif %}
{% bootstrap_field form.checkin_attention layout="control" %}
{% bootstrap_field form.checkin_text layout="control" %}
</div>
</details>
{% endfor %}
@@ -206,6 +207,7 @@
</div>
{% endif %}
{% bootstrap_field formset.empty_form.checkin_attention layout="control" %}
{% bootstrap_field formset.empty_form.checkin_text layout="control" %}
</div>
</details>
{% endescapescript %}

View File

@@ -202,6 +202,7 @@
<fieldset>
<legend>{% trans "Check-in & Validity" %}</legend>
{% bootstrap_field form.checkin_attention layout="control" %}
{% bootstrap_field form.checkin_text layout="control" %}
{% bootstrap_field form.validity_mode layout="control" %}
<div data-display-dependency="#{{ form.validity_mode.id_for_label }}" data-display-dependency-value="fixed">
{% bootstrap_field form.validity_fixed_from layout="control" %}

View File

@@ -129,6 +129,7 @@
{% bootstrap_field form.help_text layout="control" %}
{% bootstrap_field form.identifier layout="control" %}
{% bootstrap_field form.ask_during_checkin layout="control" %}
{% bootstrap_field form.show_during_checkin layout="control" %}
{% bootstrap_field form.hidden layout="control" %}
{% bootstrap_field form.print_on_invoice layout="control" %}

View File

@@ -997,6 +997,7 @@
{% bootstrap_field comment_form.comment show_help=True show_label=False %}
{% bootstrap_field comment_form.custom_followup_at %}
{% bootstrap_field comment_form.checkin_attention show_help=True show_label=False %}
{% bootstrap_field comment_form.checkin_text show_help=True show_label=False %}
{% if "can_change_orders" in request.eventpermset %}
<button class="btn btn-default">
{% trans "Update comment" %}

View File

@@ -551,9 +551,12 @@ class CheckInListSimulator(EventPermissionRequiredMixin, FormView):
gate=form.cleaned_data.get("gate"),
).data
if self.result.get("position"):
op = OrderPosition.objects.get(pk=self.result["position"]["id"])
self.result["position_object"] = op
if form.cleaned_data["checkin_type"] == Checkin.TYPE_ENTRY and self.list.rules and self.result.get("position")\
and (self.result["status"] in ("ok", "incomplete") or self.result["reason"] == "rules"):
op = OrderPosition.objects.get(pk=self.result["position"]["id"])
rule_data = LazyRuleVars(op, self.list, form.cleaned_data["datetime"], form.cleaned_data.get("gate"))
rule_graph = _logic_annotate_for_graphic_explain(self.list.rules, op.subevent or self.list.event, rule_data,
form.cleaned_data["datetime"])

View File

@@ -513,7 +513,8 @@ class OrderDetail(OrderView):
ctx['comment_form'] = CommentForm(initial={
'comment': self.order.comment,
'custom_followup_at': self.order.custom_followup_at,
'checkin_attention': self.order.checkin_attention
'checkin_attention': self.order.checkin_attention,
'checkin_text': self.order.checkin_text,
})
ctx['display_locale'] = dict(settings.LANGUAGES)[self.object.locale or self.request.event.settings.locale]
@@ -747,7 +748,13 @@ class OrderComment(OrderView):
self.order.log_action('pretix.event.order.checkin_attention', user=self.request.user, data={
'new_value': form.cleaned_data.get('checkin_attention')
})
self.order.save(update_fields=['checkin_attention', 'comment', 'custom_followup_at'])
if form.cleaned_data.get('checkin_text') != self.order.checkin_text:
self.order.checkin_text = form.cleaned_data.get('checkin_text')
self.order.log_action('pretix.event.order.checkin_text', user=self.request.user, data={
'new_value': form.cleaned_data.get('checkin_text')
})
self.order.save(update_fields=['checkin_attention', 'checkin_text', 'comment', 'custom_followup_at'])
self.order.refresh_from_db()
messages.success(self.request, _('The comment has been updated.'))
else: