profile done

This commit is contained in:
Olivier PARPAILLON
2024-11-25 11:00:36 +01:00
parent cb01a159bc
commit 4561cea8d4
5 changed files with 16 additions and 10 deletions

View File

@@ -1,5 +0,0 @@
-- Doctrine Migration File Generated on 2024-11-21 09:04:49
-- Version DoctrineMigrations\Version20241121085948
ALTER TABLE sortie ADD CONSTRAINT FK_3C3FD3F2D936B2FA FOREIGN KEY (organisateur_id) REFERENCES participant (id_participant);
CREATE INDEX IDX_3C3FD3F2D936B2FA ON sortie (organisateur_id);

View File

@@ -29,11 +29,13 @@ class ProfileController extends AbstractController
$userConnect = $token?->getUser(); $userConnect = $token?->getUser();
$currentProfile = $profileRepo->findOneBy(['idParticipant' => $uuid]); $currentProfile = $profileRepo->findOneBy(['idParticipant' => $uuid]);
if ($userConnect->getIdParticipant() !== $currentProfile->getIdParticipant()) { if ($userConnect->getIdParticipant() !== $currentProfile->getIdParticipant()) {
$this->addFlash('error', "Vous ne pouvez pas consulter un profil qui n'est pas le votre"); $isActiveUser = false;
return $this->redirectToRoute('home'); } else {
$isActiveUser = true;
} }
return $this->render('profile/view.html.twig', [ return $this->render('profile/view.html.twig', [
'profile' => $currentProfile, 'profile' => $currentProfile,
'isActiveUser' => $isActiveUser,
]); ]);
} }

View File

@@ -14,8 +14,8 @@ class SortieFixtures extends Fixture
$sortie->setNom('Sortie 1'); $sortie->setNom('Sortie 1');
$sortie->setInfosSortie('Description de la sortie 1'); $sortie->setInfosSortie('Description de la sortie 1');
$sortie->setDuree(45); $sortie->setDuree(45);
$sortie->setDateHeureDebut(new \DateTime('2024-11-30 09:15:00')); $sortie->setDateHeureDebut(new \DateTimeImmutable('2024-11-30 09:15:00'));
$sortie->setDateLimiteInscription(new \DateTime('2024-12-25 12:30:00')); $sortie->setDateLimiteInscription(new \DateTimeImmutable('2024-12-25 12:30:00'));
$sortie->setNbInscriptionsMax(25); $sortie->setNbInscriptionsMax(25);
$manager->persist($sortie); $manager->persist($sortie);

View File

@@ -23,6 +23,7 @@ class UserFixtures extends Fixture
$olivier->setEmail('olivier@gmail.com'); $olivier->setEmail('olivier@gmail.com');
$olivier->setRoles(['ROLE_USER', 'ROLE_ADMIN']); $olivier->setRoles(['ROLE_USER', 'ROLE_ADMIN']);
$olivier->setAdministrateur(true); $olivier->setAdministrateur(true);
$olivier->setPending(false);
$olivier->setActif(false); $olivier->setActif(false);
$olivier->setPassword($this->userPasswordHasher->hashPassword($olivier, 'test-44')); $olivier->setPassword($this->userPasswordHasher->hashPassword($olivier, 'test-44'));
$manager->persist($olivier); $manager->persist($olivier);
@@ -35,6 +36,7 @@ class UserFixtures extends Fixture
$johan->setEmail('leroyjohan3@gmail.com'); $johan->setEmail('leroyjohan3@gmail.com');
$johan->setRoles(['ROLE_USER', 'ROLE_ADMIN']); $johan->setRoles(['ROLE_USER', 'ROLE_ADMIN']);
$johan->setAdministrateur(true); $johan->setAdministrateur(true);
$johan->setPending(false);
$johan->setActif(false); $johan->setActif(false);
$johan->setPassword($this->userPasswordHasher->hashPassword($johan, 'Vn21pd%6a%Hw5j')); $johan->setPassword($this->userPasswordHasher->hashPassword($johan, 'Vn21pd%6a%Hw5j'));
$manager->persist($johan); $manager->persist($johan);
@@ -47,6 +49,7 @@ class UserFixtures extends Fixture
$marvin->setEmail('marvin@gmail.com'); $marvin->setEmail('marvin@gmail.com');
$marvin->setRoles(['ROLE_USER', 'ROLE_ADMIN']); $marvin->setRoles(['ROLE_USER', 'ROLE_ADMIN']);
$marvin->setAdministrateur(true); $marvin->setAdministrateur(true);
$marvin->setPending(false);
$marvin->setActif(false); $marvin->setActif(false);
$marvin->setPassword($this->userPasswordHasher->hashPassword($marvin, 'test-44')); $marvin->setPassword($this->userPasswordHasher->hashPassword($marvin, 'test-44'));
$manager->persist($marvin); $manager->persist($marvin);

View File

@@ -28,13 +28,19 @@
<i class="fas fa-map-marker-alt mr-2 text-slate-400 opacity-75"></i>{{ profile.telephone }} - {{ profile.email }} <i class="fas fa-map-marker-alt mr-2 text-slate-400 opacity-75"></i>{{ profile.telephone }} - {{ profile.email }}
</div> </div>
</div> </div>
{% if isActiveUser %}
<div class="mt-6 py-6 border-t border-slate-200 text-center"> <div class="mt-6 py-6 border-t border-slate-200 text-center">
<div class="flex flex-wrap justify-center"> <div class="flex flex-wrap justify-center">
<div class="w-full px-4"> <div class="w-full px-4">
<a href="{{ path('profile_edit', {'uuid': app.user.idParticipant}) }}" class="text-slate-700 hover:text-slate-400">Modifier</a> <a href="{{ path('profile_edit', {'uuid': app.user.idParticipant}) }}" class="text-slate-700 hover:text-slate-400">
<button class="bg-green-500 px-4 py-2 rounded hover:bg-green-700">
Modifier
</button>
</a>
</div> </div>
</div> </div>
</div> </div>
{% endif %}
</div> </div>
</div> </div>
{% endblock %} {% endblock %}