diff --git a/templates/booking/_participant_form.html.twig b/templates/booking/_participant_form.html.twig index 290fef5..36d0d44 100644 --- a/templates/booking/_participant_form.html.twig +++ b/templates/booking/_participant_form.html.twig @@ -4,10 +4,16 @@ {# Field is in form structure - render normally as form input #} {{ form_row(form[fieldName], options) }} {% elseif is_static_text(fieldName, bookingDto, participantIndex) %} - {# Field excluded from form but should render as static text #} -
- -
{{ staticValue ?: '-' }}
+ {# Field excluded from form - render as static text in fieldset/table style #} +
+
+ {{ label }} + + + + +
{{ staticValue ?: '-' }}
+
{% endif %} {# If neither condition is true, don't render anything (truly hidden) #} @@ -169,65 +175,100 @@ } %} {% endif %} - {# Personal data section #} -
- {{ macros.field_or_static(form, 'firstName', 'Vorname', form.vars.data.participant.firstName, bookingDto, participantIndex) }} - {{ macros.field_or_static(form, 'lastName', 'Nachname', form.vars.data.participant.lastName, bookingDto, participantIndex) }} - {{ macros.field_or_static( - form, - 'dateOfBirth', - 'Geburtsdatum', - form.vars.data.participant.dateOfBirth ? form.vars.data.participant.dateOfBirth|date('d.m.Y') : null, - bookingDto, - participantIndex, - { - 'attr': { - 'hx-trigger': 'change', - 'hx-post': path(refreshRouteName, refreshRouteParams|default({index: participantIndex})), - 'hx-target': '#main-content', - 'hx-swap': 'innerHTML' - } - } - ) }} + {# Personal data and address section #} + {% set isPersonalDataStatic = is_static_text('firstName', bookingDto, participantIndex) %} + {% set isAddressStatic = is_static_text('address', bookingDto, participantIndex) %} - {% set genderLabel = form.vars.data.participant.gender == 'M' ? 'männlich' : (form.vars.data.participant.gender == 'W' ? 'weiblich' : (form.vars.data.participant.gender == 'D' ? 'divers' : null)) %} - {{ macros.field_or_static(form, 'gender', 'Geschlecht', genderLabel, bookingDto, participantIndex) }} - - {{ macros.field_or_static(form, 'nationality', 'Nationalität', form.vars.data.participant.nationality|map_nationality, bookingDto, participantIndex) }} - - {# Contact information #} - {{ macros.field_or_static(form, 'email', 'E-Mail', form.vars.data.participant.email, bookingDto, participantIndex) }} - {{ macros.field_or_static(form, 'mobile', 'Telefon (mobil)', form.vars.data.participant.mobile, bookingDto, participantIndex) }} -
- - {# Address #} - {% if form.address is defined %} -
- {# Address field is in form - render as editable form fields #} - {{ form_row(form.address.street) }} - {{ form_row(form.address.postCode) }} - {{ form_row(form.address.city) }} - {{ form_row(form.address.country) }} -
- {% elseif is_static_text('address', bookingDto, participantIndex) %} - {# Address excluded from form but should render as static text #} - {# For applicant (index 0), use booking.applicant.address which has full data from BPN #} - {# For other participants, use participants[index].address (may only have country in BPN response) #} + {% if isPersonalDataStatic and isAddressStatic %} + {# Both personal data and address are static - render in two-column grid with tables #} + {% set participant = form.vars.data.participant %} {% set addressSource = (0 == participantIndex and bookingDto.booking) ? bookingDto.booking.applicant : bookingDto.participants[participantIndex] %} -
- - {% if addressSource.address %} -
- {% if addressSource.address.street %}{{ addressSource.address.street }}
{% endif %} - {% if addressSource.address.postCode or addressSource.address.city %} - {{ addressSource.address.postCode }} {{ addressSource.address.city }}
- {% endif %} - {% if addressSource.address.country %}{{ addressSource.address.country|map_country }}{% endif %} -
- {% else %} -
-
- {% endif %} + {% set genderLabel = participant.gender == 'M' ? 'männlich' : (participant.gender == 'W' ? 'weiblich' : (participant.gender == 'D' ? 'divers' : null)) %} + +
+ {# Personal data #} +
+
+ Persönliche Daten + + + + +
+ Name: {{ participant.firstName }} {{ participant.lastName }}
+ Geburtsdatum: {{ participant.dateOfBirth ? participant.dateOfBirth|date('d.m.Y') : '-' }}
+ Geschlecht: {{ genderLabel ?: '-' }}
+ Nationalität: {{ participant.nationality ? participant.nationality|map_nationality : '-' }}
+ E-Mail: {{ participant.email ?: '-' }}
+ Telefon: {{ participant.mobile ?: '-' }} +
+
+
+ + {# Address #} +
+
+ Adresse + + + + +
+ {% if addressSource.address %} + {% if addressSource.address.street %}{{ addressSource.address.street }}
{% endif %} + {% if addressSource.address.postCode or addressSource.address.city %} + {{ addressSource.address.postCode }} {{ addressSource.address.city }}
+ {% endif %} + {% if addressSource.address.country %}{{ addressSource.address.country|map_country }}{% endif %} + {% else %} + - + {% endif %} +
+
+
+ {% else %} + {# Editable form fields for personal data #} +
+ {{ macros.field_or_static(form, 'firstName', 'Vorname', form.vars.data.participant.firstName, bookingDto, participantIndex) }} + {{ macros.field_or_static(form, 'lastName', 'Nachname', form.vars.data.participant.lastName, bookingDto, participantIndex) }} + {{ macros.field_or_static( + form, + 'dateOfBirth', + 'Geburtsdatum', + form.vars.data.participant.dateOfBirth ? form.vars.data.participant.dateOfBirth|date('d.m.Y') : null, + bookingDto, + participantIndex, + { + 'attr': { + 'hx-trigger': 'change', + 'hx-post': path(refreshRouteName, refreshRouteParams|default({index: participantIndex})), + 'hx-target': '#main-content', + 'hx-swap': 'innerHTML' + } + } + ) }} + + {% set genderLabel = form.vars.data.participant.gender == 'M' ? 'männlich' : (form.vars.data.participant.gender == 'W' ? 'weiblich' : (form.vars.data.participant.gender == 'D' ? 'divers' : null)) %} + {{ macros.field_or_static(form, 'gender', 'Geschlecht', genderLabel, bookingDto, participantIndex) }} + + {{ macros.field_or_static(form, 'nationality', 'Nationalität', form.vars.data.participant.nationality|map_nationality, bookingDto, participantIndex) }} + + {# Contact information #} + {{ macros.field_or_static(form, 'email', 'E-Mail', form.vars.data.participant.email, bookingDto, participantIndex) }} + {{ macros.field_or_static(form, 'mobile', 'Telefon (mobil)', form.vars.data.participant.mobile, bookingDto, participantIndex) }} +
+ + {# Address #} + {% if form.address is defined %} +
+ {# Address field is in form - render as editable form fields #} + {{ form_row(form.address.street) }} + {{ form_row(form.address.postCode) }} + {{ form_row(form.address.city) }} + {{ form_row(form.address.country) }} +
+ {% endif %} {% endif %} {# Room assignment - hidden until date of birth is provided, or shown as static text in edit mode #}