Files
ephub/templates/admin/_modal_resource.html.twig
T

42 lines
1.3 KiB
Twig

{#
Creating and editing a resource. Same double duty as the booking modal: the form
targets the modal itself, so an invalid submit (422) replaces it with the errors showing, and a
valid one answers with HX-Redirect back to the list.
#}
{% extends 'htmx_modal.html.twig' %}
{% block title %}
{%- if resource.id -%}
{{ resource.label }} bearbeiten
{%- else -%}
{{ resource.type.label }} hinzufügen
{%- endif -%}
{% endblock %}
{% block content %}
{{ form_start(form, { attr: {
'hx-post': form.vars.action,
'hx-target': '#htmx-modal',
'hx-swap': 'outerHTML',
} }) }}
{{ form_errors(form) }}
<div class="space-y-4">
{{ form_row(form.label) }}
{{ form_row(form.group) }}
{% if form.active is defined %}
{{ form_row(form.active) }}
{% endif %}
</div>
<div class="flex justify-end gap-2 pt-6">
<button type="button" class="button button--neutral" {{ stimulus_action('modal', 'close') }}>
Abbrechen
</button>
<button type="submit" class="button button--primary">
Speichern
</button>
</div>
{{ form_end(form) }}
{% endblock %}