Files
ephub/templates/admin/bookings.html.twig
T
2026-09-18 09:54:18 +02:00

105 lines
5.1 KiB
Twig

{#
Every booking, not just yours. The point of the screen is the "Freigeben" button on somebody
else's row: when a colleague calls in sick, their desk has to go back into the pool.
Filtering is a plain GET form -- the house rule hands navigation to the browser. The two
destructive actions open the shared confirmation modal via htmx and then navigate back here,
which is what ?return=admin says; without it a confirmed release swaps board fragments this
page does not have.
#}
{% extends 'layout.html.twig' %}
{% block title %}Verwaltung · E&P Platz{% endblock %}
{% block content %}
<a class="text-sm text-gray-500 hover:text-gray-900" href="{{ path('app_dashboard') }}">← Übersicht</a>
<h1 class="pt-2">Verwaltung</h1>
<p class="subline">Buchungen aller Mitarbeitenden.</p>
{{ form_start(form, { attr: { class: 'mt-6 rounded-md border border-gray-200 p-4' } }) }}
<div class="grid gap-4 sm:grid-cols-2 lg:grid-cols-4">
{{ form_row(form.from) }}
{{ form_row(form.to) }}
{{ form_row(form.type) }}
{{ form_row(form.user) }}
</div>
<div class="flex justify-end gap-2 pt-2">
<a class="button button--neutral" href="{{ path('app_admin_booking') }}">Zurücksetzen</a>
<button type="submit" class="button button--primary">Filtern</button>
</div>
{{ form_end(form) }}
{% if series is not empty %}
<h2 class="pt-8">Wiederkehrende Buchungen</h2>
<ul class="divide-y divide-gray-200 border-y border-gray-200">
{% for entry in series %}
<li class="flex items-center justify-between gap-4 py-3">
<div>
<div class="font-semibold">
{{ entry.user.name }}
<span class="font-normal text-gray-500">· {{ entry.resource.label }}</span>
{%- if entry.resource.group %} <span class="font-normal text-gray-500">· {{ entry.resource.group.label }}</span>{% endif %}
</div>
<div class="text-sm text-gray-500">
{{ entry.describe }} · bis {{ entry.endDate|format_datetime(pattern: 'd. MMMM y') }}
</div>
</div>
<button type="button" class="button button--small button--neutral"
hx-get="{{ path('app_series_end', { id: entry.id, return: 'admin' }) }}"
hx-target="body"
hx-swap="beforeend">
Wiederholung beenden
</button>
</li>
{% endfor %}
</ul>
{% endif %}
<h2 class="pt-8">Termine</h2>
<p class="subline">
{{ filter.fromDate|format_datetime(pattern: 'd. MMMM y') }} bis
{{ filter.toDate|format_datetime(pattern: 'd. MMMM y') }}
</p>
{% if bookings is empty %}
<p class="text-sm text-gray-500">Keine Buchungen in diesem Zeitraum.</p>
{% else %}
<ul class="divide-y divide-gray-200 border-y border-gray-200">
{% for booking in bookings %}
<li class="flex items-center justify-between gap-4 py-3">
<div>
<div class="font-semibold">
{{ booking.user.name }}
<span class="font-normal text-gray-500">
· {{ booking.date|format_datetime(pattern: 'EEE, d. MMM y') }}
· {{ booking.timeRange }}
</span>
</div>
<div class="text-sm text-gray-500">
{{ booking.resource.type.label }} · {{ booking.resource.label }}
{%- if booking.resource.group %} · {{ booking.resource.group.label }}{% endif %}
{% if booking.partOfSeries %}
<span class="badge bg-gray-100 text-gray-600 ml-1">wiederkehrend</span>
{% endif %}
{% if booking.overridden %}
<span class="badge bg-amber-100 text-amber-800 ml-1">abweichend</span>
{% endif %}
</div>
</div>
<div class="flex items-center gap-3">
<a class="text-sm underline shrink-0"
href="{{ path('app_board', { type: booking.resource.type.value, date: booking.date|date('Y-m-d') }) }}">Im Plan</a>
<button type="button" class="button button--small button--neutral"
hx-get="{{ path('app_booking_release', { id: booking.id, return: 'admin' }) }}"
hx-target="body"
hx-swap="beforeend">
Freigeben
</button>
</div>
</li>
{% endfor %}
</ul>
{% endif %}
{% endblock %}