Feat: Add assignment filter for admins
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace App\Controller\Admin\Assignment;
|
||||
|
||||
use App\Repository\AssignmentRepository;
|
||||
use App\Service\Common\AssignmentFilterHandler;
|
||||
use Knp\Component\Pager\PaginatorInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
@@ -14,7 +15,8 @@ class IndexController extends AbstractController
|
||||
{
|
||||
public function __construct(
|
||||
private readonly AssignmentRepository $assignmentRepository,
|
||||
private readonly PaginatorInterface $paginator
|
||||
private readonly PaginatorInterface $paginator,
|
||||
private readonly AssignmentFilterHandler $filterHandler
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -22,9 +24,15 @@ class IndexController extends AbstractController
|
||||
#[IsGranted('ROLE_ADMINISTRATIVE')]
|
||||
public function index(Request $request): Response
|
||||
{
|
||||
$filterForm = $this->filterHandler->getForm();
|
||||
$filterDto = $this->filterHandler->handleRequest($filterForm, $request);
|
||||
if (true === $filterDto->isReset()) {
|
||||
return $this->redirectToRoute('app_admin_assignment_index');
|
||||
}
|
||||
|
||||
$query = $this
|
||||
->assignmentRepository
|
||||
->getListQuery()
|
||||
->getListQuery($filterDto)
|
||||
;
|
||||
|
||||
$pagination = $this->paginator->paginate(
|
||||
@@ -39,6 +47,7 @@ class IndexController extends AbstractController
|
||||
|
||||
return $this->render('admin/assignment/index.html.twig', [
|
||||
'pagination' => $pagination,
|
||||
'filterForm' => $filterForm,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -34,7 +34,7 @@ class IndexController extends AbstractController
|
||||
|
||||
$query = $this
|
||||
->assignmentRepository
|
||||
->getListQuery($teamer)
|
||||
->getListQueryForTeamer($teamer)
|
||||
;
|
||||
|
||||
$pagination = $this->paginator->paginate(
|
||||
|
||||
Reference in New Issue
Block a user