From 293574187f4d526b2e210aab344166956470ba57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Fromme?= Date: Fri, 24 Oct 2025 11:23:19 +0200 Subject: [PATCH] feat: price info tooltip for bulk insurance booking addresses #869axbjzz --- .../ParticipantFieldOptionsProvider.php | 3 + templates/forms.html.twig | 69 ++++++++++++------- 2 files changed, 49 insertions(+), 23 deletions(-) diff --git a/src/Form/Service/ParticipantFieldOptionsProvider.php b/src/Form/Service/ParticipantFieldOptionsProvider.php index 9d4a428..e7e311b 100644 --- a/src/Form/Service/ParticipantFieldOptionsProvider.php +++ b/src/Form/Service/ParticipantFieldOptionsProvider.php @@ -442,6 +442,9 @@ class ParticipantFieldOptionsProvider extends AbstractFieldOptionsProvider $this->fieldOptionProviders['bulkInsuranceBooking'] = fn (BookingDto $bookingDto, int $participantIndex, array $options = []) => [ 'label' => 'Für alle Teilnehmer buchen', 'required' => false, + 'attr' => [ + 'data-description' => 'Der hier angezeigte Preis gilt nur für den/die Anmelder:in. Die Preise für die anderen Teilnehmer:innen werden automatisch aktualisiert.', + ], ]; // Insurance field provider - provides age and eligibility filtered insurances for participants diff --git a/templates/forms.html.twig b/templates/forms.html.twig index 1857685..630d7c0 100644 --- a/templates/forms.html.twig +++ b/templates/forms.html.twig @@ -1,5 +1,21 @@ {% use 'form_div_layout.html.twig' %} +{# Macro to render info icon tooltip for descriptions #} +{% macro info_tooltip(description) %} +
+ + +
+{% endmacro %} + {%- block form_row -%} {%- set row_attr = row_attr|merge({ 'class': (row_attr.class|default('') ~ ' mb-1')|trim }) -%} {%- set widget_attr = {} -%} @@ -120,11 +136,13 @@ {%- endblock radio_widget -%} {% block checkbox_row %} + {%- import _self as forms -%} {%- set tooltip = null -%} {%- if form.vars.attr['data-tooltip'] is defined -%} {%- set tooltip = form.vars.attr['data-tooltip'] -%} {%- endif -%} -
+ {%- set description = form.vars.attr['data-description'] ?? null -%} +
+ {%- if description is not null -%} + {{ forms.info_tooltip(description) }} + {%- endif -%} +
+{% endblock %} + +{% block radio_row %} + {%- import _self as forms -%} + {%- set tooltip = null -%} + {%- if form.vars.attr['data-tooltip'] is defined -%} + {%- set tooltip = form.vars.attr['data-tooltip'] -%} + {%- endif -%} + {%- set description = form.vars.attr['data-description'] ?? null -%} +
+ + {%- if description is not null -%} + {{ forms.info_tooltip(description) }} + {%- endif -%}
{% endblock %} @@ -174,28 +218,7 @@ {%- if child.vars.attr['data-tooltip'] is defined -%} {%- set child_attr = child_attr|merge({'data-tooltip': child.vars.attr['data-tooltip']}) -%} {%- endif -%} - - {%- set description = child.vars.attr['data-description'] ?? null -%} - - {%- if description is not null -%} -
- {{- form_row(child, { 'attr': child_attr }) -}} -
- - -
-
- {%- else -%} - {{- form_row(child, { 'attr': child_attr }) -}} - {%- endif -%} + {{- form_row(child, { 'attr': child_attr }) -}} {% endfor -%} {%- endblock choice_widget_expanded -%}