Files
ephub/templates/booking/_fields.html.twig
T

38 lines
1.5 KiB
Twig

{#
The shared body of both booking modals. Which fields exist is decided by the controller
(the edit modal removes date and the recurrence fields), so everything here is guarded with
`is defined` rather than duplicated into two templates.
Show/hide is Stimulus, not htmx: toggling a fieldset needs no server round trip, and the
house rule keeps purely client-side behaviour out of htmx.
#}
<div {{ stimulus_controller('bookingform') }}>
{% if form.date is defined %}
{{ form_row(form.date) }}
{% endif %}
<div class="pt-4">
{{ form_row(form.allDay, { attr: { 'data-action': 'bookingform#toggleTimes' } }) }}
<div class="grid grid-cols-2 gap-4 pt-2 {{ form.allDay.vars.data ? 'hidden' : '' }}"
{{ stimulus_target('bookingform', 'times') }}>
{{ form_row(form.startTime) }}
{{ form_row(form.endTime) }}
</div>
</div>
{% if form.repeat is defined %}
<div class="pt-4 border-t border-gray-200 mt-4">
{{ form_row(form.repeat, { attr: { 'data-action': 'bookingform#toggleRepeat' } }) }}
<div class="pt-2 {{ form.repeat.vars.data is null ? 'hidden' : '' }}"
{{ stimulus_target('bookingform', 'repeat') }}>
{{ form_row(form.until) }}
<p class="pt-1 text-xs text-gray-500">
Belegte Tage werden übersprungen und danach aufgelistet.
</p>
</div>
</div>
{% endif %}
</div>