feat: dashboard for role 'manager'

This commit is contained in:
Björn Fromme
2024-03-01 13:50:54 +01:00
parent a4a3f43df9
commit 7e5b0e66c4
4 changed files with 175 additions and 3 deletions
+31 -3
View File
@@ -2,17 +2,45 @@
namespace App\Controller\Manager;
use App\Entity\Assignment;
use App\Model\AssignmentFilterDto;
use App\Repository\AssignmentRepository;
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;
class IndexController extends AbstractController
{
#[Route('/management', name: 'app_manager_index')]
public function index(): Response
public function __construct(private readonly AssignmentRepository $assignmentRepository, private readonly PaginatorInterface $paginator)
{
return $this->render('manager/index.html.twig', [
}
#[Route('/management', name: 'app_manager_index')]
public function index(Request $request): Response
{
$filterDto = new AssignmentFilterDto();
$filterDto->setStatus(Assignment::STATUS_UNSTAFFED);
$query = $this
->assignmentRepository
->getListQuery($filterDto)
;
$pagination = $this->paginator->paginate(
$query,
$request->query->getInt('page', 1),
10,
[
'wrap-queries' => true, // Required for query with 'having' clause
'defaultSortFieldName' => 'destination.dateFrom',
'defaultSortDirection' => 'desc',
]
);
return $this->render('manager/index.html.twig', [
'pagination' => $pagination,
]);
}
}