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
+1
View File
@@ -44,6 +44,7 @@ class AppExtension extends AbstractExtension
new TwigFunction('gtm_id', [AppRuntime::class, 'getGtmId']),
new TwigFunction('cmp_url', [AppRuntime::class, 'getCmpUrl']),
new TwigFunction('return_url', [AppRuntime::class, 'getEncodedReturnUrl']),
new TwigFunction('filter_query_without', [AppRuntime::class, 'getFilterQueryWithout']),
];
}
}
+32
View File
@@ -7,6 +7,7 @@ namespace App\Twig;
use App\BusProNet\DataProvider\CountryDataProvider;
use App\EventListener\DomainThemeListener;
use App\Form\Model\BookingDto;
use App\Form\Model\Filter\AbstractListFilterDto;
use App\Form\Service\Condition\TravelStartCutoffReachedCondition;
use App\Form\Service\CreateFieldStateProvider;
use App\Form\Service\EditFieldStateProvider;
@@ -294,6 +295,37 @@ class AppRuntime implements RuntimeExtensionInterface
return rawurlencode($masterRequest->getRequestUri());
}
/**
* The current query string with the given keys removed — the target of a filter chip's
* dismiss link.
*
* The pagination is reset because the shorter result set makes the current page meaningless,
* and the filter marker is kept because dismissing a chip is still an explicit filter action:
* dropping it would snap the list back to its defaults instead of widening it.
*
* @param string[] $keys
*
* @return array<string, mixed>
*/
public function getFilterQueryWithout(array $keys): array
{
$request = $this->requestStack->getCurrentRequest();
if (null === $request) {
return [];
}
$query = $request->query->all();
foreach ([...$keys, 'page'] as $key) {
unset($query[$key]);
}
$query[AbstractListFilterDto::MARKER] = '1';
return $query;
}
private function getDomainConfig(): DomainConfig
{
$request = $this->requestStack->getCurrentRequest();