feat: admin list filtering and search

This commit is contained in:
Björn Fromme
2026-08-06 10:57:36 +02:00
parent aa8fa5c1b2
commit dd658bf9d6
41 changed files with 1977 additions and 44 deletions
+45
View File
@@ -0,0 +1,45 @@
{#
Shared filter modal for admin list views.
Expects:
- form: FormView of the entity's filter form (a GET form pointing at the list route)
- route: route name of the list, used by the reset link
Entity templates extend this and override `fields` when their filters need more layout than
a plain form_rest gives them.
#}
{% extends 'htmx_modal_admin.html.twig' %}
{% form_theme form 'forms_admin.html.twig' %}
{% import '_partials/_query_passthrough.html.twig' as passthrough %}
{% block title %}Filter{% endblock %}
{% block content %}
{{ form_start(form) }}
{# Sorting, page size and the return URL are not filters, but they describe the same list. #}
{{ passthrough.render(app.request.query.all|filter((value, key) => key in ['sort', 'direction', 'limit', 'r'])) }}
{# The filter marker is a field of the form, so render it here rather than leaving it to a
form_rest() call an entity template might not make. #}
{{ form_widget(form.f) }}
<div class="grid lg:grid-cols-2 gap-y-4 lg:gap-x-8">
{% block fields %}
<div class="lg:col-span-2">
{{ form_row(form.q) }}
</div>
{{ form_row(form.dateFrom) }}
{{ form_row(form.dateTo) }}
{{ form_rest(form) }}
{% endblock %}
</div>
<div class="flex justify-between items-center pt-8">
<a href="{{ path(route) }}" class="text-sm text-gray-600 underline hover:text-gray-900">
auf Standard zurücksetzen
</a>
<button type="submit" class="button button--primary button--small">
anwenden
</button>
</div>
{{ form_end(form) }}
{% endblock %}
@@ -2,6 +2,12 @@
{% block content %}
<twig:page:heading>Buchungen & Anfragen</twig:page:heading>
{{ include('_partials/_list_filter_bar.html.twig', {
'filter': filter,
'form': filter_form,
'route': 'app_admin_accommodationbooking',
'modal_route': 'app_admin_accommodationbooking_filter',
}) }}
<div class="data-table-wrapper">
<div class="data-table-wrapper__inner text-sm">
<table class="data-table">
@@ -88,8 +94,8 @@
</tr>
{% else %}
<tr>
<td colspan="8">
Keine Daten...
<td colspan="9">
{{ filter.isActive ? 'Keine Treffer für diesen Filter.' : 'Keine Daten...' }}
</td>
</tr>
{% endfor %}
@@ -0,0 +1,27 @@
{% extends 'admin/_modal_filter.html.twig' %}
{% block fields %}
<div class="lg:col-span-2">
{{ form_row(form.q) }}
</div>
{{ form_row(form.dateFrom) }}
{{ form_row(form.dateTo) }}
{{ form_row(form.status) }}
{{ form_row(form.type) }}
<div class="lg:col-span-2">
{{ form_row(form.accommodation) }}
</div>
{# Both are group-admin only, but they appear independently: triage by "no assignment" works
even before anybody holds a groups role and there is a manager to pick. #}
{% if form.managedBy is defined %}
<div>
{{ form_row(form.managedBy) }}
</div>
{% endif %}
{% if form.unassigned is defined %}
<div class="flex items-end pb-1">
{{ form_row(form.unassigned) }}
</div>
{% endif %}
{{ form_rest(form) }}
{% endblock %}
@@ -2,6 +2,12 @@
{% block content %}
<twig:page:heading>Buchungsentwürfe</twig:page:heading>
{{ include('_partials/_list_filter_bar.html.twig', {
'filter': filter,
'form': filter_form,
'route': 'app_admin_bookingeditdraft',
'modal_route': 'app_admin_bookingeditdraft_filter',
}) }}
<div class="data-table-wrapper">
<div class="data-table-wrapper__inner text-sm">
<table class="data-table">
@@ -58,7 +64,7 @@
{% else %}
<tr>
<td colspan="5">
Keine Daten...
{{ filter.isActive ? 'Keine Treffer für diesen Filter.' : 'Keine Daten...' }}
</td>
</tr>
{% endfor %}
+8 -2
View File
@@ -2,13 +2,19 @@
{% block content %}
<twig:page:heading>Logs</twig:page:heading>
{{ include('_partials/_list_filter_bar.html.twig', {
'filter': filter,
'form': filter_form,
'route': 'app_admin_log',
'modal_route': 'app_admin_log_filter',
}) }}
<div class="data-table-wrapper">
<div class="data-table-wrapper__inner text-sm">
<table class="data-table">
<thead>
<tr>
<th>
{{ knp_pagination_sortable(pagination, 'Datum', 'log.timestamp') }}
{{ knp_pagination_sortable(pagination, 'Datum', 'log_entry.createdAt') }}
</th>
<th>
Fehlercode
@@ -62,7 +68,7 @@
{% else %}
<tr>
<td colspan="7">
Keine Daten...
{{ filter.isActive ? 'Keine Treffer für diesen Filter.' : 'Keine Daten...' }}
</td>
</tr>
{% endfor %}
+8 -2
View File
@@ -2,6 +2,12 @@
{% block content %}
<twig:page:heading>Benutzeraccounts</twig:page:heading>
{{ include('_partials/_list_filter_bar.html.twig', {
'filter': filter,
'form': filter_form,
'route': 'app_admin_user',
'modal_route': 'app_admin_user_filter',
}) }}
<div class="data-table-wrapper">
<div class="data-table-wrapper__inner text-sm">
<table class="data-table">
@@ -39,8 +45,8 @@
</tr>
{% else %}
<tr>
<td colspan="2">
Keine Daten...
<td colspan="4">
{{ filter.isActive ? 'Keine Treffer für diesen Filter.' : 'Keine Daten...' }}
</td>
</tr>
{% endfor %}