feat: pre-flight check of agency bookings

addresses #869bqxr4q
This commit is contained in:
Björn Fromme
2026-07-10 14:33:09 +02:00
parent f9142e3080
commit b41b19d4c6
26 changed files with 1818 additions and 304 deletions
+25 -7
View File
@@ -2,10 +2,13 @@
{% set isCanceled = cardData.isCanceled is defined ? cardData.isCanceled : false %}
{% set isValid = cardData.isValid is defined ? cardData.isValid : true %}
{% set isSubmitted = isSubmitted|default(false) %}
{% set needsAttention = needsAttention|default(false) %}
{% set attentionLabels = attentionLabels|default([]) %}
{% set mode = mode|default('create') %}
{# Determine display states #}
{% set showAsError = not isValid and isSubmitted %}
{% set showAsAttention = needsAttention and not showAsError %}
{% set showAsIncomplete = not isValid and not isSubmitted %}
{# Build edit URL for linking #}
@@ -17,11 +20,13 @@
<div class="py-4" id="participant-card-{{ index }}">
<div class="flex items-start space-x-4">
<div class="{{ html_classes('w-12 h-12 inline-flex flex-shrink-0 items-center justify-center rounded-full text-white font-bold', {
'bg-primary-dark': not showAsError and booking_theme() == 'base',
'bg-sbw-primary': not showAsError and booking_theme() == 'sbw',
'bg-snz-primary-dark': not showAsError and booking_theme() == 'snz',
'bg-ser-primary': not showAsError and booking_theme() == 'ser',
<div class="{{ html_classes('w-12 h-12 inline-flex flex-shrink-0 items-center justify-center rounded-full font-bold', {
'text-white': not showAsAttention,
'bg-yellow-500': showAsAttention,
'bg-primary-dark': not showAsError and not showAsAttention and booking_theme() == 'base',
'bg-sbw-primary': not showAsError and not showAsAttention and booking_theme() == 'sbw',
'bg-snz-primary-dark': not showAsError and not showAsAttention and booking_theme() == 'snz',
'bg-ser-primary': not showAsError and not showAsAttention and booking_theme() == 'ser',
'bg-red-500': showAsError,
'text-2xl': participantNumber < 100,
'text-xl': participantNumber >= 100,
@@ -37,13 +42,26 @@
{% endif %}
</div>
{% if isCanceled %}
<div class="text-xs font-medium text-gray-700" {{ qa_attribute('participant-canceled', index) }}>
<div class="text-sm font-medium text-gray-700" {{ qa_attribute('participant-canceled', index) }}>
storniert
</div>
{% elseif showAsError %}
<div class="text-xs font-medium text-red-500" {{ qa_attribute('participant-invalid', index) }}>
<div class="text-sm font-medium text-red-500" {{ qa_attribute('participant-invalid', index) }}>
unvollständige/fehlerhafte Daten
</div>
{% elseif showAsAttention %}
<div class="text-sm font-medium text-red-500" {{ qa_attribute('participant-attention', index) }}>
bitte prüfen/ergänzen:
</div>
{% if attentionLabels|length > 0 %}
<div class="mt-2 flex flex-wrap gap-1" {{ qa_attribute('participant-attention-labels', index) }}>
{% for label in attentionLabels %}
<span class="inline-flex items-center rounded-full bg-yellow-500 px-2 py-0.5 text-xs font-semibold">
{{ label }}
</span>
{% endfor %}
</div>
{% endif %}
{% else %}
<div class="text-gray-600" {{ qa_attribute('participant-room-name', index) }}>
{{ cardData.roomName }}
+17 -8
View File
@@ -62,18 +62,25 @@
} %}
{% endif %}
{# Display validation errors #}
{% if bookingEditContext.hasValidationErrors %}
{# Display blocking issues first; otherwise show the attention scan as a calm warning #}
{% if bookingEditContext.hasBlockingValidationErrors %}
{% include '_partials/_alert.html.twig' with {
level: 'error',
title: 'Bitte überprüfe die Teilnehmerdaten',
messages: ['Einige Teilnehmer haben noch unvollständige oder fehlerhafte Angaben. Bitte bearbeite die markierten Teilnehmer.']
title: 'Teilnehmerdaten prüfen',
messages: ['Die Daten einiger Teilnehmer:innen sind noch unvollständig oder fehlerhaft. Bitte bearbeite die markierten Teilnehmer.']
} %}
{% elseif bookingEditContext.missingValueLabelsByParticipantIndex|length > 0 %}
{% include '_partials/_alert.html.twig' with {
level: 'warning',
title: 'Teilnehmerdaten prüfen',
messages: ['Die Daten von ' ~ (bookingEditContext.missingValueLabelsByParticipantIndex|length) ~ ' Teilnehmer:innen sind noch unvollständig oder fehlerhaft. Bitte bearbeite die markierten Teilnehmer.']
} %}
{% endif %}
<div id="participant-cards-grid" class="space-y-4">
<div id="participant-cards-grid" class="divide-y divide-gray-200">
{% for participant in bookingEditContext.bookingDto.participants %}
{% set isCanceled = (bookingEditContext.bookingData.participantsStatus[loop.index0] ?? null) == 'S' %}
{% set attentionLabels = bookingEditContext.missingValueLabelsByParticipantIndex[loop.index0]|default([]) %}
{% include 'booking/_participant_card.html.twig' with {
'cardData': bookingEditContext.cardsData[loop.index0],
'index': loop.index0,
@@ -82,6 +89,8 @@
'bookingId': bookingEditContext.bookingData.id,
'isCanceled': isCanceled,
'isSubmitted': bookingEditContext.isSubmitted,
'needsAttention': attentionLabels is not empty,
'attentionLabels': attentionLabels,
} %}
{% endfor %}
</div>
@@ -97,13 +106,13 @@
class="inline-flex items-center justify-center bg-gray-200 rounded-md w-8 h-8 md:w-10 md:h-10">
<svg class="w-6 h-6 md:w-8 md:h-8" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256"><rect width="256" height="256" fill="none"/><line x1="200" y1="56" x2="56" y2="200" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"/><line x1="200" y1="200" x2="56" y2="56" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"/></svg>
</a>
{% if bookingEditContext.isDirty %}
{% if bookingEditContext.isDirty or bookingEditContext.hasBlockingValidationErrors %}
<button type="submit"
{% if bookingEditContext.hasValidationErrors %}
{% if bookingEditContext.hasBlockingValidationErrors %}
disabled
title="Bitte prüfe zuerst deine Eingaben"
{% endif %}
class="button button--primary {{ bookingEditContext.hasValidationErrors ? 'opacity-50 cursor-not-allowed' : '' }}">
class="button button--primary {{ bookingEditContext.hasBlockingValidationErrors ? 'opacity-50 cursor-not-allowed' : '' }}">
Buchung aktualisieren
</button>
{% endif %}