{# The booking modal. Extending htmx_modal.html.twig keeps it a standalone fragment -- it is a valid response on its own, which is what the opener's hx-swap="beforeend" onto
needs. The form targets the modal itself with outerHTML, which does double duty: * invalid submit -> Symfony returns 422, htmx swaps it (see responseHandling in app.js) and the modal replaces itself with the errors showing; * success -> the response is nothing but out-of-band board blocks, so the modal is replaced with an empty fragment, i.e. it closes. #} {% extends 'htmx_modal.html.twig' %} {% block title %}{{ resource.label }} buchen{% endblock %} {% block content %} {{ form_start(form, { attr: { 'hx-post': form.vars.action, 'hx-target': '#htmx-modal', 'hx-swap': 'outerHTML', } }) }} {# Root-level errors, which is where a rejected booking lands -- form_end/form_rest does NOT render these, so leaving this out makes the 422 path silently blank. #} {{ form_errors(form) }}{{ resource.type.label }} ยท {{ resource.label }}
{% include 'booking/_fields.html.twig' %}