WIP: Implement admin dashboard
This commit is contained in:
1 parent
38d6fafcb2
commit
91f0f76ccc
15 files changed
+280
-4
No files matched your search
@@ -2,6 +2,12 @@
|
||||
|
||||
namespace App\Controller\Admin;
|
||||
|
||||
use App\Entity\Application;
|
||||
use App\Entity\Upload;
|
||||
use App\Repository\ApplicationRepository;
|
||||
use App\Repository\AssignmentRepository;
|
||||
use App\Repository\AvailabilityRepository;
|
||||
use App\Repository\UploadRepository;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
@@ -9,10 +15,39 @@ use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
|
||||
class IndexController extends AbstractController
|
||||
{
|
||||
public function __construct(
|
||||
private readonly ApplicationRepository $applicationRepository,
|
||||
private readonly AssignmentRepository $assignmentRepository,
|
||||
private readonly AvailabilityRepository $availabilityRepository,
|
||||
private readonly UploadRepository $uploadRepository
|
||||
) {
|
||||
}
|
||||
|
||||
#[Route('/admin', name: 'app_admin_index')]
|
||||
#[IsGranted('ROLE_ADMINISTRATIVE')]
|
||||
public function index(): Response
|
||||
{
|
||||
return $this->render('admin/index.html.twig');
|
||||
$applications = $this->applicationRepository->getNew();
|
||||
$newApplicationsCount = $this->applicationRepository->getCountByStatus(Application::STATUS_NEW);
|
||||
$pendingApplicationsCount = $this->applicationRepository->getCountByStatus(Application::STATUS_PENDING);
|
||||
|
||||
$assignments = $this->assignmentRepository->getNew();
|
||||
|
||||
$availabilities = $this->availabilityRepository->getNew();
|
||||
|
||||
$documents = $this->uploadRepository->getNew();
|
||||
$newDocumentsCount = $this->uploadRepository->getCountByStatus(Upload::STATUS_NEW);
|
||||
$pendingDocumentsCount = $this->uploadRepository->getCountByStatus(Upload::STATUS_PENDING);
|
||||
|
||||
return $this->render('admin/index.html.twig', [
|
||||
'applications' => $applications,
|
||||
'newApplicationsCount' => $newApplicationsCount,
|
||||
'pendingApplicationsCount' => $pendingApplicationsCount,
|
||||
'assignments' => $assignments,
|
||||
'availabilities' => $availabilities,
|
||||
'documents' => $documents,
|
||||
'newDocumentsCount' => $newDocumentsCount,
|
||||
'pendingDocumentsCount' => $pendingDocumentsCount,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user