feat: replace toasts

This commit is contained in:
Björn Fromme
2025-01-26 18:47:11 +01:00
parent 289668bcbd
commit 8e931c95e3
15 changed files with 54 additions and 111 deletions
+3 -29
View File
@@ -1,37 +1,11 @@
{% extends 'layout.html.twig' %}
{% block content %}
{% include '_partials/_flashes.html.twig' %}
{{ form_start(form) }}
{% if not form.vars.valid %}
<div class="rounded-md bg-red-50 p-4 mb-4">
<div class="flex">
<div class="shrink-0">
<svg class="size-5 text-red-400" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" data-slot="icon">
<path fill-rule="evenodd" d="M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16ZM8.28 7.22a.75.75 0 0 0-1.06 1.06L8.94 10l-1.72 1.72a.75.75 0 1 0 1.06 1.06L10 11.06l1.72 1.72a.75.75 0 1 0 1.06-1.06L11.06 10l1.72-1.72a.75.75 0 0 0-1.06-1.06L10 8.94 8.28 7.22Z" clip-rule="evenodd" />
</svg>
</div>
<div class="ml-3">
{% if form.vars.errors|length > 0 %}
<h3 class="text-sm font-medium text-red-800">
Die Buchung konnte nicht aktualisiert werden
</h3>
<div class="mt-2 text-sm text-red-700">
<ul role="list" class="list-disc space-y-1 pl-5">
{% for error in form.vars.errors %}
<li>
{{ error.message }}
</li>
{% endfor %}
</ul>
</div>
{% else %}
<h3 class="text-sm font-medium text-red-800">
Die Buchung konnte nicht aktualisiert werden. Problematische Eingaben wurden entsprechend markiert.
</h3>
{% endif %}
</div>
</div>
</div>
{% set messages = form.vars.errors|map(error => error.message) %}
{% include '_partials/_alert.html.twig' with { 'level': 'error', 'title': 'Die Buchung konnte nicht aktualisiert werden', 'messages': messages } %}
{% endif %}
<div class="flex flex-col space-y-8 pb-4" {{ stimulus_controller('booking', { 'availabilities': availabilities.items }) }}>
<div class="p-8 border border-gray-300 rounded-md"