{% 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 %}
{{ label }}
{{ undefinedLabel }}
{% 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 %}
{{ label }} {{ form_row(form[fieldName], options) }}
{% else %}
{{ label }}
{{ undefinedLabel }}
{% endif %} {% endmacro %} {# Standalone participant form view (replaces main content area) #} {% block participant_form %} {% import _self as macros %}

{{ participantIndex == 0 ? 'Anmelder:in' : 'Teilnehmer:in ' ~ (participantIndex + 1) }}

{{ form_start(form, { 'attr': { 'novalidate': 'novalidate', 'hx-post': path(submitRouteName, submitRouteParams|default({index: participantIndex})), 'hx-target': '#main-content', 'hx-swap': 'innerHTML' } }) }}
{# Personal data section #}
{{ 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) }}
{# Contact information #}
{{ form_row(form.email) }} {{ form_row(form.mobile) }}
{# Address #} {% if form.address is defined %}
{{ form_row(form.address.street) }} {{ form_row(form.address.postCode) }} {{ form_row(form.address.city) }} {{ form_row(form.address.country) }}
{% endif %} {# Body dimensions #} {% if form.bodyDimensions is defined %}
{{ form_row(form.bodyDimensions.height) }} {{ form_row(form.bodyDimensions.shoeSize) }} {{ form_row(form.bodyDimensions.weight) }}
{% endif %} {# Room assignment #}
{{ 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 %}
{# 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 %}

Leistungen sind erst nach Angabe des Geburtsdatums buchbar

{% elseif not isEligible %}

Buchung wegen des Alters von Teilnehmer:in {{ participantIndex + 1 }} nicht möglich

{% endif %} {# Service selection #} {% if isEligible %}
{{ 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' } }) }}
{# Insurance field OR assigned insurance display for dependent participants #} {% set showBulkInsurance = participantIndex > 0 and bookingDto.participants[0].bulkInsuranceBooking %} {% if showBulkInsurance %}
Reiseversicherung
{% set applicantInsurance = bookingDto.participants[0].insurance %} {% if applicantInsurance %} {{ applicantInsurance.label }} {% if applicantInsurance.price and applicantInsurance.price > 0 %} (€{{ applicantInsurance.price|number_format(2, ',', '.') }}) {% endif %} – wie Anmelder {% else %} wie Anmelder {% endif %}
{% else %}
Reiseversicherung {# 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 %}
Nicht wählbar
{% endif %}
{% endif %}
{# Transportation Services Section #}

Anreise

{% 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 %}
{{ form_row(form.pickup, { 'attr': { 'hx-trigger': 'change', 'hx-post': path(refreshRouteName, refreshRouteParams|default({index: participantIndex})), 'hx-target': '#main-content', 'hx-swap': 'innerHTML' } }) }}
{% endif %} {% if form.parking is defined %}
{{ form_row(form.parking, { 'attr': { 'hx-trigger': 'change', 'hx-post': path(refreshRouteName, refreshRouteParams|default({index: participantIndex})), 'hx-target': '#main-content', 'hx-swap': 'innerHTML' } }) }}
{% endif %} {% if form.licensePlate is defined %}
{{ form_row(form.licensePlate) }}
{% endif %} {% endif %}
{% 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 %}
{% endif %}
{% if cancelRouteName is defined %} {% else %} {% endif %}
{{ form_rest(form) }} {{ form_end(form) }}
{% endblock %} {# Sidebar summary with conditional OOB swap #} {% block booking_summary %}
{% include 'booking/_summary.html.twig' with { 'bookingCreateDto': bookingDto, 'participantCount': summaryData.participantsCount, 'groupedSelectedRooms': summaryData.groupedSelectedRooms, 'assignmentCounts': summaryData.assignmentCounts, 'pricingData': pricingData } %}
{% endblock %}