From b88ad24c3dd8967fdd605b3ea96fee173c6d1bb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Fromme?= Date: Thu, 23 Oct 2025 11:07:47 +0200 Subject: [PATCH] feat: display service descriptions as tooltip with info icon addresses #869axbnj0 --- .../ParticipantFieldOptionsProvider.php | 15 ++++++++++++ templates/forms.html.twig | 23 ++++++++++++++++++- 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/src/Form/Service/ParticipantFieldOptionsProvider.php b/src/Form/Service/ParticipantFieldOptionsProvider.php index 7890ab6..f111473 100644 --- a/src/Form/Service/ParticipantFieldOptionsProvider.php +++ b/src/Form/Service/ParticipantFieldOptionsProvider.php @@ -222,6 +222,11 @@ class ParticipantFieldOptionsProvider extends AbstractFieldOptionsProvider $attributes = []; + // Add service description as data attribute for frontend use + if (null !== $service->description && '' !== trim($service->description)) { + $attributes['data-description'] = $service->description; + } + // Make readonly if service is unavailable (intelligently handles edit mode) if ($this->shouldMakeServiceReadonly($service, $bookingDto, $participantIndex, 'board')) { $attributes['readonly'] = true; @@ -366,6 +371,11 @@ class ParticipantFieldOptionsProvider extends AbstractFieldOptionsProvider $attributes = []; + // Add service description as data attribute for frontend use + if (null !== $service->description && '' !== trim($service->description)) { + $attributes['data-description'] = $service->description; + } + // Make readonly if service is unavailable (intelligently handles edit mode) if ($this->shouldMakeServiceReadonly($service, $bookingDto, $participantIndex, 'transportationOutbound')) { $attributes['readonly'] = true; @@ -392,6 +402,11 @@ class ParticipantFieldOptionsProvider extends AbstractFieldOptionsProvider $attributes = []; + // Add service description as data attribute for frontend use + if (null !== $service->description && '' !== trim($service->description)) { + $attributes['data-description'] = $service->description; + } + // Make readonly if service is unavailable (intelligently handles edit mode) if ($this->shouldMakeServiceReadonly($service, $bookingDto, $participantIndex, 'transportationInbound')) { $attributes['readonly'] = true; diff --git a/templates/forms.html.twig b/templates/forms.html.twig index 51ae533..7720548 100644 --- a/templates/forms.html.twig +++ b/templates/forms.html.twig @@ -174,7 +174,28 @@ {%- if child.vars.attr['data-tooltip'] is defined -%} {%- set child_attr = child_attr|merge({'data-tooltip': child.vars.attr['data-tooltip']}) -%} {%- endif -%} - {{- form_row(child, { 'attr': child_attr }) -}} + + {%- 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 -%} {% endfor -%} {%- endblock choice_widget_expanded -%}