better dashboard

This commit is contained in:
Olivier PARPAILLON
2024-11-27 13:31:25 +01:00
parent 806a023670
commit 6a429984d1
9 changed files with 201 additions and 7 deletions

View File

@@ -4,6 +4,7 @@ namespace App\Controller;
use App\Entity\Participant;
use App\Form\ProfileFormType;
use App\Repository\SortieRepository;
use App\Service\FileUploader;
use App\Form\RegistrationFormType;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
@@ -18,9 +19,11 @@ class ProfileController extends AbstractController
{
private FileUploader $fileUploader;
private ParticipantRepository $profileRepo;
public function __construct(FileUploader $fileUploader, ParticipantRepository $profileRepo) {
private SortieRepository $sortieRepo;
public function __construct(FileUploader $fileUploader, ParticipantRepository $profileRepo, SortieRepository $sortieRepo) {
$this->fileUploader = $fileUploader;
$this->profileRepo = $profileRepo;
$this->sortieRepo = $sortieRepo;
}
#[Route('/profile/{uuid}', name: 'profile_view', methods: ['GET'])]
public function viewProfile(string $uuid, ParticipantRepository $profileRepo, TokenStorageInterface $tokenStorage): Response
@@ -28,6 +31,8 @@ class ProfileController extends AbstractController
$token = $tokenStorage->getToken();
$userConnect = $token?->getUser();
$currentProfile = $profileRepo->findOneBy(['idParticipant' => $uuid]);
$sortiesOrganisation = $this->sortieRepo->findUserOrganisation($userConnect);
$sortiesParticipation =$this->sortieRepo->findUserParticipation($userConnect);
if ($userConnect->getIdParticipant() !== $currentProfile->getIdParticipant()) {
$isActiveUser = false;
} else {
@@ -36,6 +41,8 @@ class ProfileController extends AbstractController
return $this->render('profile/view.html.twig', [
'profile' => $currentProfile,
'isActiveUser' => $isActiveUser,
'sortiesOrganisation' => $sortiesOrganisation,
'sortiesParticipation' => $sortiesParticipation
]);
}