wip: collapsible forms

This commit is contained in:
Björn Fromme
2026-03-16 11:59:09 +01:00
parent d205cd09ef
commit 8da77ee13b
+13 -3
View File
@@ -12,10 +12,18 @@
{% block participants_form %}
<div id="participants-form" class="space-y-8 pb-8"{% if htmx_oob_swap is defined and htmx_oob_swap %} hx-swap-oob="true"{% endif %}>
{% for participant in form.participants %}
<fieldset class="border rounded-md p-8 pt-4">
<legend class="font-bold text-xl px-2">
Teilnehmer:in {{ loop.index }}
{% set participantDataValid = participant.vars.valid %}
<div class="{{ html_classes('border rounded px-4 py-2', { 'border-gray-300': participantDataValid, 'border-red-700': not participantDataValid }) }}" {{ stimulus_controller('toggle', {'open': participant.vars.valid == false}, { 'closed': 'hidden' }) }}>
<fieldset>
<legend class="w-full flex items-center justify-between">
<span class="font-bold text-xl">Teilnehmer:in {{ loop.index }}</span>
<button type="button" tabindex="0" {{ stimulus_action('toggle', 'toggle') }}>
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6" {{ stimulus_target('toggle', 'icon') }}>
<path stroke-linecap="round" stroke-linejoin="round" d="M8.25 4.5l7.5 7.5-7.5 7.5" />
</svg>
</button>
</legend>
<div class="hidden py-4" {{ stimulus_target('toggle', 'toggle') }}>
<div class="grid grid-cols-2 gap-4 pb-4">
{{ form_row(participant.firstName) }}
{{ form_row(participant.lastName) }}
@@ -41,7 +49,9 @@
}
}) }}
</div>
</div>
</fieldset>
</div>
{% endfor %}
</div>
{% endblock %}