feat: customizable label for unavailable services

This commit is contained in:
Björn Fromme
2025-10-02 16:56:37 +02:00
parent 32ec2c1deb
commit 8984b2edd5
+6 -6
View File
@@ -24,19 +24,19 @@
{% import _self as macros %}
{# Macro to render a field or placeholder with consistent fieldset structure #}
{% macro service_field(participant, fieldName, label, options = {}) %}
{% macro service_field(participant, fieldName, label, options = {}, undefinedLabel = 'Nicht wählbar') %}
{% if participant[fieldName] is defined %}
{{ form_row(participant[fieldName], options) }}
{% else %}
<fieldset class="mb-1">
<legend class="font-semibold mb-1">{{ label }}</legend>
<div class="text-sm text-gray-500">Nicht wählbar</div>
<div class="text-sm text-gray-500">{{ undefinedLabel }}</div>
</fieldset>
{% endif %}
{% endmacro %}
{# Specialized macro for checkbox fields (like rental insurance) that need manual fieldset wrapping #}
{% macro checkbox_field(participant, fieldName, label, options = {}) %}
{% macro checkbox_field(participant, fieldName, label, options = {}, undefinedLabel = 'Nicht wählbar') %}
{% if participant[fieldName] is defined %}
<fieldset class="mb-1">
<legend class="font-semibold mb-1">{{ label }}</legend>
@@ -45,7 +45,7 @@
{% else %}
<fieldset class="mb-1">
<legend class="font-semibold mb-1">{{ label }}</legend>
<div class="text-sm text-gray-500">Nicht wählbar</div>
<div class="text-sm text-gray-500">{{ undefinedLabel }}</div>
</fieldset>
{% endif %}
{% endmacro %}
@@ -177,7 +177,7 @@
'hx-post': path('app_booking_create_step_2_refresh'),
'hx-swap': 'none'
}
}) }}
}, 'Bitte zuerst den Skipass auswählen') }}
{{ _self.checkbox_field(participant, 'rentalInsurance', 'Leihmaterial-Versicherung', {
'attr': {
@@ -185,7 +185,7 @@
'hx-post': path('app_booking_create_step_2_refresh'),
'hx-swap': 'none'
}
}) }}
}, 'Nur bei Buchung von Leihmaterial') }}
{{ _self.service_field(participant, 'board', 'Verpflegung', {
'attr': {