feat: all-season assignments
This commit is contained in:
1 parent
675cec1b69
commit
cf876ed224
119 files changed
+6194
-294
No files matched your search
@@ -17,7 +17,7 @@ use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
class IndexController extends AbstractController
|
||||
{
|
||||
public function __construct(
|
||||
protected readonly TeamerFilterHandler $filterHandler,
|
||||
private readonly TeamerFilterHandler $filterHandler,
|
||||
private readonly TeamerRepository $teamerRepository,
|
||||
private readonly PaginatorInterface $paginator,
|
||||
private readonly EntityManagerInterface $entityManager,
|
||||
@@ -28,7 +28,38 @@ class IndexController extends AbstractController
|
||||
#[IsGranted('ROLE_ADMINISTRATIVE')]
|
||||
public function index(Request $request): Response
|
||||
{
|
||||
$filterDto = $this->filterHandler->getFilterSettings();
|
||||
return $this->renderList($request, 'administrative/teamer/index.html.twig', null);
|
||||
}
|
||||
|
||||
#[Route('/administrative/season-teamer', name: 'app_administrative_season_teamer_index')]
|
||||
#[IsGranted('ROLE_ADMINISTRATIVE')]
|
||||
public function season(Request $request): Response
|
||||
{
|
||||
return $this->renderList($request, 'administrative/teamer/season_index.html.twig', TeamerFilterHandler::SCOPE_ALL_SEASON);
|
||||
}
|
||||
|
||||
#[Route('/administrative/teamer/viewed/{uuid}', name: 'app_administrative_teamer_viewed', methods: ['POST'])]
|
||||
#[IsGranted('ROLE_ADMINISTRATIVE')]
|
||||
public function viewed(Teamer $teamer): Response
|
||||
{
|
||||
$teamer->setViewed(true);
|
||||
$this->entityManager->flush();
|
||||
|
||||
return new HxRedirectResponse($this->generateUrl('app_administrative_teamer_index'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Both teamer lists differ only in the scope they run under, so they share one body.
|
||||
* The scope is set explicitly on either path to keep the two independent of the order
|
||||
* in which they are called within a request.
|
||||
*/
|
||||
private function renderList(Request $request, string $template, ?string $scope): Response
|
||||
{
|
||||
$filterDto = $this
|
||||
->filterHandler
|
||||
->setScope($scope)
|
||||
->getFilterSettings()
|
||||
;
|
||||
|
||||
$query = $this
|
||||
->teamerRepository
|
||||
@@ -41,19 +72,9 @@ class IndexController extends AbstractController
|
||||
$request->query->getInt('limit', 50)
|
||||
);
|
||||
|
||||
return $this->render('administrative/teamer/index.html.twig', [
|
||||
return $this->render($template, [
|
||||
'pagination' => $pagination,
|
||||
'filterDto' => $filterDto,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/administrative/teamer/viewed/{uuid}', name: 'app_administrative_teamer_viewed', methods: ['POST'])]
|
||||
#[IsGranted('ROLE_ADMINISTRATIVE')]
|
||||
public function viewed(Teamer $teamer): Response
|
||||
{
|
||||
$teamer->setViewed(true);
|
||||
$this->entityManager->flush();
|
||||
|
||||
return new HxRedirectResponse($this->generateUrl('app_administrative_teamer_index'));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user