Skip to content

Commit

Permalink
Filtrování skupinových rolí (#951)
Browse files Browse the repository at this point in the history
* filter group roles

* filter fix

* filter fix
  • Loading branch information
jan-stanek committed Apr 5, 2023
1 parent cb90ad3 commit 58ebaf4
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion app/AdminModule/UsersModule/Components/UsersGridControl.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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())
Expand Down

0 comments on commit 58ebaf4

Please sign in to comment.