fix: reset pagination when filtering
This commit is contained in:
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Controller\Common;
|
namespace App\Controller\Common;
|
||||||
|
|
||||||
use App\Controller\Traits\ReturnUrlTrait;
|
|
||||||
use App\Form\AssignmentFilterType;
|
use App\Form\AssignmentFilterType;
|
||||||
use App\Htmx\HxRedirectResponse;
|
use App\Htmx\HxRedirectResponse;
|
||||||
use App\Repository\AssignmentRepository;
|
use App\Repository\AssignmentRepository;
|
||||||
@@ -15,8 +14,6 @@ use Symfony\Component\Security\Http\Attribute\IsGranted;
|
|||||||
|
|
||||||
class AssignmentFilterController extends AbstractController
|
class AssignmentFilterController extends AbstractController
|
||||||
{
|
{
|
||||||
use ReturnUrlTrait;
|
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly AssignmentFilterHandler $filterHandler,
|
private readonly AssignmentFilterHandler $filterHandler,
|
||||||
private readonly AssignmentRepository $assignmentRepository
|
private readonly AssignmentRepository $assignmentRepository
|
||||||
@@ -41,9 +38,8 @@ class AssignmentFilterController extends AbstractController
|
|||||||
|
|
||||||
if ($form->isSubmitted() && $form->isValid()) {
|
if ($form->isSubmitted() && $form->isValid()) {
|
||||||
$this->filterHandler->handleRequest($form);
|
$this->filterHandler->handleRequest($form);
|
||||||
$returnUrl = $this->getReturnUrl($request, 'app_administrative_assignment_index');
|
|
||||||
|
|
||||||
return new HxRedirectResponse($returnUrl);
|
return new HxRedirectResponse($this->generateUrl('app_administrative_assignment_index'));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->render('common/modal_assignment_filter.html.twig', [
|
return $this->render('common/modal_assignment_filter.html.twig', [
|
||||||
@@ -56,8 +52,7 @@ class AssignmentFilterController extends AbstractController
|
|||||||
public function reset(Request $request): Response
|
public function reset(Request $request): Response
|
||||||
{
|
{
|
||||||
$this->filterHandler->resetFilterSettings();
|
$this->filterHandler->resetFilterSettings();
|
||||||
$returnUrl = $this->getReturnUrl($request, 'app_administrative_assignment_index');
|
|
||||||
|
|
||||||
return $this->redirect($returnUrl);
|
return $this->redirectToRoute('app_administrative_assignment_index');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user