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

58 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 a card needs no confirm dialogs
or inline CSRF tokens -- clicking your own desk always just opens this. The release button
opens the shared confirmation modal over this one.
#}
{% 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') }}
{%- if resource.group %} · {{ resource.group.label }}{% endif %}
</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-get: htmx opens the confirmation modal over this
one, so nothing submits the surrounding edit form and no nested <form> is needed.
Confirming removes both modals -- see Booking\ReleaseController. #}
<button type="button" class="button button--small button--warning"
hx-get="{{ path('app_booking_release', { id: booking.id }) }}"
hx-target="body"
hx-swap="beforeend">
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 %}