feat: show overdue contracts on admin dashboard
This commit is contained in:
@@ -3,13 +3,12 @@
|
||||
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 App\Repository\ApplicationRepository;
|
||||
use App\Repository\AssignmentRepository;
|
||||
use App\Repository\AvailabilityRepository;
|
||||
use App\Repository\FeedbackRepository;
|
||||
use App\Repository\UploadRepository;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
@@ -17,33 +16,33 @@ use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
|
||||
class IndexController extends AbstractController
|
||||
{
|
||||
public function __construct(
|
||||
private readonly ApplicationRepository $applicationRepository,
|
||||
private readonly FeedbackRepository $feedbackRepository,
|
||||
private readonly AssignmentRepository $assignmentRepository,
|
||||
private readonly AvailabilityRepository $availabilityRepository,
|
||||
private readonly UploadRepository $uploadRepository
|
||||
) {
|
||||
public function __construct(private readonly EntityManagerInterface $entityManager)
|
||||
{
|
||||
}
|
||||
|
||||
#[Route('/admin', name: 'app_admin_index')]
|
||||
#[IsGranted('ROLE_ADMIN')]
|
||||
public function index(): Response
|
||||
{
|
||||
$applications = $this->applicationRepository->getNew();
|
||||
$newApplicationsCount = $this->applicationRepository->getCountByStatus(Application::STATUS_NEW);
|
||||
$pendingApplicationsCount = $this->applicationRepository->getCountByStatus(Application::STATUS_PENDING);
|
||||
$applicationRepository = $this->entityManager->getRepository(Application::class);
|
||||
$applications = $applicationRepository->getNew();
|
||||
$newApplicationsCount = $applicationRepository->getCountByStatus(Application::STATUS_NEW);
|
||||
$pendingApplicationsCount = $applicationRepository->getCountByStatus(Application::STATUS_PENDING);
|
||||
|
||||
$feedbacks = $this->feedbackRepository->getNew();
|
||||
$pendingFeedbacksCount = $this->feedbackRepository->getCountByStatus(Feedback::STATUS_NEW);
|
||||
$feedbackRepository = $this->entityManager->getRepository(Feedback::class);
|
||||
$feedbacks = $feedbackRepository->getNew();
|
||||
$pendingFeedbacksCount = $feedbackRepository->getCountByStatus(Feedback::STATUS_NEW);
|
||||
|
||||
$assignments = $this->assignmentRepository->getNew();
|
||||
$assignments = $this->entityManager->getRepository(Assignment::class)->getNew();
|
||||
|
||||
$availabilities = $this->availabilityRepository->getNew();
|
||||
$availabilities = $this->entityManager->getRepository(Availability::class)->getNew();
|
||||
|
||||
$documents = $this->uploadRepository->getNew();
|
||||
$newDocumentsCount = $this->uploadRepository->getCountByStatus(Upload::STATUS_NEW);
|
||||
$pendingDocumentsCount = $this->uploadRepository->getCountByStatus(Upload::STATUS_PENDING);
|
||||
$uploadRepository = $this->entityManager->getRepository(Upload::class);
|
||||
$documents = $uploadRepository->getNew();
|
||||
$newDocumentsCount = $uploadRepository->getCountByStatus(Upload::STATUS_NEW);
|
||||
$pendingDocumentsCount = $uploadRepository->getCountByStatus(Upload::STATUS_PENDING);
|
||||
|
||||
$overdueContracts = $this->entityManager->getRepository(Disposition::class)->findOverdueContracts();
|
||||
|
||||
return $this->render('admin/index.html.twig', [
|
||||
'applications' => $applications,
|
||||
@@ -56,6 +55,7 @@ class IndexController extends AbstractController
|
||||
'documents' => $documents,
|
||||
'newDocumentsCount' => $newDocumentsCount,
|
||||
'pendingDocumentsCount' => $pendingDocumentsCount,
|
||||
'overdueContracts' => $overdueContracts,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user