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

57 lines
2.3 KiB
Twig

{#
Editing one occurrence. For a booking that belongs to a series this is the "override": only
this day moves, the rest of the series is untouched and the occurrence is flagged as
differing from it.
Releasing lives here too rather than on the floor plan, so the SVG needs no confirm dialogs
or inline CSRF tokens -- clicking your own desk always just opens this.
#}
{% extends 'htmx_modal.html.twig' %}
{% block title %}{{ resource.label }} ändern{% endblock %}
{% block content %}
{{ form_start(form, { attr: {
'hx-post': form.vars.action,
'hx-target': '#htmx-modal',
'hx-swap': 'outerHTML',
} }) }}
{{ form_errors(form) }}
<p class="pb-4 text-sm text-gray-500">
{{ resource.type.label }} · {{ booking.date|format_datetime(pattern: 'EEEE, d. MMMM y') }}
</p>
{% if booking.partOfSeries %}
<div class="mb-4 rounded-md bg-gray-50 px-4 py-3 text-sm">
Teil einer Serie: {{ booking.series.describe }}.
<span class="text-gray-500">Eine Änderung hier gilt nur für diesen Tag.</span>
</div>
{% endif %}
{% include 'booking/_fields.html.twig' %}
<div class="flex flex-wrap justify-between gap-2 pt-6">
{# type="button" with its own hx-post: htmx issues the release request directly, so
this never submits the surrounding edit form and no nested <form> is needed. #}
<button type="button" class="button button--small button--warning"
hx-post="{{ path('app_booking_release', { id: booking.id }) }}"
hx-vals='{{ { _token: csrf_token('release-' ~ booking.id) }|json_encode }}'
hx-confirm="{{ resource.label }} am {{ booking.date|date('d.m.Y') }} freigeben?"
hx-target="#htmx-modal"
hx-swap="outerHTML">
Freigeben
</button>
<div class="flex gap-2">
<button type="button" class="button button--neutral" {{ stimulus_action('modal', 'close') }}>
Abbrechen
</button>
<button type="submit" class="button button--primary">
Speichern
</button>
</div>
</div>
{{ form_end(form) }}
{% endblock %}