feat: insurance info urls in tooltips

This commit is contained in:
Björn Fromme
2026-03-16 11:59:10 +01:00
parent d6258d0ca1
commit 57843b8a6f
2 changed files with 61 additions and 51 deletions
+40 -37
View File
@@ -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 %}
<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">
{% if participantData.insurance %}
{{ participantData.insurance.label }}
{% if participantData.insurance.price and participantData.insurance.price > 0 %}
<span class="text-gray-500">(€{{ participantData.insurance.price|number_format(2, ',', '.') }})</span>
{% if showBulkInsurance %}
<fieldset class="mb-1">
<legend class="font-semibold mb-1">Reiseversicherung</legend>
<div class="text-sm text-gray-600">
{% if participantData.insurance %}
{{ participantData.insurance.label }}
{% if participantData.insurance.price and participantData.insurance.price > 0 %}
<span class="text-gray-500">(€{{ participantData.insurance.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 %}
<span class="italic text-gray-500 ml-2"> wie Anmelder</span>
{% else %}
<span class="italic">wie Anmelder</span>
</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 %}
</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>
{% 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>
{# Transportation Services Section #}
+21 -14
View File
@@ -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() : [] -%}
<div class="flex gap-2">
{{- 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}) -%}
<div class="flex flex-col justify-center" {{ stimulus_controller('tooltip') }}>
<button type="button" data-tooltip-target="trigger" class="text-blue-600 hover:text-blue-800">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-5 h-5">
<path stroke-linecap="round" stroke-linejoin="round" d="M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z" />
</svg>
</button>
<template data-tooltip-target="template">
<div class="text-sm">
{%- for url in urlsProductInfo -%}
<a href="{{ url }}" target="_blank" rel="noopener noreferrer" class="block">
Produktinformation {{ loop.index }}
</a>
{%- endfor -%}
</div>
</template>
</div>
{%- 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 }) -}}
</div>
{% endfor -%}
{%- else -%}
{{- parent() -}}