Files
myep-team/src/Controller/Manager/IndexController.php
T
2026-09-16 18:03:04 +02:00

55 lines
2.1 KiB
PHP

<?php
namespace App\Controller\Manager;
use App\Entity\Upload;
use App\Repository\DispositionRepository;
use App\Repository\UploadRepository;
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 IndexController extends AbstractController
{
public function __construct(
private readonly DispositionRepository $dispositionRepository,
private readonly UploadRepository $uploadRepository,
) {
}
#[Route('/management', name: 'app_manager_index')]
#[IsGranted('ROLE_MANAGER')]
public function index(): Response
{
$dispositions = $this->dispositionRepository->getNew();
$newContracts = $this->uploadRepository->getNewByType(Upload::TYPE_CONTRACT);
$newContractsCount = $this
->uploadRepository
->getCountByStatusAndType(Upload::STATUS_NEW, Upload::TYPE_CONTRACT);
$pendingContractsCount = $this
->uploadRepository
->getCountByStatusAndType(Upload::STATUS_PENDING, Upload::TYPE_CONTRACT);
$newInvoices = $this->uploadRepository->getNewByType(Upload::TYPE_INVOICE);
$newInvoicesCount = $this
->uploadRepository
->getCountByStatusAndType(Upload::STATUS_NEW, Upload::TYPE_INVOICE);
$pendingInvoicesCount = $this
->uploadRepository
->getCountByStatusAndType(Upload::STATUS_PENDING, Upload::TYPE_INVOICE);
$overdueFeedbacks = $this->dispositionRepository->findDispositionsWithOverdueFeedback(7);
return $this->render('manager/index.html.twig', [
'dispositions' => $dispositions,
'newContracts' => $newContracts,
'newContractsCount' => $newContractsCount,
'pendingContractsCount' => $pendingContractsCount,
'newInvoices' => $newInvoices,
'newInvoicesCount' => $newInvoicesCount,
'pendingInvoicesCount' => $pendingInvoicesCount,
'overdueFeedbacks' => $overdueFeedbacks,
]);
}
}