66 lines
2.8 KiB
PHP
66 lines
2.8 KiB
PHP
<?php
|
|
|
|
namespace App\Controller\Admin;
|
|
|
|
use App\Entity\Application;
|
|
use App\Entity\Assignment;
|
|
use App\Entity\Availability;
|
|
use App\Entity\Disposition;
|
|
use App\Entity\Feedback;
|
|
use App\Entity\Upload;
|
|
use Doctrine\ORM\EntityManagerInterface;
|
|
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 EntityManagerInterface $entityManager)
|
|
{
|
|
}
|
|
|
|
#[Route('/admin', name: 'app_admin_index')]
|
|
#[IsGranted('ROLE_ADMIN')]
|
|
public function index(): Response
|
|
{
|
|
$applicationRepository = $this->entityManager->getRepository(Application::class);
|
|
$applications = $applicationRepository->getNew();
|
|
$newApplicationsCount = $applicationRepository->getCountByStatus(Application::STATUS_NEW);
|
|
$pendingApplicationsCount = $applicationRepository->getCountByStatus(Application::STATUS_PENDING);
|
|
|
|
$feedbackRepository = $this->entityManager->getRepository(Feedback::class);
|
|
$feedbacks = $feedbackRepository->getNew();
|
|
$pendingFeedbacksCount = $feedbackRepository->getCountByStatus(Feedback::STATUS_NEW);
|
|
|
|
$assignments = $this->entityManager->getRepository(Assignment::class)->getNew();
|
|
|
|
$availabilities = $this->entityManager->getRepository(Availability::class)->getNew();
|
|
|
|
$uploadRepository = $this->entityManager->getRepository(Upload::class);
|
|
$documents = $uploadRepository->getNew();
|
|
$newDocumentsCount = $uploadRepository->getCountByStatus(Upload::STATUS_NEW);
|
|
$pendingDocumentsCount = $uploadRepository->getCountByStatus(Upload::STATUS_PENDING);
|
|
|
|
$dispositionRepository = $this->entityManager->getRepository(Disposition::class);
|
|
$overdueContracts = $dispositionRepository->findOverdueContracts();
|
|
$newDispositions = $dispositionRepository->getNew();
|
|
$overdueFeedbacks = $dispositionRepository->findDispositionsWithOverdueFeedback(7);
|
|
|
|
return $this->render('admin/index.html.twig', [
|
|
'applications' => $applications,
|
|
'newApplicationsCount' => $newApplicationsCount,
|
|
'pendingApplicationsCount' => $pendingApplicationsCount,
|
|
'feedbacks' => $feedbacks,
|
|
'pendingFeedbacksCount' => $pendingFeedbacksCount,
|
|
'assignments' => $assignments,
|
|
'availabilities' => $availabilities,
|
|
'documents' => $documents,
|
|
'newDocumentsCount' => $newDocumentsCount,
|
|
'pendingDocumentsCount' => $pendingDocumentsCount,
|
|
'overdueContracts' => $overdueContracts,
|
|
'newDispositions' => $newDispositions,
|
|
'overdueFeedbacks' => $overdueFeedbacks,
|
|
]);
|
|
}
|
|
} |