wip: functionality for new role 'management'

This commit is contained in:
Björn Fromme committed 2024-02-14 14:59:47 +01:00
1 parent 7f05cf30b6
commit 7c7addf531
17 files changed
+312 -68

No files matched your search

+1 -1
View File
@@ -27,7 +27,7 @@ class IndexController extends AbstractController
}
#[Route('/admin', name: 'app_admin_index')]
#[IsGranted('ROLE_ADMINISTRATIVE')]
#[IsGranted('ROLE_ADMIN')]
public function index(): Response
{
$applications = $this->applicationRepository->getNew();
@@ -11,7 +11,7 @@ use Symfony\Component\Security\Http\Attribute\IsGranted;
class CrmSelectionsController extends AbstractController
{
#[Route('/admin/teamer/crm-selections/{uuid}', name: 'app_admin_teamer_crm_selections')]
#[IsGranted('ROLE_ADMINISTRATIVE')]
#[IsGranted('ROLE_ADMIN')]
public function index(Teamer $teamer): Response
{
return $this->render('admin/teamer/crm_selections.html.twig', [
@@ -1,49 +0,0 @@
<?php
namespace App\Controller\Admin\Teamer;
use App\Repository\TeamerRepository;
use App\Service\Common\TeamerFilterHandler;
use Knp\Component\Pager\PaginatorInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Security\Http\Attribute\IsGranted;
class IndexController extends AbstractController
{
public function __construct(
protected readonly TeamerFilterHandler $filterHandler,
private readonly TeamerRepository $teamerRepository,
private readonly PaginatorInterface $paginator
) {
}
#[Route('/admin/teamer', name: 'app_admin_teamer_index')]
#[IsGranted('ROLE_ADMINISTRATIVE')]
public function index(Request $request): Response
{
$filterDto = $this->filterHandler->getFilterSettings();
$query = $this
->teamerRepository
->getListQuery($filterDto)
;
$pagination = $this->paginator->paginate(
$query,
$request->query->getInt('page', 1),
10,
[
'defaultSortFieldName' => 'teamer.lastName',
'defaultSortDirection' => 'asc',
]
);
return $this->render('admin/teamer/index.html.twig', [
'pagination' => $pagination,
'filterDto' => $filterDto,
]);
}
}
@@ -7,6 +7,7 @@ use App\Repository\DispositionRepository;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Security\Http\Attribute\IsGranted;
class InfoController extends AbstractController
{
@@ -14,6 +15,7 @@ class InfoController extends AbstractController
{}
#[Route('/admin/teamer/info/{uuid}', name: 'app_admin_teamer_info')]
#[IsGranted('ROLE_ADMIN')]
public function index(Teamer $teamer): Response
{
$recentDispositions = $this->dispositionRepository->findRecentDispositionsByTeamer($teamer);
@@ -1,21 +0,0 @@
<?php
namespace App\Controller\Admin\Teamer;
use App\Entity\Teamer;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Security\Http\Attribute\IsGranted;
class ProfileController extends AbstractController
{
#[Route('/admin/teamer/profile/{uuid}', name: 'app_admin_teamer_profile')]
#[IsGranted('ROLE_ADMINISTRATIVE')]
public function index(Teamer $teamer): Response
{
return $this->render('admin/teamer/profile.html.twig', [
'teamer' => $teamer,
]);
}
}
@@ -1,47 +0,0 @@
<?php
namespace App\Controller\Admin\Teamer;
use App\Entity\Teamer;
use App\Repository\DispositionRepository;
use Knp\Component\Pager\PaginatorInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Security\Http\Attribute\IsGranted;
class RecentAssignmentsController extends AbstractController
{
public function __construct(
private readonly DispositionRepository $dispositionRepository,
private readonly PaginatorInterface $paginator
) {
}
#[Route('/admin/teamer/recent-assignments/{uuid}', name: 'app_admin_teamer_recent_assignments')]
#[IsGranted('ROLE_ADMINISTRATIVE')]
public function index(Teamer $teamer, Request $request): Response
{
$query = $this
->dispositionRepository
->getRecentDispositionsByTeamerQuery($teamer)
;
$pagination = $this->paginator->paginate(
$query,
$request->query->getInt('page', 1),
10,
[
'defaultSortFieldName' => 'destination.dateFrom',
'defaultSortDirection' => 'asc',
]
);
return $this->render('admin/teamer/recent_assignments.html.twig', [
'teamer' => $teamer,
'pagination' => $pagination,
]);
}
}
@@ -15,7 +15,7 @@ class SkillsController extends AbstractController
{}
#[Route('/admin/teamer/skills/{uuid}', name: 'app_admin_teamer_skills')]
#[IsGranted('ROLE_ADMINISTRATIVE')]
#[IsGranted('ROLE_ADMIN')]
public function index(Teamer $teamer): Response
{
$trainings = $this->trainingRepository->getList();