From 58ebaf44439c6c659a5300243d85f1667d862847 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Stan=C4=9Bk?= Date: Sat, 21 Jan 2023 14:52:24 +0100 Subject: [PATCH] =?UTF-8?q?Filtrov=C3=A1n=C3=AD=20skupinov=C3=BDch=20rol?= =?UTF-8?q?=C3=AD=20(#951)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * filter group roles * filter fix * filter fix --- .../UsersModule/Components/UsersGridControl.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/app/AdminModule/UsersModule/Components/UsersGridControl.php b/app/AdminModule/UsersModule/Components/UsersGridControl.php index 8da4d501f..17fec2141 100644 --- a/app/AdminModule/UsersModule/Components/UsersGridControl.php +++ b/app/AdminModule/UsersModule/Components/UsersGridControl.php @@ -19,6 +19,7 @@ use App\Model\Enums\ApplicationState; use App\Model\Enums\PaymentType; use App\Model\Enums\SkautIsEventType; +use App\Model\Enums\TroopApplicationState; use App\Model\Settings\Queries\SettingIntValueQuery; use App\Model\Settings\Queries\SettingStringValueQuery; use App\Model\Settings\Settings; @@ -172,7 +173,19 @@ public function createComponentUsersGrid(string $name): DataGrid ->setParameter('rids', (array) $values); }); - $grid->addColumnText('groupRoles', 'Skupinové role', 'groupRolesText'); + $grid->addColumnText('groupRoles', 'Skupinové role', 'groupRolesText') + ->setFilterMultiSelect($this->aclService->getRolesWithoutRolesOptions([Role::GUEST, Role::UNAPPROVED])) + ->setCondition(static function (QueryBuilder $qb, ArrayHash $values): void { + $qb->join('u.groupRoles', 'uGR') + ->join('uGR.role', 'uGRR') + ->leftJoin('uGR.troop', 'uGRT') + ->leftJoin('uGR.patrol', 'uGRP') + ->leftJoin('uGRP.troop', 'uGRPT') + ->andWhere('uGRR.id IN (:grids)') + ->andWhere('(uGRT.state IS NULL OR uGRT.state != :tas) AND (uGRPT.state IS NULL OR uGRPT.state != :tas)') + ->setParameter('grids', (array) $values) + ->setParameter('tas', TroopApplicationState::DRAFT); + }); $grid->addColumnText('subevents', 'admin.users.users_subevents', 'subeventsText') ->setFilterMultiSelect($this->subeventService->getSubeventsOptions())