feat: always show all available ski passes but readonly if age doesn't match

This commit is contained in:
Björn Fromme
2025-12-12 08:47:25 +01:00
parent c3519124b7
commit 1d97a19982
6 changed files with 191 additions and 18 deletions
+10 -5
View File
@@ -68,17 +68,22 @@
{% if choiceData %}
<td class="border border-primary-bg p-2 align-top w-24 text-right whitespace-nowrap">
{% if choiceData.price is defined %}
{{ choiceData.price | format_service_price }}
{% set isPkw = choiceData.subType is defined and choiceData.subType in ['PKW', 'CAR'] %}
{{ choiceData.price | format_service_price(not isPkw) }}
{% endif %}
</td>
{% endif %}
<td class="border border-primary-bg p-2 align-top w-12 text-center">
{% set childTooltip = child.vars.attr['data-tooltip']|default(null) %}
<div class="{{ html_classes({ 'cursor-not-allowed': isReadonly }) }}"{% if childTooltip is not null %} {{ stimulus_controller('tooltip', { 'content': childTooltip }) }}{% endif %}>
<div class="{{ isReadonly ? 'pointer-events-none' : '' }}">
{{- form_widget(child, { 'attr': child_attr }) -}}
{% if isReadonly or childTooltip is not null %}
<div{% if isReadonly %} class="cursor-not-allowed"{% endif %}{% if childTooltip is not null %} {{ stimulus_controller('tooltip', { 'content': childTooltip }) }}{% endif %}>
<div{% if isReadonly %} class="pointer-events-none"{% endif %}>
{{- form_widget(child, { 'attr': child_attr }) -}}
</div>
</div>
</div>
{% else %}
{{- form_widget(child, { 'attr': child_attr }) -}}
{% endif %}
</td>
</tr>
{% endfor -%}
+14 -7
View File
@@ -97,8 +97,11 @@
{# Macro to render insurance choice table row with product info links #}
{% macro insurance_choice_row(child, price, urlsProductInfo, widgetAttr = {}) %}
{% macro insurance_choice_row(child, choiceData, widgetAttr = {}) %}
{% set isReadonly = child.vars.attr.readonly is defined %}
{% set isNoInsurance = choiceData.noInsurance|default(false) %}
{% set price = choiceData.price|default(null) %}
{% set urlsProductInfo = choiceData ? choiceData.getAllUrlsProductInfo() : [] %}
<tr>
<td class="border border-primary-bg p-2 align-top">
<div>{{ child.vars.label }}</div>
@@ -120,15 +123,19 @@
{%- endif -%}
</td>
<td class="border border-primary-bg p-2 align-top w-24 text-right whitespace-nowrap">
{{ price | format_service_price }}
{{ price | format_service_price(not isNoInsurance) }}
</td>
<td class="border border-primary-bg p-2 align-top w-12 text-center">
{% set childTooltip = child.vars.attr['data-tooltip']|default(null) %}
<div class="{{ html_classes({ 'cursor-not-allowed': isReadonly }) }}"{% if childTooltip is not null %} {{ stimulus_controller('tooltip', { 'content': childTooltip }) }}{% endif %}>
<div class="{{ isReadonly ? 'pointer-events-none' : '' }}">
{{ form_widget(child, { 'attr': widgetAttr }) }}
{% if isReadonly or childTooltip is not null %}
<div{% if isReadonly %} class="cursor-not-allowed"{% endif %}{% if childTooltip is not null %} {{ stimulus_controller('tooltip', { 'content': childTooltip }) }}{% endif %}>
<div{% if isReadonly %} class="pointer-events-none"{% endif %}>
{{ form_widget(child, { 'attr': widgetAttr }) }}
</div>
</div>
</div>
{% else %}
{{ form_widget(child, { 'attr': widgetAttr }) }}
{% endif %}
</td>
</tr>
{% endmacro %}
@@ -496,7 +503,7 @@
{% endif %}
{% for child in form.insurance %}
{% set choiceData = form.insurance.vars.choices[loop.index0].data %}
{{ macros.insurance_choice_row(child, choiceData.price|default(null), choiceData ? choiceData.getAllUrlsProductInfo() : [], htmxAttr) }}
{{ macros.insurance_choice_row(child, choiceData, htmxAttr) }}
{% endfor %}
</table>
{% else %}