diff --git a/templates/booking/create_step_2.html.twig b/templates/booking/create_step_2.html.twig index 6c1fa5b..fe3eab7 100644 --- a/templates/booking/create_step_2.html.twig +++ b/templates/booking/create_step_2.html.twig @@ -195,48 +195,51 @@ } }) }} - {# 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 %} +
+ {# 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 %} -
- Reiseversicherung -
- {% if participantData.insurance %} - {{ participantData.insurance.label }} - {% if participantData.insurance.price and participantData.insurance.price > 0 %} - (€{{ participantData.insurance.price|number_format(2, ',', '.') }}) + {% if showBulkInsurance %} +
+ Reiseversicherung +
+ {% if participantData.insurance %} + {{ participantData.insurance.label }} + {% if participantData.insurance.price and participantData.insurance.price > 0 %} + (€{{ participantData.insurance.price|number_format(2, ',', '.') }}) + {% endif %} + – wie Anmelder + {% else %} + wie Anmelder {% endif %} - – wie Anmelder - {% else %} - wie Anmelder +
+
+ {% else %} +
+ Reiseversicherung + + {# Bulk insurance booking checkbox (applicant only) #} + {% if participant.bulkInsuranceBooking is defined %} + {{ form_row(participant.bulkInsuranceBooking) }} {% endif %} -
-
- {% else %} -
- Reiseversicherung - {# 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 %} +
Nicht wählbar
+ {% endif %} +
+ {% 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 %} -
Nicht wählbar
- {% endif %} - - {% endif %} {# Transportation Services Section #} diff --git a/templates/forms.html.twig b/templates/forms.html.twig index 92f3b4c..bfc7352 100644 --- a/templates/forms.html.twig +++ b/templates/forms.html.twig @@ -212,23 +212,30 @@ {%- endif -%} {%- set insurance = insurances[child.vars.value] ?? null -%} - {%- if insurance is not null -%} - {%- set urlsInfo = insurance.getAllUrlsInfo() -%} - {%- set urlsProductInfo = insurance.getAllUrlsProductInfo() -%} - {%- set urlsTerms = insurance.getAllUrlsTerms() -%} + {%- set urlsProductInfo = insurance is not null ? insurance.getAllUrlsProductInfo() : [] -%} + +
+ {{- form_row(child, { 'attr': child_attr }) -}} - {%- if urlsInfo is not empty -%} - {%- set child_attr = child_attr|merge({'data-urls-info': urlsInfo|json_encode}) -%} - {%- endif -%} {%- if urlsProductInfo is not empty -%} - {%- set child_attr = child_attr|merge({'data-urls-product-info': urlsProductInfo|json_encode}) -%} +
+ + +
{%- endif -%} - {%- if urlsTerms is not empty -%} - {%- set child_attr = child_attr|merge({'data-urls-terms': urlsTerms|json_encode}) -%} - {%- endif -%} - {%- endif -%} - - {{- form_row(child, { 'attr': child_attr }) -}} +
{% endfor -%} {%- else -%} {{- parent() -}}