feat: paginate the admin booking list

This commit is contained in:
fromme committed 2026-09-18 10:53:55 +02:00
1 parent ba64033948
commit 2f5d1d14e4
16 files changed
+504 -75

No files matched your search

+97 -65
View File
@@ -6,6 +6,9 @@
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.
The appointment table is paginated; the series table is not, because a company has a handful of
standing bookings and cutting them across pages would only hide them.
#}
{% extends 'layout.html.twig' %}
@@ -25,80 +28,109 @@
{{ 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>
<a class="button button--small button--neutral" href="{{ path('app_admin_booking') }}">Zurücksetzen</a>
<button type="submit" class="button button--small 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>
<h2 class="pt-8 pb-4">Wiederkehrende Buchungen</h2>
<div class="data-table-wrapper">
<div class="data-table-wrapper__inner text-sm">
<table class="data-table">
<thead>
<tr>
<th>Mitarbeiter:in</th>
<th>Ressource</th>
<th>Gruppe</th>
<th>Wiederholung</th>
<th>Bis</th>
<th></th>
</tr>
</thead>
<tbody>
{% for entry in series %}
<tr>
<td class="font-semibold">{{ entry.user.name }}</td>
<td>{{ entry.resource.label }}</td>
<td>{{ entry.resource.group ? entry.resource.group.label : '–' }}</td>
<td>{{ entry.describe }}</td>
<td>{{ entry.endDate|format_datetime(pattern: 'd. MMMM y') }}</td>
<td class="text-right">
<button type="button" class="button button--small button--warning"
hx-get="{{ path('app_series_end', { id: entry.id, return: 'admin' }) }}"
hx-target="body"
hx-swap="beforeend">
Wiederholung beenden
</button>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% endif %}
<h2 class="pt-8">Termine</h2>
<p class="subline">
<p class="subline pb-4">
{{ 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 %}
<div class="data-table-wrapper">
<div class="data-table-wrapper__inner text-sm">
<table class="data-table">
<thead>
<tr>
<th>{{ knp_pagination_sortable(pagination, 'Mitarbeiter:in', 'u.name') }}</th>
<th>{{ knp_pagination_sortable(pagination, 'Datum', 'b.date') }}</th>
<th>{{ knp_pagination_sortable(pagination, 'Zeit', 'b.startMinute') }}</th>
<th>{{ knp_pagination_sortable(pagination, 'Typ', 'r.type') }}</th>
<th>{{ knp_pagination_sortable(pagination, 'Ressource', 'r.label') }}</th>
<th>Gruppe</th>
<th>Status</th>
<th></th>
</tr>
</thead>
<tbody>
{% for booking in pagination %}
<tr>
<td class="font-semibold">{{ booking.user.name }}</td>
<td class="whitespace-nowrap">{{ booking.date|format_datetime(pattern: 'EEE, d. MMM y') }}</td>
<td class="whitespace-nowrap">{{ booking.timeRange }}</td>
<td>{{ booking.resource.type.label }}</td>
<td>{{ booking.resource.label }}</td>
<td>{{ booking.resource.group ? booking.resource.group.label : '–' }}</td>
<td>
{% if booking.partOfSeries %}
<span class="badge bg-gray-100 text-gray-600">wiederkehrend</span>
{% endif %}
{% if booking.overridden %}
<span class="badge bg-amber-100 text-amber-800">abweichend</span>
{% endif %}
</td>
<td class="text-right">
<div class="flex items-center justify-end gap-2">
<a class="button button--small button--neutral"
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--warning"
hx-get="{{ path('app_booking_release', { id: booking.id, return: 'admin' }) }}"
hx-target="body"
hx-swap="beforeend">
Freigeben
</button>
</div>
</td>
</tr>
{% else %}
<tr>
<td colspan="8" class="text-gray-500">Keine Buchungen in diesem Zeitraum.</td>
</tr>
{% endfor %}
</tbody>
</table>
{{ knp_pagination_render(pagination) }}
</div>
</div>
{% endblock %}