feat: insurance info urls in tooltips

This commit is contained in:
Björn Fromme
2025-10-02 17:28:53 +02:00
parent 8984b2edd5
commit 8e43edcbaf
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 #} <div class="col-span-2">
{% set participantData = participant.vars.data %} {# Insurance field OR assigned insurance display for dependent participants #}
{% set showBulkInsurance = loop.index > 1 and form.vars.data.participants[0].bulkInsuranceBooking %} {% set participantData = participant.vars.data %}
{% set showBulkInsurance = loop.index > 1 and form.vars.data.participants[0].bulkInsuranceBooking %}
{% if showBulkInsurance %} {% if showBulkInsurance %}
<fieldset class="mb-1"> <fieldset class="mb-1">
<legend class="font-semibold mb-1">Reiseversicherung</legend> <legend class="font-semibold mb-1">Reiseversicherung</legend>
<div class="text-sm text-gray-600"> <div class="text-sm text-gray-600">
{% if participantData.insurance %} {% if participantData.insurance %}
{{ participantData.insurance.label }} {{ participantData.insurance.label }}
{% if participantData.insurance.price and participantData.insurance.price > 0 %} {% if participantData.insurance.price and participantData.insurance.price > 0 %}
<span class="text-gray-500">(€{{ participantData.insurance.price|number_format(2, ',', '.') }})</span> <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 %} {% endif %}
<span class="italic text-gray-500 ml-2"> wie Anmelder</span> </div>
{% else %} </fieldset>
<span class="italic">wie Anmelder</span> {% 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 %} {% endif %}
</div>
</fieldset>
{% else %}
<fieldset class="mb-1">
<legend class="font-semibold mb-1">Reiseversicherung</legend>
{# Bulk insurance booking checkbox (applicant only) #} {% if participant.insurance is defined %}
{% if participant.bulkInsuranceBooking is defined %} {{ form_row(participant.insurance, {
{{ form_row(participant.bulkInsuranceBooking) }} 'attr': {
{% endif %} '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> </div>
{# Transportation Services Section #} {# Transportation Services Section #}
+21 -14
View File
@@ -212,23 +212,30 @@
{%- endif -%} {%- endif -%}
{%- set insurance = insurances[child.vars.value] ?? null -%} {%- set insurance = insurances[child.vars.value] ?? null -%}
{%- if insurance is not null -%} {%- set urlsProductInfo = insurance is not null ? insurance.getAllUrlsProductInfo() : [] -%}
{%- set urlsInfo = insurance.getAllUrlsInfo() -%}
{%- set urlsProductInfo = insurance.getAllUrlsProductInfo() -%} <div class="flex gap-2">
{%- set urlsTerms = insurance.getAllUrlsTerms() -%} {{- 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 -%} {%- 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 -%} {%- endif -%}
{%- if urlsTerms is not empty -%} </div>
{%- set child_attr = child_attr|merge({'data-urls-terms': urlsTerms|json_encode}) -%}
{%- endif -%}
{%- endif -%}
{{- form_row(child, { 'attr': child_attr }) -}}
{% endfor -%} {% endfor -%}
{%- else -%} {%- else -%}
{{- parent() -}} {{- parent() -}}