feat: refactor to cards

This commit is contained in:
Björn Fromme
2026-03-16 11:59:10 +01:00
parent 32a9fac9ed
commit e51c4843c5
40 changed files with 2639 additions and 3097 deletions
@@ -0,0 +1,58 @@
{# Compact participant card with name, room, price, and edit button #}
{% set isCanceled = isCanceled|default(false) %}
{% set hasErrors = hasErrors|default(false) %}
{% set mode = mode|default('create') %}
<div id="participant-card-{{ index }}"
class="border rounded p-4 flex justify-between items-center
{{ isCanceled ? 'border-gray-400 bg-gray-50' : (hasErrors ? 'border-red-500 bg-red-50' : '') }}">
<div>
<div class="flex items-center gap-2">
<h3 class="font-semibold {{ hasErrors ? 'text-red-800' : (isCanceled ? 'text-gray-600' : '') }}">
{{ cardData.name }}
</h3>
{% if isCanceled %}
<span class="inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-gray-700 text-white">
storniert
</span>
{% elseif hasErrors %}
<span class="inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-red-100 text-red-800">
<svg class="w-3 h-3 mr-1" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z" clip-rule="evenodd"></path>
</svg>
Unvollständig
</span>
{% endif %}
</div>
<p class="text-sm text-gray-600">{{ cardData.roomName }}</p>
</div>
<div class="flex items-center gap-4">
<span class="font-medium {{ isCanceled ? 'text-gray-500' : '' }}">{{ cardData.price }}</span>
{% if isCanceled %}
<button type="button"
class="button bg-button bg-button--secondary opacity-50 cursor-not-allowed"
disabled
title="Stornierte Teilnehmer können nicht bearbeitet werden">
Bearbeiten
</button>
{% else %}
{% if mode == 'edit' %}
<button type="button"
class="button bg-button {{ hasErrors ? 'bg-button--primary' : 'bg-button--secondary' }}"
hx-get="{{ path('app_booking_edit_participant', {id: bookingId, index: index}) }}"
hx-target="#main-content"
hx-swap="innerHTML">
Bearbeiten
</button>
{% else %}
<button type="button"
class="button bg-button {{ hasErrors ? 'bg-button--primary' : 'bg-button--secondary' }}"
hx-get="{{ path('app_booking_create_step_2_participant', {index: index}) }}"
hx-target="#main-content"
hx-swap="innerHTML">
Bearbeiten
</button>
{% endif %}
{% endif %}
</div>
</div>
@@ -0,0 +1,327 @@
{% import _self as macros %}
{# Macro to render a field or placeholder with consistent fieldset structure #}
{% macro service_field(form, fieldName, label, options = {}, undefinedLabel = 'Nicht wählbar') %}
{% if form[fieldName] is defined %}
{{ form_row(form[fieldName], options) }}
{% else %}
<fieldset class="mb-1">
<legend class="font-semibold mb-1">{{ label }}</legend>
<div class="text-sm text-gray-500">{{ undefinedLabel }}</div>
</fieldset>
{% endif %}
{% endmacro %}
{# Specialized macro for checkbox fields (like rental insurance) that need manual fieldset wrapping #}
{% macro checkbox_field(form, fieldName, label, options = {}, undefinedLabel = 'Nicht wählbar') %}
{% if form[fieldName] is defined %}
<fieldset class="mb-1">
<legend class="font-semibold mb-1">{{ label }}</legend>
{{ form_row(form[fieldName], options) }}
</fieldset>
{% else %}
<fieldset class="mb-1">
<legend class="font-semibold mb-1">{{ label }}</legend>
<div class="text-sm text-gray-500">{{ undefinedLabel }}</div>
</fieldset>
{% endif %}
{% endmacro %}
{# Standalone participant form view (replaces main content area) #}
{% block participant_form %}
{% import _self as macros %}
<div id="participant-form-view">
<h2>{{ participantIndex == 0 ? 'Anmelder:in' : 'Teilnehmer:in ' ~ (participantIndex + 1) }}</h2>
{{ form_start(form, {
'attr': {
'novalidate': 'novalidate',
'hx-post': path(submitRouteName, submitRouteParams|default({index: participantIndex})),
'hx-target': '#main-content',
'hx-swap': 'innerHTML'
}
}) }}
<div id="participant-form" class="space-y-4">
{# Personal data section #}
<div class="grid grid-cols-2 gap-4">
{{ form_row(form.firstName) }}
{{ form_row(form.lastName) }}
{{ form_row(form.dateOfBirth, {
'attr': {
'hx-trigger': 'change',
'hx-post': path(refreshRouteName, refreshRouteParams|default({index: participantIndex})),
'hx-target': '#main-content',
'hx-swap': 'innerHTML'
}
}) }}
{{ form_row(form.gender) }}
{{ form_row(form.nationality) }}
</div>
{# Contact information #}
<div class="grid grid-cols-2 gap-4">
{{ form_row(form.email) }}
{{ form_row(form.mobile) }}
</div>
{# Address #}
{% if form.address is defined %}
<div class="grid grid-cols-2 gap-4">
{{ form_row(form.address.street) }}
{{ form_row(form.address.postCode) }}
{{ form_row(form.address.city) }}
{{ form_row(form.address.country) }}
</div>
{% endif %}
{# Body dimensions #}
{% if form.bodyDimensions is defined %}
<div class="grid grid-cols-2 gap-4">
{{ form_row(form.bodyDimensions.height) }}
{{ form_row(form.bodyDimensions.shoeSize) }}
{{ form_row(form.bodyDimensions.weight) }}
</div>
{% endif %}
{# Room assignment #}
<div class="grid grid-cols-2 gap-4">
{{ form_row(form.assignedRoomId, {
'attr': {
'hx-trigger': 'change',
'hx-post': path(refreshRouteName, refreshRouteParams|default({index: participantIndex})),
'hx-target': '#main-content',
'hx-swap': 'innerHTML'
}
}) }}
{% if form.remarksRoom is defined %}
{{ form_row(form.remarksRoom) }}
{% endif %}
</div>
{# Eligibility checks #}
{% set participantData = form.vars.data %}
{% set hasDateOfBirth = participantData and participantData.dateOfBirth %}
{% set isEligible = hasDateOfBirth and is_participant_eligible(bookingDto, participantIndex) %}
{% if not hasDateOfBirth %}
<div class="my-4 p-4 bg-blue-50 border border-blue-200 rounded-lg">
<div class="flex items-center">
<svg class="w-5 h-5 text-blue-600 mr-2" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z" clip-rule="evenodd"></path>
</svg>
<p class="text-sm text-blue-800">
Leistungen sind erst nach Angabe des Geburtsdatums buchbar
</p>
</div>
</div>
{% elseif not isEligible %}
<div class="my-4 p-4 bg-red-50 border border-red-200 rounded-lg">
<div class="flex items-center">
<svg class="w-5 h-5 text-red-600 mr-2" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z" clip-rule="evenodd"></path>
</svg>
<p class="text-sm text-red-800">
Buchung wegen des Alters von Teilnehmer:in {{ participantIndex + 1 }} nicht möglich
</p>
</div>
</div>
{% endif %}
{# Service selection #}
{% if isEligible %}
<div class="grid grid-cols-2 gap-4">
{{ macros.service_field(form, 'skiPass', 'Skipass', {
'attr': {
'hx-trigger': 'change',
'hx-post': path(refreshRouteName, refreshRouteParams|default({index: participantIndex})),
'hx-target': '#main-content', 'hx-swap': 'innerHTML'
}
}) }}
{{ macros.service_field(form, 'courses', 'Kurse', {
'attr': {
'hx-trigger': 'change',
'hx-post': path(refreshRouteName, refreshRouteParams|default({index: participantIndex})),
'hx-target': '#main-content', 'hx-swap': 'innerHTML'
}
}) }}
{{ macros.service_field(form, 'additionalServices', 'Zusatzleistungen', {
'attr': {
'hx-trigger': 'change',
'hx-post': path(refreshRouteName, refreshRouteParams|default({index: participantIndex})),
'hx-target': '#main-content', 'hx-swap': 'innerHTML'
}
}) }}
{{ macros.service_field(form, 'rentals', 'Leihmaterial', {
'attr': {
'hx-trigger': 'change',
'hx-post': path(refreshRouteName, refreshRouteParams|default({index: participantIndex})),
'hx-target': '#main-content', 'hx-swap': 'innerHTML'
}
}, 'Bitte zuerst den Skipass auswählen') }}
{{ macros.checkbox_field(form, 'rentalInsurance', 'Leihmaterial-Versicherung', {
'attr': {
'hx-trigger': 'change',
'hx-post': path(refreshRouteName, refreshRouteParams|default({index: participantIndex})),
'hx-target': '#main-content', 'hx-swap': 'innerHTML'
}
}, 'Nur bei Buchung von Leihmaterial') }}
{{ macros.service_field(form, 'board', 'Verpflegung', {
'attr': {
'hx-trigger': 'change',
'hx-post': path(refreshRouteName, refreshRouteParams|default({index: participantIndex})),
'hx-target': '#main-content', 'hx-swap': 'innerHTML'
}
}) }}
<div class="col-span-2">
{# Insurance field OR assigned insurance display for dependent participants #}
{% set showBulkInsurance = participantIndex > 0 and bookingDto.participants[0].bulkInsuranceBooking %}
{% if showBulkInsurance %}
<fieldset class="mb-1">
<legend class="font-semibold mb-1">Reiseversicherung</legend>
<div class="text-sm text-gray-600">
{% set applicantInsurance = bookingDto.participants[0].insurance %}
{% if applicantInsurance %}
{{ applicantInsurance.label }}
{% if applicantInsurance.price and applicantInsurance.price > 0 %}
<span class="text-gray-500">(€{{ applicantInsurance.price|number_format(2, ',', '.') }})</span>
{% endif %}
<span class="italic text-gray-500 ml-2"> wie Anmelder</span>
{% else %}
<span class="italic">wie Anmelder</span>
{% endif %}
</div>
</fieldset>
{% else %}
<fieldset class="mb-1">
<legend class="font-semibold mb-1">Reiseversicherung</legend>
{# Bulk insurance booking checkbox (applicant only) #}
{% if form.bulkInsuranceBooking is defined %}
{{ form_row(form.bulkInsuranceBooking) }}
{% endif %}
{% if form.insurance is defined %}
{{ form_row(form.insurance, {
'attr': {
'hx-trigger': 'change',
'hx-post': path(refreshRouteName, refreshRouteParams|default({index: participantIndex})),
'hx-target': '#main-content', 'hx-swap': 'innerHTML'
},
'label': false
}) }}
{% else %}
<div class="text-sm text-gray-500">Nicht wählbar</div>
{% endif %}
</fieldset>
{% endif %}
</div>
</div>
{# Transportation Services Section #}
<div class="mt-6 border-t pt-4">
<h3 class="font-semibold text-lg mb-4">Anreise</h3>
<div class="grid grid-cols-2 gap-4">
<div>
{% if form.transportationOutbound is defined %}
{{ form_row(form.transportationOutbound, {
'attr': {
'hx-trigger': 'change',
'hx-post': path(refreshRouteName, refreshRouteParams|default({index: participantIndex})),
'hx-target': '#main-content', 'hx-swap': 'innerHTML'
}
}) }}
{% endif %}
{% if form.pickup is defined or form.parking is defined or form.licensePlate is defined %}
{% if form.pickup is defined %}
<div class="mt-4">
{{ form_row(form.pickup, {
'attr': {
'hx-trigger': 'change',
'hx-post': path(refreshRouteName, refreshRouteParams|default({index: participantIndex})),
'hx-target': '#main-content', 'hx-swap': 'innerHTML'
}
}) }}
</div>
{% endif %}
{% if form.parking is defined %}
<div class="mt-4">
{{ form_row(form.parking, {
'attr': {
'hx-trigger': 'change',
'hx-post': path(refreshRouteName, refreshRouteParams|default({index: participantIndex})),
'hx-target': '#main-content', 'hx-swap': 'innerHTML'
}
}) }}
</div>
{% endif %}
{% if form.licensePlate is defined %}
<div class="mt-4">
{{ form_row(form.licensePlate) }}
</div>
{% endif %}
{% endif %}
</div>
<div>
{% if form.transportationInbound is defined %}
{{ form_row(form.transportationInbound, {
'attr': {
'hx-trigger': 'change',
'hx-post': path(refreshRouteName, refreshRouteParams|default({index: participantIndex})),
'hx-target': '#main-content', 'hx-swap': 'innerHTML'
}
}) }}
{% endif %}
</div>
</div>
</div>
{% endif %}
</div>
<div class="flex justify-between mt-8">
{% if cancelRouteName is defined %}
<button type="button"
class="button bg-button bg-button--secondary"
hx-get="{{ path(cancelRouteName, cancelRouteParams|default({})) }}"
hx-target="#main-content"
hx-swap="innerHTML">
Abbrechen
</button>
{% else %}
<button type="button"
class="button bg-button bg-button--secondary"
hx-get="{{ path('app_booking_create_step_2') }}"
hx-target="#main-content"
hx-swap="innerHTML">
Abbrechen
</button>
{% endif %}
<button type="submit" class="button bg-button bg-button--secondary">
Speichern
</button>
</div>
{{ form_rest(form) }}
{{ form_end(form) }}
</div>
{% endblock %}
{# Sidebar summary with conditional OOB swap #}
{% block booking_summary %}
<div id="booking-summary"{% if htmx_oob_swap|default(false) %} hx-swap-oob="true"{% endif %}>
{% include 'booking/_summary.html.twig' with {
'bookingCreateDto': bookingDto,
'participantCount': summaryData.participantsCount,
'groupedSelectedRooms': summaryData.groupedSelectedRooms,
'assignmentCounts': summaryData.assignmentCounts,
'pricingData': pricingData
} %}
</div>
{% endblock %}
@@ -19,20 +19,15 @@
<div class="mt-2 text-sm text-red-700">
{% for flash_message in app.flashes('error') %}
<p>{{ flash_message }}</p>
{% else %}
<p>Es ist ein Fehler beim Starten des Buchungsvorgangs aufgetreten.</p>
{% endfor %}
{% if app.flashes('error') is empty %}
<p>Es ist ein Fehler beim Starten der Buchung aufgetreten. Bitte versuchen Sie es erneut.</p>
{% endif %}
</div>
<div class="mt-4">
<div class="flex space-x-2">
<a href="#" class="button bg-button bg-button--secondary">
<a href="https://www.ep-reisen.de" class="button bg-button bg-button--secondary">
Zur Startseite
</a>
<button onclick="history.back()" class="button bg-button">
Zurück
</button>
</div>
</div>
</div>
+76
View File
@@ -0,0 +1,76 @@
{% extends 'layout.html.twig' %}
{% block content %}
{% include '_partials/_flashes.html.twig' %}
<div {{ stimulus_controller('toast') }}></div>
<h1>Neue Buchung</h1>
<div class="grid grid-cols-3 gap-8">
{# Main content area - cards grid #}
{% block participant_cards %}
<div id="main-content" class="col-span-2">
{{ form_start(form, {
'attr': {
'hx-post': path('app_booking_create_step_2'),
'hx-target': '#main-content',
'hx-swap': 'innerHTML'
}
}) }}
<h2>Teilnehmer</h2>
{# Display form-level validation errors #}
{% if form.vars.submitted and not form.vars.valid %}
<div class="mb-4 p-4 bg-red-50 border border-red-200 rounded-lg">
<div class="flex items-start">
<svg class="w-5 h-5 text-red-600 mr-2 mt-0.5 flex-shrink-0" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z" clip-rule="evenodd"></path>
</svg>
<div>
<p class="font-semibold text-red-800 mb-1">Bitte überprüfe die Teilnehmerdaten</p>
<p class="text-sm text-red-700">Einige Teilnehmer haben noch unvollständige oder fehlerhafte Angaben. Bitte bearbeite die markierten Teilnehmer.</p>
</div>
</div>
</div>
{% endif %}
<div id="participant-cards-grid" class="space-y-4">
{% for cardData in cardsData %}
{% set hasErrors = loop.index0 in participantErrors|default([]) %}
{% include 'booking/_participant_card.html.twig' with {
'cardData': cardData,
'index': loop.index0,
'mode': 'create',
'hasErrors': hasErrors
} %}
{% endfor %}
</div>
<div class="flex justify-between mt-8">
<a href="{{ path('app_booking_create_step_1') }}" class="button bg-button bg-button--secondary">
Zurück
</a>
<button type="submit" class="button bg-button bg-button--secondary">
Weiter
</button>
</div>
{{ form_rest(form) }}
{{ form_end(form) }}
</div>
{% endblock %}
{# Sidebar summary #}
{% block booking_summary %}
<div id="booking-summary"{% if htmx_oob_swap|default(false) %} hx-swap-oob="true"{% endif %}>
{% include 'booking/_summary.html.twig' with {
'bookingCreateDto': bookingDto,
'participantCount': summaryData.participantsCount,
'groupedSelectedRooms': summaryData.groupedSelectedRooms,
'assignmentCounts': summaryData.assignmentCounts,
'pricingData': pricingData
} %}
</div>
{% endblock %}
</div>
{% endblock %}
@@ -4,22 +4,15 @@
{% block content %}
<div class="max-w-2xl mx-auto text-center py-12">
<div class="mb-8">
<svg class="w-24 h-24 text-green-500 mx-auto" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"></path>
</svg>
</div>
<h1 class="text-3xl font-bold mb-4">Buchung erfolgreich abgeschlossen</h1>
<p class="text-xl mb-8">
Ihre Buchungsnummer: <strong class="font-mono">{{ bookingNumber }}</strong>
Deine Buchungsnummer lautet <strong class="font-mono">{{ bookingNumber }}</strong>
</p>
<div class="bg-blue-50 border border-blue-200 rounded-lg p-6 mb-8">
<p class="text-gray-700">
Sie erhalten in Kürze eine Bestätigungs-E-Mail mit allen Details zu Ihrer Buchung.
Du erhältst in Kürze eine Bestätigungs-E-Mail mit allen Details zu Deiner Buchung.
</p>
</div>
-337
View File
@@ -1,337 +0,0 @@
{% extends 'layout.html.twig' %}
{# Local form theme override for consistent fieldset rendering #}
{% use 'forms.html.twig' %}
{% block form_row %}
{%- if form.vars.expanded is defined and form.vars.expanded -%}
{# Expanded forms get fieldset wrapper #}
<fieldset class="mb-1">
<legend class="font-semibold mb-1">
{{- form.vars.label -}}
</legend>
{{- form_widget(form, {
'attr': attr|default({})
}) -}}
{{- form_errors(form) -}}
{{- form_help(form) -}}
</fieldset>
{%- else -%}
{{- parent() -}}
{%- endif -%}
{% endblock %}
{% import _self as macros %}
{# Macro to render a field or placeholder with consistent fieldset structure #}
{% macro service_field(participant, fieldName, label, options = {}, undefinedLabel = 'Nicht wählbar') %}
{% if participant[fieldName] is defined %}
{{ form_row(participant[fieldName], options) }}
{% else %}
<fieldset class="mb-1">
<legend class="font-semibold mb-1">{{ label }}</legend>
<div class="text-sm text-gray-500">{{ undefinedLabel }}</div>
</fieldset>
{% endif %}
{% endmacro %}
{# Specialized macro for checkbox fields (like rental insurance) that need manual fieldset wrapping #}
{% macro checkbox_field(participant, fieldName, label, options = {}, undefinedLabel = 'Nicht wählbar') %}
{% if participant[fieldName] is defined %}
<fieldset class="mb-1">
<legend class="font-semibold mb-1">{{ label }}</legend>
{{ form_row(participant[fieldName], options) }}
</fieldset>
{% else %}
<fieldset class="mb-1">
<legend class="font-semibold mb-1">{{ label }}</legend>
<div class="text-sm text-gray-500">{{ undefinedLabel }}</div>
</fieldset>
{% endif %}
{% endmacro %}
{% block content %}
{% include '_partials/_flashes.html.twig' %}
<div {{ stimulus_controller('toast') }}></div>
<h1>Neue Buchung</h1>
<div class="grid grid-cols-3 gap-8">
<div id="form-wrapper" class="col-span-2">
<h2>Teilnehmer</h2>
{{ form_start(form) }}
{% do form.participants.setRendered %}
{# This block contains the participant form fields #}
{% block participants_form %}
<div id="participants-form" class="space-y-8 pb-8"{% if htmx_oob_swap is defined and htmx_oob_swap %} hx-swap-oob="true"{% endif %}>
{% for participant in form.participants %}
{% set participantDataValid = participant.vars.valid %}
{% set participantData = participant.vars.data %}
{% set hasDateOfBirth = participantData and participantData.dateOfBirth %}
{% set isEligible = hasDateOfBirth and is_participant_eligible(bookingCreateDto, loop.index0) %}
<div class="{{ html_classes('border rounded px-4 py-2', { 'border-gray-300': participantDataValid, 'border-red-700': not participantDataValid }) }}" {{ stimulus_controller('toggle', {'storageKey': 'participant_' ~ loop.index0, 'open': participant.vars.valid == false}, { 'closed': 'hidden' }) }}>
<fieldset>
<legend class="w-full flex items-center justify-between">
<div class="flex items-center gap-3">
<span class="font-bold text-xl">{{ loop.index == 1 ? 'Anmelder:in' : 'Teilnehmer:in ' ~ loop.index }}</span>
{% if isEligible and participantPrices is defined and participantPrices[loop.index0] is defined and participantPrices[loop.index0] > 0.0 %}
<span class="text-sm font-medium text-gray-600 bg-gray-100 px-2 py-1 rounded">
{{ participantPrices[loop.index0]|number_format(2, ',', '.') }}
</span>
{% endif %}
</div>
<button type="button" tabindex="0" {{ stimulus_action('toggle', 'toggle') }}>
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6" {{ stimulus_target('toggle', 'icon') }}>
<path stroke-linecap="round" stroke-linejoin="round" d="M8.25 4.5l7.5 7.5-7.5 7.5" />
</svg>
</button>
</legend>
<div class="hidden py-4" {{ stimulus_target('toggle', 'toggle') }}>
<div class="grid grid-cols-2 gap-4 pb-4">
{{ form_row(participant.firstName) }}
{{ form_row(participant.lastName) }}
{{ form_row(participant.dateOfBirth, {
'attr': {
'hx-trigger': 'change',
'hx-post': path('app_booking_create_step_2_refresh'),
'hx-swap': 'none'
}
}) }}
{{ form_row(participant.gender) }}
{{ form_row(participant.nationality) }}
</div>
<div class="grid grid-cols-2 gap-4">
{{ form_row(participant.email) }}
{{ form_row(participant.mobile) }}
</div>
{% if participant.address is defined %}
<div class="grid grid-cols-2 gap-4">
{{ form_row(participant.address.street) }}
{{ form_row(participant.address.postCode) }}
{{ form_row(participant.address.city) }}
{{ form_row(participant.address.country) }}
</div>
{% endif %}
{% if participant.bodyDimensions is defined %}
<div class="grid grid-cols-2 gap-4">
{{ form_row(participant.bodyDimensions.height) }}
{{ form_row(participant.bodyDimensions.shoeSize) }}
{{ form_row(participant.bodyDimensions.weight) }}
</div>
{% endif %}
<div class="grid grid-cols-2 gap-4">
{{ form_row(participant.assignedRoomId, {
'attr': {
'hx-trigger': 'change',
'hx-post': path('app_booking_create_step_2_refresh'),
'hx-swap': 'none'
}
}) }}
{% if participant.remarksRoom is defined %}
{{ form_row(participant.remarksRoom) }}
{% endif %}
</div>
{% if not hasDateOfBirth %}
<div class="my-4 p-4 bg-blue-50 border border-blue-200 rounded-lg">
<div class="flex items-center">
<svg class="w-5 h-5 text-blue-600 mr-2" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z" clip-rule="evenodd"></path>
</svg>
<p class="text-sm text-blue-800">
Leistungen sind erst nach Angabe des Geburtsdatums buchbar
</p>
</div>
</div>
{% elseif not isEligible %}
<div class="my-4 p-4 bg-red-50 border border-red-200 rounded-lg">
<div class="flex items-center">
<svg class="w-5 h-5 text-red-600 mr-2" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z" clip-rule="evenodd"></path>
</svg>
<p class="text-sm text-red-800">
Buchung wegen des Alters von Teilnehmer:in {{ loop.index }} nicht möglich
</p>
</div>
</div>
{% endif %}
{% if isEligible %}
<div class="grid grid-cols-2 gap-4">
{{ _self.service_field(participant, 'skiPass', 'Skipass', {
'attr': {
'hx-trigger': 'change',
'hx-post': path('app_booking_create_step_2_refresh'),
'hx-swap': 'none'
}
}) }}
{{ _self.service_field(participant, 'courses', 'Kurse', {
'attr': {
'hx-trigger': 'change',
'hx-post': path('app_booking_create_step_2_refresh'),
'hx-swap': 'none'
}
}) }}
{{ _self.service_field(participant, 'additionalServices', 'Zusatzleistungen', {
'attr': {
'hx-trigger': 'change',
'hx-post': path('app_booking_create_step_2_refresh'),
'hx-swap': 'none'
}
}) }}
{{ _self.service_field(participant, 'rentals', 'Leihmaterial', {
'attr': {
'hx-trigger': 'change',
'hx-post': path('app_booking_create_step_2_refresh'),
'hx-swap': 'none'
}
}, 'Bitte zuerst den Skipass auswählen') }}
{{ _self.checkbox_field(participant, 'rentalInsurance', 'Leihmaterial-Versicherung', {
'attr': {
'hx-trigger': 'change',
'hx-post': path('app_booking_create_step_2_refresh'),
'hx-swap': 'none'
}
}, 'Nur bei Buchung von Leihmaterial') }}
{{ _self.service_field(participant, 'board', 'Verpflegung', {
'attr': {
'hx-trigger': 'change',
'hx-post': path('app_booking_create_step_2_refresh'),
'hx-swap': 'none'
}
}) }}
<div class="col-span-2">
{# Insurance field OR assigned insurance display for dependent participants #}
{% set participantData = participant.vars.data %}
{% set showBulkInsurance = loop.index > 1 and form.vars.data.participants[0].bulkInsuranceBooking %}
{% if showBulkInsurance %}
<fieldset class="mb-1">
<legend class="font-semibold mb-1">Reiseversicherung</legend>
<div class="text-sm text-gray-600">
{% set applicantInsurance = form.vars.data.participants[0].insurance %}
{% if applicantInsurance %}
{{ applicantInsurance.label }}
{% if applicantInsurance.price and applicantInsurance.price > 0 %}
<span class="text-gray-500">(€{{ applicantInsurance.price|number_format(2, ',', '.') }})</span>
{% endif %}
<span class="italic text-gray-500 ml-2"> wie Anmelder</span>
{% else %}
<span class="italic">wie Anmelder</span>
{% endif %}
</div>
</fieldset>
{% else %}
<fieldset class="mb-1">
<legend class="font-semibold mb-1">Reiseversicherung</legend>
{# Bulk insurance booking checkbox (applicant only) #}
{% if participant.bulkInsuranceBooking is defined %}
{{ form_row(participant.bulkInsuranceBooking) }}
{% endif %}
{% if participant.insurance is defined %}
{{ form_row(participant.insurance, {
'attr': {
'hx-trigger': 'change',
'hx-post': path('app_booking_create_step_2_refresh'),
'hx-swap': 'none'
},
'label': false
}) }}
{% else %}
<div class="text-sm text-gray-500">Nicht wählbar</div>
{% endif %}
</fieldset>
{% endif %}
</div>
</div>
{# Transportation Services Section #}
<div class="mt-6 border-t pt-4">
<h3 class="font-semibold text-lg mb-4">Anreise</h3>
<div class="grid grid-cols-2 gap-4">
<div>
{% if participant.transportationOutbound is defined %}
{{ form_row(participant.transportationOutbound, {
'attr': {
'hx-trigger': 'change',
'hx-post': path('app_booking_create_step_2_refresh'),
'hx-swap': 'none'
}
}) }}
{% endif %}
{% if participant.pickup is defined or participant.parking is defined or participant.licensePlate is defined %}
{% if participant.pickup is defined %}
<div class="mt-4">
{{ form_row(participant.pickup, {
'attr': {
'hx-trigger': 'change',
'hx-post': path('app_booking_create_step_2_refresh'),
'hx-swap': 'none'
}
}) }}
</div>
{% endif %}
{% if participant.parking is defined %}
<div class="mt-4">
{{ form_row(participant.parking, {
'attr': {
'hx-trigger': 'change',
'hx-post': path('app_booking_create_step_2_refresh'),
'hx-swap': 'none'
}
}) }}
</div>
{% endif %}
{% if participant.licensePlate is defined %}
<div class="mt-4">
{{ form_row(participant.licensePlate) }}
</div>
{% endif %}
{% endif %}
</div>
<div>
{% if participant.transportationInbound is defined %}
{{ form_row(participant.transportationInbound, {
'attr': {
'hx-trigger': 'change',
'hx-post': path('app_booking_create_step_2_refresh'),
'hx-swap': 'none'
}
}) }}
{% endif %}
</div>
</div>
</div>
{% endif %}
</div>
</fieldset>
</div>
{% endfor %}
</div>
{% endblock %}
<div class="flex justify-between">
<a href="{{ path('app_booking_create_step_1') }}" class="button bg-button bg-button--secondary">Zurück</a>
<button type="submit" class="button bg-button bg-button--secondary" {{ stimulus_action('loading', 'toggle') }}>Weiter</button>
</div>
{{ form_rest(form) }}
{{ form_end(form) }}
</div>
{% block booking_summary %}
<div id="booking-summary"{% if htmx_oob_swap is defined and htmx_oob_swap %} hx-swap-oob="true"{% endif %}>
{% include 'booking/_summary.html.twig' with {
'bookingCreateDto': bookingCreateDto,
'participantCount': participantsCount,
'groupedSelectedRooms': groupedSelectedRooms,
'assignmentCounts': assignmentCounts
} %}
</div>
{% endblock %}
</div>
{% endblock %}
-394
View File
@@ -1,394 +0,0 @@
{% extends 'layout.html.twig' %}
{# Local form theme override for consistent fieldset rendering #}
{% use 'forms.html.twig' %}
{% block form_row %}
{%- if form.vars.expanded is defined and form.vars.expanded -%}
{# Expanded forms get fieldset wrapper #}
<fieldset class="mb-1">
<legend class="font-semibold mb-1">
{{- form.vars.label -}}
</legend>
{{- form_widget(form, {
'attr': attr|default({})
}) -}}
{{- form_errors(form) -}}
{{- form_help(form) -}}
</fieldset>
{%- else -%}
{{- parent() -}}
{%- endif -%}
{% endblock %}
{% import _self as macros %}
{# Macro to render a field or placeholder with consistent fieldset structure #}
{% macro service_field(participant, fieldName, label, options = {}, undefinedLabel = 'Nicht wählbar') %}
{% if participant[fieldName] is defined %}
{{ form_row(participant[fieldName], options) }}
{% else %}
<fieldset class="mb-1">
<legend class="font-semibold mb-1">{{ label }}</legend>
<div class="text-sm text-gray-500">{{ undefinedLabel }}</div>
</fieldset>
{% endif %}
{% endmacro %}
{# Specialized macro for checkbox fields (like rental insurance) that need manual fieldset wrapping #}
{% macro checkbox_field(participant, fieldName, label, options = {}, undefinedLabel = 'Nicht wählbar') %}
{% if participant[fieldName] is defined %}
<fieldset class="mb-1">
<legend class="font-semibold mb-1">{{ label }}</legend>
{{ form_row(participant[fieldName], options) }}
</fieldset>
{% else %}
<fieldset class="mb-1">
<legend class="font-semibold mb-1">{{ label }}</legend>
<div class="text-sm text-gray-500">{{ undefinedLabel }}</div>
</fieldset>
{% endif %}
{% endmacro %}
{% block content %}
{% include '_partials/_flashes.html.twig' %}
<div {{ stimulus_controller('toast') }}></div>
{# Header with reload button #}
<div class="flex justify-between items-center pb-8">
<h1 class="text-3xl font-semibold">Buchung bearbeiten</h1>
<button type="button"
hx-post="{{ path('app_booking_edit_reload', {id: bookingData.id}) }}"
hx-confirm="Alle nicht gespeicherten Änderungen gehen verloren. Fortfahren?"
{{ stimulus_action('loading', 'toggle') }}
class="px-4 py-2 bg-gray-200 hover:bg-gray-300 text-gray-800 rounded transition-colors">
🔄 Änderungen verwerfen
</button>
</div>
{# Grid layout with 2/3 form + 1/3 summary #}
<div class="grid grid-cols-3 gap-8">
<div id="form-wrapper" class="col-span-2">
<h2>Teilnehmer</h2>
{{ form_start(form) }}
{% do form.participants.setRendered %}
{# This block contains the participant form fields #}
{% block participants_form %}
<div id="participants-form" class="space-y-8 pb-8"{% if htmx_oob_swap is defined and htmx_oob_swap %} hx-swap-oob="true"{% endif %}>
{% for participant in form.participants %}
{% set participantDataValid = participant.vars.valid %}
{% set participantData = participant.vars.data %}
{% set hasDateOfBirth = participantData and participantData.dateOfBirth %}
{% set isEligible = hasDateOfBirth and is_participant_eligible(bookingEditDto, loop.index0) %}
{% set isCanceled = participantData.status == 'S' %}
<div class="{{ html_classes('border rounded px-4 py-2', { 'border-gray-300': participantDataValid, 'border-red-700': not participantDataValid }) }}" {{ stimulus_controller('toggle', {'storageKey': 'participant_' ~ loop.index0, 'open': participant.vars.valid == false}, { 'closed': 'hidden' }) }}>
<fieldset>
<legend class="w-full flex items-center justify-between">
<div class="flex items-center gap-3">
<span class="font-bold text-xl">{{ loop.index == 1 ? 'Anmelder:in' : 'Teilnehmer:in ' ~ loop.index }}</span>
{% if isCanceled %}
<span class="inline-block px-2 py-1 text-xs bg-red-700 text-white rounded">storniert</span>
{% endif %}
{% if isEligible and not isCanceled and participantPrices is defined and participantPrices[loop.index0] is defined and participantPrices[loop.index0] > 0.0 %}
<span class="text-sm font-medium text-gray-600 bg-gray-100 px-2 py-1 rounded">
{{ participantPrices[loop.index0]|number_format(2, ',', '.') }}
</span>
{% endif %}
</div>
<button type="button" tabindex="0" {{ stimulus_action('toggle', 'toggle') }}>
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6" {{ stimulus_target('toggle', 'icon') }}>
<path stroke-linecap="round" stroke-linejoin="round" d="M8.25 4.5l7.5 7.5-7.5 7.5" />
</svg>
</button>
</legend>
<div class="hidden py-4" {{ stimulus_target('toggle', 'toggle') }}>
{% if isCanceled %}
{# Show surcharges for canceled participants #}
{% set surcharges = bookingData.surchargesForParticipant(participantData.index) %}
{% if surcharges|length > 0 %}
<div>
<h3 class="text-xl font-semibold mb-2">
Zuschläge
</h3>
<ul class="list-disc pl-4">
{% for surcharge in surcharges %}
<li>
{{ surcharge.label }}: {{ surcharge.individualPrice[participantData.index]|format_currency('EUR') }}
</li>
{% endfor %}
</ul>
</div>
{% endif %}
{% else %}
{# Personal data section - readonly for applicant (edited via profile settings) #}
<div class="grid grid-cols-2 gap-4 pb-4">
{{ form_row(participant.firstName) }}
{{ form_row(participant.lastName) }}
{{ form_row(participant.dateOfBirth, {
'attr': {
'hx-trigger': 'change',
'hx-post': path('app_booking_edit_refresh', {'id': bookingData.id}),
'hx-swap': 'none'
}
}) }}
{{ form_row(participant.gender) }}
{{ form_row(participant.nationality) }}
</div>
<div class="grid grid-cols-2 gap-4">
{{ form_row(participant.email) }}
{% if loop.index0 == 0 and bookingData.applicant.communication and bookingData.applicant.communication.mobile %}
{# First participant: use applicant's mobile as placeholder #}
{{ form_row(participant.mobile, {'attr': {'placeholder': bookingData.applicant.communication.mobile}}) }}
{% else %}
{{ form_row(participant.mobile) }}
{% endif %}
</div>
{% if participant.address is defined %}
<div class="grid grid-cols-2 gap-4">
{% if loop.index0 == 0 and bookingData.applicant.address %}
{# First participant: use applicant's address as placeholder #}
{{ form_row(participant.address.street, {'attr': {'placeholder': bookingData.applicant.address.street}}) }}
{{ form_row(participant.address.postCode, {'attr': {'placeholder': bookingData.applicant.address.postCode}}) }}
{{ form_row(participant.address.city, {'attr': {'placeholder': bookingData.applicant.address.city}}) }}
{{ form_row(participant.address.country, {'attr': {'placeholder': bookingData.applicant.address.country}}) }}
{% else %}
{{ form_row(participant.address.street) }}
{{ form_row(participant.address.postCode) }}
{{ form_row(participant.address.city) }}
{{ form_row(participant.address.country) }}
{% endif %}
</div>
{% endif %}
{% if participant.bodyDimensions is defined %}
<div class="grid grid-cols-2 gap-4">
{{ form_row(participant.bodyDimensions.height) }}
{{ form_row(participant.bodyDimensions.shoeSize) }}
{{ form_row(participant.bodyDimensions.weight) }}
</div>
{% endif %}
{# Room assignment - editable dropdown #}
<div class="grid grid-cols-2 gap-4">
{% if participant.assignedRoomId is defined %}
{{ form_row(participant.assignedRoomId) }}
{% endif %}
{% if participant.remarksRoom is defined %}
{{ form_row(participant.remarksRoom) }}
{% endif %}
</div>
{% if not hasDateOfBirth %}
<div class="my-4 p-4 bg-blue-50 border border-blue-200 rounded-lg">
<div class="flex items-center">
<svg class="w-5 h-5 text-blue-600 mr-2" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z" clip-rule="evenodd"></path>
</svg>
<p class="text-sm text-blue-800">
Leistungen sind erst nach Angabe des Geburtsdatums buchbar
</p>
</div>
</div>
{% elseif not isEligible %}
<div class="my-4 p-4 bg-red-50 border border-red-200 rounded-lg">
<div class="flex items-center">
<svg class="w-5 h-5 text-red-600 mr-2" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z" clip-rule="evenodd"></path>
</svg>
<p class="text-sm text-red-800">
Buchung wegen des Alters von Teilnehmer:in {{ loop.index }} nicht möglich
</p>
</div>
</div>
{% endif %}
{% if isEligible %}
<div class="grid grid-cols-2 gap-4">
{{ _self.service_field(participant, 'skiPass', 'Skipass', {
'attr': {
'hx-trigger': 'change',
'hx-post': path('app_booking_edit_refresh', {'id': bookingData.id}),
'hx-swap': 'none'
}
}) }}
{{ _self.service_field(participant, 'courses', 'Kurse', {
'attr': {
'hx-trigger': 'change',
'hx-post': path('app_booking_edit_refresh', {'id': bookingData.id}),
'hx-swap': 'none'
}
}) }}
{{ _self.service_field(participant, 'additionalServices', 'Zusatzleistungen', {
'attr': {
'hx-trigger': 'change',
'hx-post': path('app_booking_edit_refresh', {'id': bookingData.id}),
'hx-swap': 'none'
}
}) }}
{{ _self.service_field(participant, 'rentals', 'Leihmaterial', {
'attr': {
'hx-trigger': 'change',
'hx-post': path('app_booking_edit_refresh', {'id': bookingData.id}),
'hx-swap': 'none'
}
}, 'Bitte zuerst den Skipass auswählen') }}
{{ _self.checkbox_field(participant, 'rentalInsurance', 'Leihmaterial-Versicherung', {
'attr': {
'hx-trigger': 'change',
'hx-post': path('app_booking_edit_refresh', {'id': bookingData.id}),
'hx-swap': 'none'
}
}, 'Nur bei Buchung von Leihmaterial') }}
{{ _self.service_field(participant, 'board', 'Verpflegung', {
'attr': {
'hx-trigger': 'change',
'hx-post': path('app_booking_edit_refresh', {'id': bookingData.id}),
'hx-swap': 'none'
}
}) }}
<div class="col-span-2">
{# Insurance field OR assigned insurance display for dependent participants #}
{% set participantData = participant.vars.data %}
{% set showBulkInsurance = loop.index > 1 and form.vars.data.participants[0].bulkInsuranceBooking %}
{% if showBulkInsurance %}
<fieldset class="mb-1">
<legend class="font-semibold mb-1">Reiseversicherung</legend>
<div class="text-sm text-gray-600">
{% set applicantInsurance = form.vars.data.participants[0].insurance %}
{% if applicantInsurance %}
<span class="italic text-gray-500">wie Anmelder: {{ applicantInsurance.label }}</span>
{% else %}
<span class="italic text-gray-500">wie Anmelder</span>
{% endif %}
</div>
</fieldset>
{% else %}
<fieldset class="mb-1">
<legend class="font-semibold mb-1">Reiseversicherung</legend>
{# Bulk insurance booking checkbox (applicant only) #}
{% if participant.bulkInsuranceBooking is defined %}
{{ form_row(participant.bulkInsuranceBooking, {
'attr': {
'hx-trigger': 'change',
'hx-post': path('app_booking_edit_refresh', {'id': bookingData.id}),
'hx-swap': 'none'
}
}) }}
{% endif %}
{% if participant.insurance is defined %}
{{ form_row(participant.insurance, {
'attr': {
'hx-trigger': 'change',
'hx-post': path('app_booking_edit_refresh', {'id': bookingData.id}),
'hx-swap': 'none'
},
'label': false
}) }}
{% else %}
<div class="text-sm text-gray-500">Nicht wählbar</div>
{% endif %}
</fieldset>
{% endif %}
</div>
<div class="col-span-2">
<h3 class="text-xl font-semibold mb-4">Hin-/Rückreise</h3>
<div class="grid grid-cols-2 gap-4">
<div>
{% if participant.transportationOutbound is defined %}
{{ form_row(participant.transportationOutbound, {
'attr': {
'hx-trigger': 'change',
'hx-post': path('app_booking_edit_refresh', {'id': bookingData.id}),
'hx-swap': 'none'
}
}) }}
{% endif %}
{% if participant.pickup is defined %}
<div class="mt-4">
{{ form_row(participant.pickup, {
'attr': {
'hx-trigger': 'change',
'hx-post': path('app_booking_edit_refresh', {'id': bookingData.id}),
'hx-swap': 'none'
}
}) }}
</div>
{% endif %}
{% if participant.parking is defined %}
<div class="mt-4">
{{ form_row(participant.parking, {
'attr': {
'hx-trigger': 'change',
'hx-post': path('app_booking_edit_refresh', {'id': bookingData.id}),
'hx-swap': 'none'
}
}) }}
</div>
{% endif %}
{% if participant.licensePlate is defined %}
<div class="mt-4">
{{ form_row(participant.licensePlate, {
'attr': {
'hx-trigger': 'change',
'hx-post': path('app_booking_edit_refresh', {'id': bookingData.id}),
'hx-swap': 'none'
}
}) }}
</div>
{% endif %}
</div>
<div>
{% if participant.transportationInbound is defined %}
{{ form_row(participant.transportationInbound, {
'attr': {
'hx-trigger': 'change',
'hx-post': path('app_booking_edit_refresh', {'id': bookingData.id}),
'hx-swap': 'none'
}
}) }}
{% endif %}
{# Pickup inbound removed - now unified with pickup field #}
</div>
</div>
</div>
</div>
{% endif %}
{% endif %}
</div>
</fieldset>
</div>
{% endfor %}
</div>
{% endblock %}
<div class="flex justify-between">
<a href="{{ path('app_bookings') }}" class="button bg-button bg-button--secondary">Zurück</a>
<button type="submit" class="button bg-button bg-button--secondary" {{ stimulus_action('loading', 'toggle') }}>Aktualisieren</button>
</div>
{{ form_rest(form) }}
{{ form_end(form) }}
</div>
{% block booking_summary %}
<div id="booking-summary"{% if htmx_oob_swap is defined and htmx_oob_swap %} hx-swap-oob="true"{% endif %}>
{% include 'booking/_summary.html.twig' with {
'bookingCreateDto': bookingEditDto,
'participantCount': participantCount,
'groupedSelectedRooms': groupedSelectedRooms,
'assignmentCounts': assignmentCounts,
'mutableData': mutableData|default(null)
} %}
</div>
{% endblock %}
</div>
{% endblock %}
+115
View File
@@ -0,0 +1,115 @@
{% extends 'layout.html.twig' %}
{% block content %}
{% include '_partials/_flashes.html.twig' %}
<div {{ stimulus_controller('toast') }}></div>
{# Header with reload button #}
<div class="flex justify-between items-center pb-8">
<h1 class="text-3xl font-semibold">Buchung bearbeiten</h1>
<button type="button"
hx-post="{{ path('app_booking_edit_reload', {id: bookingData.id}) }}"
hx-confirm="Alle nicht gespeicherten Änderungen gehen verloren. Fortfahren?"
{{ stimulus_action('loading', 'toggle') }}
class="px-4 py-2 bg-gray-200 hover:bg-gray-300 text-gray-800 rounded transition-colors">
Änderungen verwerfen
</button>
</div>
{# Grid layout with 2/3 cards + 1/3 summary #}
<div class="grid grid-cols-3 gap-8">
{# Main content area - cards grid #}
<div id="main-content" class="col-span-2">
{% block participant_cards %}
{{ form_start(form) }}
<div>
<h2>Teilnehmer</h2>
{% if isDirty %}
<div class="mb-6 p-4 bg-yellow-50 border border-yellow-400 rounded-lg">
<div class="flex items-start">
<svg class="w-6 h-6 text-yellow-600 mr-3 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"/>
</svg>
<div>
<h3 class="font-semibold text-yellow-800">Ungespeicherte Änderungen</h3>
<p class="text-yellow-700 text-sm mt-1">
Du hast Änderungen an der Buchung vorgenommen.
Bitte denke daran, abschließend den 'Buchung aktualisieren' Button zu klicken.
</p>
</div>
</div>
</div>
{% endif %}
{# Display validation errors #}
{% if hasValidationErrors|default(false) %}
<div class="mb-4 p-4 bg-red-50 border border-red-200 rounded-lg">
<div class="flex items-start">
<svg class="w-5 h-5 text-red-600 mr-2 mt-0.5 flex-shrink-0" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z" clip-rule="evenodd"></path>
</svg>
<div>
<p class="font-semibold text-red-800 mb-1">Bitte überprüfe die Teilnehmerdaten</p>
<p class="text-sm text-red-700">Einige Teilnehmer haben noch unvollständige oder fehlerhafte Angaben. Bitte bearbeite die markierten Teilnehmer.</p>
</div>
</div>
</div>
{% endif %}
<div id="participant-cards-grid" class="space-y-4">
{% for participant in bookingDto.participants %}
{% set isCanceled = (bookingData.participantsStatus[loop.index0] ?? null) == 'S' %}
{% set hasErrors = loop.index0 in participantErrors|default([]) %}
{% include 'booking/_participant_card.html.twig' with {
'cardData': cardsData[loop.index0],
'index': loop.index0,
'mode': 'edit',
'isCanceled': isCanceled,
'hasErrors': hasErrors,
'bookingId': bookingData.id
} %}
{% endfor %}
</div>
<div class="flex justify-between mt-8">
<button type="button"
hx-post="{{ path('app_booking_edit_cancel', {id: bookingData.id}) }}"
{{ stimulus_action('loading', 'toggle') }}
class="button bg-button bg-button--secondary">
Zurück
</button>
{% if isDirty %}
<button type="submit"
{{ stimulus_action('loading', 'toggle') }}
{% if hasValidationErrors|default(false) %}
disabled
title="Bitte behebe zuerst alle Validierungsfehler"
{% endif %}
class="button bg-button bg-button--secondary {{ hasValidationErrors|default(false) ? 'opacity-50 cursor-not-allowed' : '' }}">
Buchung aktualisieren
</button>
{% endif %}
</div>
</div>
{{ form_rest(form) }}
{{ form_end(form) }}
{% endblock %}
</div>
{# Sidebar summary #}
{% block booking_summary %}
<div id="booking-summary"{% if htmx_oob_swap is defined and htmx_oob_swap %} hx-swap-oob="true"{% endif %}>
{% include 'booking/_summary.html.twig' with {
'bookingCreateDto': bookingDto,
'participantCount': participantsCount,
'pricingData': pricingData,
'groupedSelectedRooms': groupedSelectedRooms,
'assignmentCounts': assignmentCounts,
'mutableData': mutableData|default(null)
} %}
</div>
{% endblock %}
</div>
{% endblock %}