This commit is contained in:
Olivier PARPAILLON
2024-11-25 11:00:51 +01:00
17 changed files with 52 additions and 367 deletions

View File

@@ -1,63 +0,0 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20241125083511 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE etat (id_etat CHAR(36) NOT NULL COMMENT \'(DC2Type:guid)\', libelle VARCHAR(255) NOT NULL, PRIMARY KEY(id_etat)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE lieu (id_lieu CHAR(36) NOT NULL COMMENT \'(DC2Type:guid)\', ville_id CHAR(36) NOT NULL COMMENT \'(DC2Type:guid)\', nom VARCHAR(255) NOT NULL, rue VARCHAR(255) DEFAULT NULL, latitude DOUBLE PRECISION DEFAULT NULL, longitude DOUBLE PRECISION DEFAULT NULL, INDEX IDX_2F577D59A73F0036 (ville_id), PRIMARY KEY(id_lieu)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE participant (id_participant CHAR(36) NOT NULL COMMENT \'(DC2Type:guid)\', site_id CHAR(36) DEFAULT NULL COMMENT \'(DC2Type:guid)\', nom VARCHAR(255) NOT NULL, prenom VARCHAR(255) NOT NULL, pseudo VARCHAR(255) NOT NULL, telephone VARCHAR(255) DEFAULT NULL, email VARCHAR(255) NOT NULL, administrateur TINYINT(1) NOT NULL, actif TINYINT(1) NOT NULL, pending TINYINT(1) NOT NULL, roles JSON NOT NULL, password VARCHAR(255) NOT NULL, file_name VARCHAR(255) DEFAULT NULL, INDEX IDX_D79F6B11F6BD1646 (site_id), UNIQUE INDEX UNIQ_IDENTIFIER_EMAIL (email), UNIQUE INDEX UNIQ_IDENTIFIER_PSEUDO (pseudo), PRIMARY KEY(id_participant)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE participant_sortie (participant_id CHAR(36) NOT NULL COMMENT \'(DC2Type:guid)\', sortie_id CHAR(36) NOT NULL COMMENT \'(DC2Type:guid)\', INDEX IDX_8E436D739D1C3019 (participant_id), INDEX IDX_8E436D73CC72D953 (sortie_id), PRIMARY KEY(participant_id, sortie_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE password_reset_token (id_password_reset_token CHAR(36) NOT NULL COMMENT \'(DC2Type:guid)\', token VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL, email VARCHAR(255) NOT NULL, PRIMARY KEY(id_password_reset_token)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE site (id_site CHAR(36) NOT NULL COMMENT \'(DC2Type:guid)\', nom VARCHAR(255) NOT NULL, PRIMARY KEY(id_site)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE sortie (id_sortie CHAR(36) NOT NULL COMMENT \'(DC2Type:guid)\', site_id CHAR(36) NOT NULL COMMENT \'(DC2Type:guid)\', organisateur_id CHAR(36) NOT NULL COMMENT \'(DC2Type:guid)\', lieu_id CHAR(36) NOT NULL COMMENT \'(DC2Type:guid)\', etat_id CHAR(36) NOT NULL COMMENT \'(DC2Type:guid)\', nom VARCHAR(255) NOT NULL, date_heure_debut DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', duree INT DEFAULT NULL, date_limite_inscription DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', nb_inscriptions_max INT DEFAULT NULL, infos_sortie VARCHAR(255) DEFAULT NULL, INDEX IDX_3C3FD3F2F6BD1646 (site_id), INDEX IDX_3C3FD3F2D936B2FA (organisateur_id), INDEX IDX_3C3FD3F26AB213CC (lieu_id), INDEX IDX_3C3FD3F2D5E86FF (etat_id), PRIMARY KEY(id_sortie)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE ville (id_ville CHAR(36) NOT NULL COMMENT \'(DC2Type:guid)\', nom VARCHAR(255) NOT NULL, code_postal INT DEFAULT NULL, PRIMARY KEY(id_ville)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE messenger_messages (id BIGINT AUTO_INCREMENT NOT NULL, body LONGTEXT NOT NULL, headers LONGTEXT NOT NULL, queue_name VARCHAR(190) NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', available_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', delivered_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_75EA56E0FB7336F0 (queue_name), INDEX IDX_75EA56E0E3BD61CE (available_at), INDEX IDX_75EA56E016BA31DB (delivered_at), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE lieu ADD CONSTRAINT FK_2F577D59A73F0036 FOREIGN KEY (ville_id) REFERENCES ville (id_ville)');
$this->addSql('ALTER TABLE participant ADD CONSTRAINT FK_D79F6B11F6BD1646 FOREIGN KEY (site_id) REFERENCES site (id_site)');
$this->addSql('ALTER TABLE participant_sortie ADD CONSTRAINT FK_8E436D739D1C3019 FOREIGN KEY (participant_id) REFERENCES participant (id_participant)');
$this->addSql('ALTER TABLE participant_sortie ADD CONSTRAINT FK_8E436D73CC72D953 FOREIGN KEY (sortie_id) REFERENCES sortie (id_sortie)');
$this->addSql('ALTER TABLE sortie ADD CONSTRAINT FK_3C3FD3F2F6BD1646 FOREIGN KEY (site_id) REFERENCES site (id_site)');
$this->addSql('ALTER TABLE sortie ADD CONSTRAINT FK_3C3FD3F2D936B2FA FOREIGN KEY (organisateur_id) REFERENCES participant (id_participant)');
$this->addSql('ALTER TABLE sortie ADD CONSTRAINT FK_3C3FD3F26AB213CC FOREIGN KEY (lieu_id) REFERENCES lieu (id_lieu)');
$this->addSql('ALTER TABLE sortie ADD CONSTRAINT FK_3C3FD3F2D5E86FF FOREIGN KEY (etat_id) REFERENCES etat (id_etat)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE lieu DROP FOREIGN KEY FK_2F577D59A73F0036');
$this->addSql('ALTER TABLE participant DROP FOREIGN KEY FK_D79F6B11F6BD1646');
$this->addSql('ALTER TABLE participant_sortie DROP FOREIGN KEY FK_8E436D739D1C3019');
$this->addSql('ALTER TABLE participant_sortie DROP FOREIGN KEY FK_8E436D73CC72D953');
$this->addSql('ALTER TABLE sortie DROP FOREIGN KEY FK_3C3FD3F2F6BD1646');
$this->addSql('ALTER TABLE sortie DROP FOREIGN KEY FK_3C3FD3F2D936B2FA');
$this->addSql('ALTER TABLE sortie DROP FOREIGN KEY FK_3C3FD3F26AB213CC');
$this->addSql('ALTER TABLE sortie DROP FOREIGN KEY FK_3C3FD3F2D5E86FF');
$this->addSql('DROP TABLE etat');
$this->addSql('DROP TABLE lieu');
$this->addSql('DROP TABLE participant');
$this->addSql('DROP TABLE participant_sortie');
$this->addSql('DROP TABLE password_reset_token');
$this->addSql('DROP TABLE site');
$this->addSql('DROP TABLE sortie');
$this->addSql('DROP TABLE ville');
$this->addSql('DROP TABLE messenger_messages');
}
}

View File

@@ -1,63 +0,0 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20241125083631 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE etat (id_etat CHAR(36) NOT NULL COMMENT \'(DC2Type:guid)\', libelle VARCHAR(255) NOT NULL, PRIMARY KEY(id_etat)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE lieu (id_lieu CHAR(36) NOT NULL COMMENT \'(DC2Type:guid)\', ville_id CHAR(36) NOT NULL COMMENT \'(DC2Type:guid)\', nom VARCHAR(255) NOT NULL, rue VARCHAR(255) DEFAULT NULL, latitude DOUBLE PRECISION DEFAULT NULL, longitude DOUBLE PRECISION DEFAULT NULL, INDEX IDX_2F577D59A73F0036 (ville_id), PRIMARY KEY(id_lieu)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE participant (id_participant CHAR(36) NOT NULL COMMENT \'(DC2Type:guid)\', site_id CHAR(36) DEFAULT NULL COMMENT \'(DC2Type:guid)\', nom VARCHAR(255) NOT NULL, prenom VARCHAR(255) NOT NULL, pseudo VARCHAR(255) NOT NULL, telephone VARCHAR(255) DEFAULT NULL, email VARCHAR(255) NOT NULL, administrateur TINYINT(1) NOT NULL, actif TINYINT(1) NOT NULL, pending TINYINT(1) NOT NULL, roles JSON NOT NULL, password VARCHAR(255) NOT NULL, file_name VARCHAR(255) DEFAULT NULL, INDEX IDX_D79F6B11F6BD1646 (site_id), UNIQUE INDEX UNIQ_IDENTIFIER_EMAIL (email), UNIQUE INDEX UNIQ_IDENTIFIER_PSEUDO (pseudo), PRIMARY KEY(id_participant)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE participant_sortie (participant_id CHAR(36) NOT NULL COMMENT \'(DC2Type:guid)\', sortie_id CHAR(36) NOT NULL COMMENT \'(DC2Type:guid)\', INDEX IDX_8E436D739D1C3019 (participant_id), INDEX IDX_8E436D73CC72D953 (sortie_id), PRIMARY KEY(participant_id, sortie_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE password_reset_token (id_password_reset_token CHAR(36) NOT NULL COMMENT \'(DC2Type:guid)\', token VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL, email VARCHAR(255) NOT NULL, PRIMARY KEY(id_password_reset_token)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE site (id_site CHAR(36) NOT NULL COMMENT \'(DC2Type:guid)\', nom VARCHAR(255) NOT NULL, PRIMARY KEY(id_site)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE sortie (id_sortie CHAR(36) NOT NULL COMMENT \'(DC2Type:guid)\', site_id CHAR(36) NOT NULL COMMENT \'(DC2Type:guid)\', organisateur_id CHAR(36) NOT NULL COMMENT \'(DC2Type:guid)\', lieu_id CHAR(36) NOT NULL COMMENT \'(DC2Type:guid)\', etat_id CHAR(36) NOT NULL COMMENT \'(DC2Type:guid)\', nom VARCHAR(255) NOT NULL, date_heure_debut DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', duree INT DEFAULT NULL, date_limite_inscription DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', nb_inscriptions_max INT DEFAULT NULL, infos_sortie VARCHAR(255) DEFAULT NULL, INDEX IDX_3C3FD3F2F6BD1646 (site_id), INDEX IDX_3C3FD3F2D936B2FA (organisateur_id), INDEX IDX_3C3FD3F26AB213CC (lieu_id), INDEX IDX_3C3FD3F2D5E86FF (etat_id), PRIMARY KEY(id_sortie)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE ville (id_ville CHAR(36) NOT NULL COMMENT \'(DC2Type:guid)\', nom VARCHAR(255) NOT NULL, code_postal INT DEFAULT NULL, PRIMARY KEY(id_ville)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE messenger_messages (id BIGINT AUTO_INCREMENT NOT NULL, body LONGTEXT NOT NULL, headers LONGTEXT NOT NULL, queue_name VARCHAR(190) NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', available_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', delivered_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_75EA56E0FB7336F0 (queue_name), INDEX IDX_75EA56E0E3BD61CE (available_at), INDEX IDX_75EA56E016BA31DB (delivered_at), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE lieu ADD CONSTRAINT FK_2F577D59A73F0036 FOREIGN KEY (ville_id) REFERENCES ville (id_ville)');
$this->addSql('ALTER TABLE participant ADD CONSTRAINT FK_D79F6B11F6BD1646 FOREIGN KEY (site_id) REFERENCES site (id_site)');
$this->addSql('ALTER TABLE participant_sortie ADD CONSTRAINT FK_8E436D739D1C3019 FOREIGN KEY (participant_id) REFERENCES participant (id_participant)');
$this->addSql('ALTER TABLE participant_sortie ADD CONSTRAINT FK_8E436D73CC72D953 FOREIGN KEY (sortie_id) REFERENCES sortie (id_sortie)');
$this->addSql('ALTER TABLE sortie ADD CONSTRAINT FK_3C3FD3F2F6BD1646 FOREIGN KEY (site_id) REFERENCES site (id_site)');
$this->addSql('ALTER TABLE sortie ADD CONSTRAINT FK_3C3FD3F2D936B2FA FOREIGN KEY (organisateur_id) REFERENCES participant (id_participant)');
$this->addSql('ALTER TABLE sortie ADD CONSTRAINT FK_3C3FD3F26AB213CC FOREIGN KEY (lieu_id) REFERENCES lieu (id_lieu)');
$this->addSql('ALTER TABLE sortie ADD CONSTRAINT FK_3C3FD3F2D5E86FF FOREIGN KEY (etat_id) REFERENCES etat (id_etat)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE lieu DROP FOREIGN KEY FK_2F577D59A73F0036');
$this->addSql('ALTER TABLE participant DROP FOREIGN KEY FK_D79F6B11F6BD1646');
$this->addSql('ALTER TABLE participant_sortie DROP FOREIGN KEY FK_8E436D739D1C3019');
$this->addSql('ALTER TABLE participant_sortie DROP FOREIGN KEY FK_8E436D73CC72D953');
$this->addSql('ALTER TABLE sortie DROP FOREIGN KEY FK_3C3FD3F2F6BD1646');
$this->addSql('ALTER TABLE sortie DROP FOREIGN KEY FK_3C3FD3F2D936B2FA');
$this->addSql('ALTER TABLE sortie DROP FOREIGN KEY FK_3C3FD3F26AB213CC');
$this->addSql('ALTER TABLE sortie DROP FOREIGN KEY FK_3C3FD3F2D5E86FF');
$this->addSql('DROP TABLE etat');
$this->addSql('DROP TABLE lieu');
$this->addSql('DROP TABLE participant');
$this->addSql('DROP TABLE participant_sortie');
$this->addSql('DROP TABLE password_reset_token');
$this->addSql('DROP TABLE site');
$this->addSql('DROP TABLE sortie');
$this->addSql('DROP TABLE ville');
$this->addSql('DROP TABLE messenger_messages');
}
}

View File

@@ -10,7 +10,7 @@ use Doctrine\Migrations\AbstractMigration;
/** /**
* Auto-generated Migration: Please modify to your needs! * Auto-generated Migration: Please modify to your needs!
*/ */
final class Version20241121085948 extends AbstractMigration final class Version20241125095027 extends AbstractMigration
{ {
public function getDescription(): string public function getDescription(): string
{ {
@@ -20,14 +20,12 @@ final class Version20241121085948 extends AbstractMigration
public function up(Schema $schema): void public function up(Schema $schema): void
{ {
// this up() migration is auto-generated, please modify it to your needs // this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE sortie ADD CONSTRAINT FK_3C3FD3F2D936B2FA FOREIGN KEY (organisateur_id) REFERENCES participant (id_participant)'); $this->addSql('ALTER TABLE lieu ADD ville VARCHAR(255) NOT NULL, ADD code_postal INT NOT NULL');
$this->addSql('CREATE INDEX IDX_3C3FD3F2D936B2FA ON sortie (organisateur_id)');
} }
public function down(Schema $schema): void public function down(Schema $schema): void
{ {
// this down() migration is auto-generated, please modify it to your needs // this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE sortie DROP FOREIGN KEY FK_3C3FD3F2D936B2FA'); $this->addSql('ALTER TABLE lieu DROP ville, DROP code_postal');
$this->addSql('DROP INDEX IDX_3C3FD3F2D936B2FA ON sortie');
} }
} }

View File

@@ -73,7 +73,6 @@ class LieuController extends AbstractController
return new JsonResponse(['error' => 'Ville non trouvée'], Response::HTTP_NOT_FOUND); return new JsonResponse(['error' => 'Ville non trouvée'], Response::HTTP_NOT_FOUND);
} }
// Utilisez l'API Nominatim pour récupérer les bounds
$params = [ $params = [
'q' => $ville->getNom(), 'q' => $ville->getNom(),
'format' => 'json', 'format' => 'json',

View File

@@ -28,7 +28,6 @@ class SortieController extends AbstractController
): Response { ): Response {
$sortie = new Sortie(); $sortie = new Sortie();
// Récupérer l'utilisateur connecté
$token = $tokenStorage->getToken(); $token = $tokenStorage->getToken();
$userConnect = $token?->getUser(); $userConnect = $token?->getUser();
@@ -37,12 +36,10 @@ class SortieController extends AbstractController
return $this->redirectToRoute('app_login'); return $this->redirectToRoute('app_login');
} }
// Créer le formulaire
$form = $this->createForm(SortieType::class, $sortie); $form = $this->createForm(SortieType::class, $sortie);
$form->handleRequest($request); $form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) { if ($form->isSubmitted() && $form->isValid()) {
// Récupérer l'ID du lieu depuis le formulaire
$lieuId = $form->get('lieu')->getData(); $lieuId = $form->get('lieu')->getData();
$lieu = $lieuRepository->find($lieuId); $lieu = $lieuRepository->find($lieuId);
@@ -51,10 +48,8 @@ class SortieController extends AbstractController
return $this->redirectToRoute('sortie_create'); return $this->redirectToRoute('sortie_create');
} }
// Associer le lieu à la sortie
$sortie->setLieu($lieu); $sortie->setLieu($lieu);
// Associer le site à partir de l'utilisateur connecté
$participant = $participantRepository->find($userConnect->getIdParticipant()); $participant = $participantRepository->find($userConnect->getIdParticipant());
if (!$participant) { if (!$participant) {
@@ -64,20 +59,16 @@ class SortieController extends AbstractController
$sortie->setSite($participant->getSite()); $sortie->setSite($participant->getSite());
// Récupérer l'état "en création" avec l'ID donné
$etat = $etatRepository->find('019349ba-38ca-7a39-93c3-62f046671525'); $etat = $etatRepository->find('019349ba-38ca-7a39-93c3-62f046671525');
if (!$etat) { if (!$etat) {
$this->addFlash('error', 'État non trouvé.'); $this->addFlash('error', 'État non trouvé.');
return $this->redirectToRoute('sortie_create'); return $this->redirectToRoute('sortie_create');
} }
// Associer l'état à la sortie
$sortie->setEtat($etat); $sortie->setEtat($etat);
// Associer l'organisateur à la sortie
$sortie->setOrganisateur($participant); $sortie->setOrganisateur($participant);
// Sauvegarder la sortie
$entityManager->persist($sortie); $entityManager->persist($sortie);
$entityManager->flush(); $entityManager->flush();
@@ -95,7 +86,6 @@ class SortieController extends AbstractController
#[Route('/view/{id}', name: 'view', methods: ['GET'])] #[Route('/view/{id}', name: 'view', methods: ['GET'])]
public function view(string $id, EntityManagerInterface $entityManager, TokenStorageInterface $tokenStorage): Response public function view(string $id, EntityManagerInterface $entityManager, TokenStorageInterface $tokenStorage): Response
{ {
// Récupérer l'utilisateur connecté
$token = $tokenStorage->getToken(); $token = $tokenStorage->getToken();
$userConnect = $token?->getUser(); $userConnect = $token?->getUser();
@@ -106,7 +96,6 @@ class SortieController extends AbstractController
return $this->redirectToRoute('home'); return $this->redirectToRoute('home');
} }
// Récupérer le profil de l'utilisateur connecté
$profile = $this->getUser(); $profile = $this->getUser();
return $this->render('sortie/view.html.twig', [ return $this->render('sortie/view.html.twig', [
@@ -118,7 +107,6 @@ class SortieController extends AbstractController
#[Route('/inscription/{id}', name: 'inscription', methods: ['POST'])] #[Route('/inscription/{id}', name: 'inscription', methods: ['POST'])]
public function inscription(string $id, EntityManagerInterface $entityManager, TokenStorageInterface $tokenStorage): Response public function inscription(string $id, EntityManagerInterface $entityManager, TokenStorageInterface $tokenStorage): Response
{ {
// Récupérer l'utilisateur connecté
$token = $tokenStorage->getToken(); $token = $tokenStorage->getToken();
$userConnect = $token?->getUser(); $userConnect = $token?->getUser();
@@ -127,7 +115,6 @@ class SortieController extends AbstractController
return $this->redirectToRoute('app_login'); return $this->redirectToRoute('app_login');
} }
// Récupérer la sortie
$sortie = $entityManager->getRepository(Sortie::class)->find($id); $sortie = $entityManager->getRepository(Sortie::class)->find($id);
if (!$sortie) { if (!$sortie) {
@@ -135,25 +122,21 @@ class SortieController extends AbstractController
return $this->redirectToRoute('home'); return $this->redirectToRoute('home');
} }
// Vérifier que la sortie est "Ouverte"
if ($sortie->getEtat()->getLibelle() !== 'Ouverte') { if ($sortie->getEtat()->getLibelle() !== 'Ouverte') {
$this->addFlash('error', 'Vous ne pouvez pas vous inscrire à cette sortie car elle n\'est pas ouverte.'); $this->addFlash('error', 'Vous ne pouvez pas vous inscrire à cette sortie car elle n\'est pas ouverte.');
return $this->redirectToRoute('sortie_view', ['id' => $id]); return $this->redirectToRoute('sortie_view', ['id' => $id]);
} }
// Vérifier si l'utilisateur est déjà inscrit
if ($sortie->getParticipants()->contains($userConnect)) { if ($sortie->getParticipants()->contains($userConnect)) {
$this->addFlash('error', 'Vous êtes déjà inscrit à cette sortie.'); $this->addFlash('error', 'Vous êtes déjà inscrit à cette sortie.');
return $this->redirectToRoute('sortie_view', ['id' => $id]); return $this->redirectToRoute('sortie_view', ['id' => $id]);
} }
// Vérifier le nombre maximum d'inscriptions
if ($sortie->getParticipants()->count() >= $sortie->getNbInscriptionsMax()) { if ($sortie->getParticipants()->count() >= $sortie->getNbInscriptionsMax()) {
$this->addFlash('error', 'Le nombre maximum d\'inscriptions a été atteint pour cette sortie.'); $this->addFlash('error', 'Le nombre maximum d\'inscriptions a été atteint pour cette sortie.');
return $this->redirectToRoute('sortie_view', ['id' => $id]); return $this->redirectToRoute('sortie_view', ['id' => $id]);
} }
// Ajouter l'utilisateur à la liste des participants
$sortie->addParticipant($userConnect); $sortie->addParticipant($userConnect);
$entityManager->flush(); $entityManager->flush();
@@ -170,7 +153,6 @@ class SortieController extends AbstractController
TokenStorageInterface $tokenStorage, TokenStorageInterface $tokenStorage,
LieuRepository $lieuRepository LieuRepository $lieuRepository
): Response { ): Response {
// Récupérer la sortie
$sortie = $entityManager->getRepository(Sortie::class)->find($id); $sortie = $entityManager->getRepository(Sortie::class)->find($id);
if (!$sortie) { if (!$sortie) {
@@ -178,7 +160,6 @@ class SortieController extends AbstractController
return $this->redirectToRoute('home'); return $this->redirectToRoute('home');
} }
// Vérifier si l'utilisateur est l'organisateur
$token = $tokenStorage->getToken(); $token = $tokenStorage->getToken();
$userConnect = $token?->getUser(); $userConnect = $token?->getUser();
@@ -187,12 +168,10 @@ class SortieController extends AbstractController
return $this->redirectToRoute('home'); return $this->redirectToRoute('home');
} }
// Créer le formulaire
$form = $this->createForm(SortieType::class, $sortie); $form = $this->createForm(SortieType::class, $sortie);
$form->handleRequest($request); $form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) { if ($form->isSubmitted() && $form->isValid()) {
// Mettre à jour le lieu si modifié
$lieuId = $form->get('lieu')->getData(); $lieuId = $form->get('lieu')->getData();
$lieu = $lieuRepository->find($lieuId); $lieu = $lieuRepository->find($lieuId);
@@ -200,7 +179,6 @@ class SortieController extends AbstractController
$sortie->setLieu($lieu); $sortie->setLieu($lieu);
} }
// Sauvegarder les modifications
$entityManager->flush(); $entityManager->flush();
$this->addFlash('success', 'La sortie a été mise à jour avec succès.'); $this->addFlash('success', 'La sortie a été mise à jour avec succès.');

View File

@@ -16,14 +16,12 @@ class VilleController extends AbstractController
#[Route('/get-lieux/{id}', name: 'get_lieux', methods: ['GET'])] #[Route('/get-lieux/{id}', name: 'get_lieux', methods: ['GET'])]
public function getLieux(string $id, VilleRepository $villeRepository, LieuRepository $lieuRepository): JsonResponse public function getLieux(string $id, VilleRepository $villeRepository, LieuRepository $lieuRepository): JsonResponse
{ {
// Trouve la ville correspondant à l'ID (GUID)
$ville = $villeRepository->find($id); $ville = $villeRepository->find($id);
if (!$ville) { if (!$ville) {
return new JsonResponse(['error' => 'Ville non trouvée'], Response::HTTP_NOT_FOUND); return new JsonResponse(['error' => 'Ville non trouvée'], Response::HTTP_NOT_FOUND);
} }
// Trouve tous les lieux associés à la ville
$lieux = $lieuRepository->findBy(['ville' => $ville]); $lieux = $lieuRepository->findBy(['ville' => $ville]);
$response = []; $response = [];

View File

@@ -26,6 +26,6 @@ class EtatFixtures extends Fixture
$manager->persist($etat); $manager->persist($etat);
} }
$manager->flush(); // Enregistrement en base de données $manager->flush();
} }
} }

View File

@@ -14,7 +14,6 @@ class LieuFixtures extends Fixture implements DependentFixtureInterface
{ {
$faker = Factory::create(); $faker = Factory::create();
// Exemple : Références pour des villes déjà créées dans VilleFixtures
$villes = [ $villes = [
$this->getReference('ville_Paris'), $this->getReference('ville_Paris'),
$this->getReference('ville_Lyon'), $this->getReference('ville_Lyon'),
@@ -22,13 +21,13 @@ class LieuFixtures extends Fixture implements DependentFixtureInterface
]; ];
foreach ($villes as $ville) { foreach ($villes as $ville) {
for ($i = 0; $i < 5; $i++) { // Génère 5 lieux par ville for ($i = 0; $i < 5; $i++) {
$lieu = new Lieu(); $lieu = new Lieu();
$lieu->setNom($faker->streetName()); $lieu->setNom($faker->streetName());
$lieu->setRue($faker->streetAddress()); $lieu->setRue($faker->streetAddress());
$lieu->setLatitude($faker->latitude()); $lieu->setLatitude($faker->latitude());
$lieu->setLongitude($faker->longitude()); $lieu->setLongitude($faker->longitude());
$lieu->setVille($ville); // Associe le lieu à une ville $lieu->setVille($ville);
$manager->persist($lieu); $manager->persist($lieu);
} }
} }
@@ -39,7 +38,7 @@ class LieuFixtures extends Fixture implements DependentFixtureInterface
public function getDependencies(): array public function getDependencies(): array
{ {
return [ return [
VilleFixtures::class, // Assure que VilleFixtures est chargée en premier VilleFixtures::class,
]; ];
} }
} }

View File

@@ -10,7 +10,6 @@ class VilleFixtures extends Fixture
{ {
public function load(ObjectManager $manager): void public function load(ObjectManager $manager): void
{ {
// Tableau associatif contenant les noms des villes et leurs codes postaux
$villes = [ $villes = [
['nom' => 'Paris', 'codePostal' => '75000'], ['nom' => 'Paris', 'codePostal' => '75000'],
['nom' => 'Lyon', 'codePostal' => '69000'], ['nom' => 'Lyon', 'codePostal' => '69000'],
@@ -23,7 +22,6 @@ class VilleFixtures extends Fixture
$ville->setCodePostal($villeData['codePostal']); // Définit le code postal $ville->setCodePostal($villeData['codePostal']); // Définit le code postal
$manager->persist($ville); $manager->persist($ville);
// Ajoute une référence pour les fixtures de lieux
$this->addReference('ville_' . $villeData['nom'], $ville); $this->addReference('ville_' . $villeData['nom'], $ville);
} }

View File

@@ -28,16 +28,18 @@ class Lieu
#[ORM\Column(nullable: true)] #[ORM\Column(nullable: true)]
private ?float $longitude = null; private ?float $longitude = null;
#[ORM\Column(length: 255)]
private ?string $ville = null;
#[ORM\Column(type: 'integer')]
private ?int $codePostal = null;
/** /**
* @var Collection<int, Sortie> * @var Collection<int, Sortie>
*/ */
#[ORM\OneToMany(targetEntity: Sortie::class, mappedBy: 'lieu')] #[ORM\OneToMany(targetEntity: Sortie::class, mappedBy: 'lieu')]
private Collection $sorties; private Collection $sorties;
#[ORM\ManyToOne(inversedBy: 'lieux')]
#[ORM\JoinColumn(name: 'ville_id', referencedColumnName: 'id_ville', nullable: false)]
private ?Ville $ville = null;
public function __construct() public function __construct()
{ {
$this->sorties = new ArrayCollection(); $this->sorties = new ArrayCollection();
@@ -96,6 +98,30 @@ class Lieu
return $this; return $this;
} }
public function getVille(): ?string
{
return $this->ville;
}
public function setVille(string $ville): self
{
$this->ville = $ville;
return $this;
}
public function getCodePostal(): ?int
{
return $this->codePostal;
}
public function setCodePostal(int $codePostal): self
{
$this->codePostal = $codePostal;
return $this;
}
/** /**
* @return Collection<int, Sortie> * @return Collection<int, Sortie>
*/ */
@@ -125,18 +151,4 @@ class Lieu
return $this; return $this;
} }
public function getVille(): ?Ville
{
return $this->ville;
}
public function setVille(?Ville $ville): self
{
$this->ville = $ville;
return $this;
}
} }

View File

@@ -1,94 +0,0 @@
<?php
namespace App\Entity;
use App\Repository\VilleRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: VilleRepository::class)]
class Ville
{
#[ORM\Id]
#[ORM\Column(type: 'guid', unique: true)]
#[ORM\GeneratedValue(strategy: 'CUSTOM')]
#[ORM\CustomIdGenerator(class: 'doctrine.uuid_generator')]
private ?string $idVille = null;
#[ORM\Column(length: 255)]
private ?string $nom = null;
#[ORM\Column(nullable: true)]
private ?int $codePostal = null;
/**
* @var Collection<int, Lieu>
*/
#[ORM\OneToMany(targetEntity: Lieu::class, mappedBy: 'ville')]
private Collection $lieux;
public function __construct()
{
$this->lieux = new ArrayCollection();
}
public function getIdVille(): ?string
{
return $this->idVille;
}
public function getNom(): ?string
{
return $this->nom;
}
public function setNom(string $nom): self
{
$this->nom = $nom;
return $this;
}
public function getCodePostal(): ?int
{
return $this->codePostal;
}
public function setCodePostal(?int $codePostal): self
{
$this->codePostal = $codePostal;
return $this;
}
/**
* @return Collection<int, Lieu>
*/
public function getLieux(): Collection
{
return $this->lieux;
}
public function addLieu(Lieu $lieu): self
{
if (!$this->lieux->contains($lieu)) {
$this->lieux->add($lieu);
$lieu->setVille($this);
}
return $this;
}
public function removeLieu(Lieu $lieu): self
{
if ($this->lieux->removeElement($lieu)) {
// Set the owning side to null (unless already changed)
if ($lieu->getVille() === $this) {
$lieu->setVille(null);
}
}
return $this;
}
}

View File

@@ -54,14 +54,6 @@ class SortieType extends AbstractType
'required' => false, 'required' => false,
'attr' => ['class' => 'form-control'], 'attr' => ['class' => 'form-control'],
]) ])
->add('ville', EntityType::class, [
'class' => Ville::class,
'choice_label' => 'nom',
'mapped' => false, // Non lié à l'entité Sortie
'label' => 'Ville',
'placeholder' => 'Sélectionnez une ville',
'attr' => ['id' => 'ville-select'],
])
->add('lieu', EntityType::class, [ ->add('lieu', EntityType::class, [
'class' => Lieu::class, 'class' => Lieu::class,
'choice_label' => 'nom', 'choice_label' => 'nom',

View File

@@ -17,7 +17,6 @@
<img src="{{ asset('img/logo.svg') }}" alt="Logo" class="h-10"> <img src="{{ asset('img/logo.svg') }}" alt="Logo" class="h-10">
</div> </div>
</a> </a>
<!-- Liens de navigation -->
<div class="relative"> <div class="relative">
{% if app.user %} {% if app.user %}
<div id="menu-button" class="w-full flex justify-center"> <div id="menu-button" class="w-full flex justify-center">

View File

@@ -13,10 +13,8 @@
<div class="container mx-auto p-6 bg-gray-50 rounded-lg shadow-lg mt-6"> <div class="container mx-auto p-6 bg-gray-50 rounded-lg shadow-lg mt-6">
<h1 class="text-3xl font-bold text-center text-gray-800 mb-8">🎉 Liste des sorties</h1> <h1 class="text-3xl font-bold text-center text-gray-800 mb-8">🎉 Liste des sorties</h1>
<!-- Section de filtre -->
<form method="GET" action="{{ path('home') }}" class="bg-white rounded-lg shadow-md p-4 mb-6"> <form method="GET" action="{{ path('home') }}" class="bg-white rounded-lg shadow-md p-4 mb-6">
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6"> <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6">
<!-- Filtre par nom -->
<div> <div>
<label for="search" class="block text-sm font-medium text-gray-700">🔍 Recherche</label> <label for="search" class="block text-sm font-medium text-gray-700">🔍 Recherche</label>
<input type="text" name="search" id="search" value="{{ app.request.query.get('search', '') }}" <input type="text" name="search" id="search" value="{{ app.request.query.get('search', '') }}"
@@ -24,7 +22,6 @@
placeholder="Nom de la sortie"> placeholder="Nom de la sortie">
</div> </div>
<!-- Filtre par site -->
<div> <div>
<label for="site" class="block text-sm font-medium text-gray-700">📍 Site</label> <label for="site" class="block text-sm font-medium text-gray-700">📍 Site</label>
<select name="site" id="site" class="block w-full mt-2 rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm"> <select name="site" id="site" class="block w-full mt-2 rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm">
@@ -37,14 +34,12 @@
</select> </select>
</div> </div>
<!-- Filtre par date de début -->
<div> <div>
<label for="start_date" class="block text-sm font-medium text-gray-700">📅 Date de début</label> <label for="start_date" class="block text-sm font-medium text-gray-700">📅 Date de début</label>
<input type="date" name="start_date" id="start_date" value="{{ app.request.query.get('start_date', '') }}" <input type="date" name="start_date" id="start_date" value="{{ app.request.query.get('start_date', '') }}"
class="block w-full mt-2 rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm"> class="block w-full mt-2 rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm">
</div> </div>
<!-- Filtre par date de fin -->
<div> <div>
<label for="end_date" class="block text-sm font-medium text-gray-700">📅 Date de fin</label> <label for="end_date" class="block text-sm font-medium text-gray-700">📅 Date de fin</label>
<input type="date" name="end_date" id="end_date" value="{{ app.request.query.get('end_date', '') }}" <input type="date" name="end_date" id="end_date" value="{{ app.request.query.get('end_date', '') }}"
@@ -52,7 +47,6 @@
</div> </div>
</div> </div>
<!-- Cases à cocher -->
<div class="mt-4 grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4"> <div class="mt-4 grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4">
<div class="flex items-center"> <div class="flex items-center">
<input type="checkbox" name="organisateur" id="organisateur" value="1" <input type="checkbox" name="organisateur" id="organisateur" value="1"
@@ -83,7 +77,6 @@
</div> </div>
</div> </div>
<!-- Bouton soumettre -->
<div class="mt-6 flex justify-end"> <div class="mt-6 flex justify-end">
<button type="submit" class="px-6 py-2 bg-blue-500 text-white rounded-md shadow hover:bg-blue-600"> <button type="submit" class="px-6 py-2 bg-blue-500 text-white rounded-md shadow hover:bg-blue-600">
🔎 Filtrer 🔎 Filtrer
@@ -91,7 +84,6 @@
</div> </div>
</form> </form>
<!-- Affichage des sorties -->
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-6 gap-6"> <div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-6 gap-6">
<a href="/sortie/creates"> <a href="/sortie/creates">
<div class="bg-white rounded-lg shadow-md p-4 text-center"> <div class="bg-white rounded-lg shadow-md p-4 text-center">

View File

@@ -6,14 +6,7 @@
{% block title %}&#128227; Sortie.com Nouvelle sortie &#128266;{% endblock %} {% block title %}&#128227; Sortie.com Nouvelle sortie &#128266;{% endblock %}
{% block stylesheets %} {% block stylesheets %}
{{ encore_entry_link_tags('app') }} {{ encore_entry_link_tags('app') }}
<link rel="stylesheet" href="https://unpkg.com/leaflet/dist/leaflet.css" />
<link rel="stylesheet" href="https://unpkg.com/leaflet-geosearch/dist/geosearch.css" />
<style> <style>
#map {
width: 100%;
height: 500px;
}
.form-group { .form-group {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@@ -46,10 +39,6 @@
.modern-button svg { .modern-button svg {
margin-right: 0.5rem; margin-right: 0.5rem;
} }
#add-lieu-modal .bg-white {
max-width: 80%;
max-height: 90%;
}
</style> </style>
{% endblock %} {% endblock %}
</head> </head>
@@ -62,7 +51,6 @@
{{ form_start(form, { 'attr': { 'class': 'space-y-6' } }) }} {{ form_start(form, { 'attr': { 'class': 'space-y-6' } }) }}
<div class="grid grid-cols-1 md:grid-cols-2 gap-6"> <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<div class="space-y-4"> <div class="space-y-4">
<div class="form-group"> <div class="form-group">
@@ -98,38 +86,28 @@
<div class="space-y-4"> <div class="space-y-4">
<div class="form-group"> <div class="form-group">
<label for="sortie_ville">Ville organisatrice</label> <label for="sortie_ville">Ville</label>
{{ form_widget(form.ville, { 'attr': { 'class': 'block w-full p-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500', 'id': 'ville-select' } }) }} {{ form_widget(form.ville, { 'attr': { 'class': 'block w-full p-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500' } }) }}
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="sortie_lieu">Lieu</label> <label for="sortie_codePostal">Code postal</label>
<div class="flex items-center space-x-2"> {{ form_widget(form.codePostal, { 'attr': { 'class': 'block w-full p-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500' } }) }}
{{ form_widget(form.lieu, { 'attr': { 'class': 'block w-full p-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500', 'id': 'lieu-select' } }) }}
<button type="button" id="add-lieu-button" class="modern-button">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" class="w-5 h-5">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4" />
</svg>
Ajouter
</button>
</div>
</div> </div>
<div> <div class="form-group">
<label class="block text-sm font-medium text-gray-700">Rue :</label> <label for="sortie_rue">Rue</label>
<span id="rue-value" class="block w-full p-3 border border-gray-300 rounded-lg bg-gray-100">Renseigner avec le lieu</span> {{ form_widget(form.rue, { 'attr': { 'class': 'block w-full p-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500' } }) }}
</div> </div>
<div>
<label class="block text-sm font-medium text-gray-700">Code postal :</label> <div class="form-group">
<span id="codePostal-value" class="block w-full p-3 border border-gray-300 rounded-lg bg-gray-100">Renseigner avec le lieu</span> <label for="sortie_latitude">Latitude</label>
{{ form_widget(form.latitude, { 'attr': { 'class': 'block w-full p-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500' } }) }}
</div> </div>
<div>
<label class="block text-sm font-medium text-gray-700">Latitude :</label> <div class="form-group">
<span id="latitude-value" class="block w-full p-3 border border-gray-300 rounded-lg bg-gray-100">Renseigner avec le lieu</span> <label for="sortie_longitude">Longitude</label>
</div> {{ form_widget(form.longitude, { 'attr': { 'class': 'block w-full p-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500' } }) }}
<div>
<label class="block text-sm font-medium text-gray-700">Longitude :</label>
<span id="longitude-value" class="block w-full p-3 border border-gray-300 rounded-lg bg-gray-100">Renseigner avec le lieu</span>
</div> </div>
</div> </div>
</div> </div>
@@ -146,31 +124,4 @@
{{ form_end(form, { 'render_rest': false }) }} {{ form_end(form, { 'render_rest': false }) }}
</div> </div>
</div> </div>
<div id="add-lieu-modal" class="fixed inset-0 flex items-center justify-center bg-gray-800 bg-opacity-50 hidden">
<div class="bg-white p-6 rounded-lg shadow-lg w-full max-w-4xl">
<h2 class="text-xl font-bold mb-4">Ajouter un lieu</h2>
<div class="form-group mb-4">
<label for="lieu-nom" class="block text-sm font-medium text-gray-700">Nom du lieu</label>
<input type="text" id="lieu-nom" class="block w-full p-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500" placeholder="Nom du lieu" />
<div id="lieu-nom-error" class="text-sm text-red-500 mt-1 hidden"></div>
</div>
<div id="map" class="w-full h-96 mb-4 rounded-lg"></div>
<div class="flex justify-end space-x-4">
<button type="button" id="cancel-add-lieu" class="px-4 py-2 bg-gray-500 text-white rounded-lg hover:bg-gray-600 focus:outline-none focus:ring-2 focus:ring-gray-300">Annuler</button>
<button type="button" id="save-lieu" class="px-4 py-2 bg-blue-500 text-white rounded-lg hover:bg-blue-600 focus:outline-none focus:ring-2 focus:ring-blue-300">Enregistrer</button>
</div>
</div>
</div>
{% block javascripts %}
<script src="https://unpkg.com/leaflet/dist/leaflet.js"></script>
<script src="https://unpkg.com/leaflet-geosearch/dist/geosearch.umd.js"></script>
{{ encore_entry_script_tags('add-lieu') }}
{{ encore_entry_script_tags('lieu') }}
{% endblock %}
{% endblock %} {% endblock %}

View File

@@ -16,7 +16,6 @@
{{ form_start(form, { 'attr': { 'class': 'space-y-8' } }) }} {{ form_start(form, { 'attr': { 'class': 'space-y-8' } }) }}
<!-- Informations principales -->
<div class="grid grid-cols-1 lg:grid-cols-2 gap-8"> <div class="grid grid-cols-1 lg:grid-cols-2 gap-8">
<div> <div>
<label for="nom" class="block text-sm font-semibold text-gray-700 mb-2"> <label for="nom" class="block text-sm font-semibold text-gray-700 mb-2">
@@ -32,7 +31,6 @@
</div> </div>
</div> </div>
<!-- Durée et date limite d'inscription -->
<div class="grid grid-cols-1 lg:grid-cols-2 gap-8"> <div class="grid grid-cols-1 lg:grid-cols-2 gap-8">
<div> <div>
<label for="duree" class="block text-sm font-semibold text-gray-700 mb-2"> <label for="duree" class="block text-sm font-semibold text-gray-700 mb-2">
@@ -48,7 +46,6 @@
</div> </div>
</div> </div>
<!-- Nombre maximum et informations complémentaires -->
<div class="grid grid-cols-1 lg:grid-cols-2 gap-8"> <div class="grid grid-cols-1 lg:grid-cols-2 gap-8">
<div> <div>
<label for="nbInscriptionsMax" class="block text-sm font-semibold text-gray-700 mb-2"> <label for="nbInscriptionsMax" class="block text-sm font-semibold text-gray-700 mb-2">
@@ -64,7 +61,6 @@
</div> </div>
</div> </div>
<!-- Ville et lieu -->
<div class="grid grid-cols-1 lg:grid-cols-2 gap-8"> <div class="grid grid-cols-1 lg:grid-cols-2 gap-8">
<div> <div>
<label for="ville" class="block text-sm font-semibold text-gray-700 mb-2"> <label for="ville" class="block text-sm font-semibold text-gray-700 mb-2">
@@ -80,7 +76,6 @@
</div> </div>
</div> </div>
<!-- Boutons -->
<div class="flex justify-end mt-8 space-x-4"> <div class="flex justify-end mt-8 space-x-4">
<a href="{{ path('sortie_view', { id: sortie.getIdSortie() }) }}" class="px-6 py-3 bg-gray-500 text-white rounded-lg shadow-md hover:bg-gray-600"> <a href="{{ path('sortie_view', { id: sortie.getIdSortie() }) }}" class="px-6 py-3 bg-gray-500 text-white rounded-lg shadow-md hover:bg-gray-600">
❌ Annuler ❌ Annuler

View File

@@ -16,7 +16,6 @@
<h1 class="text-4xl font-bold text-center text-gray-800 mb-8">🎉 Détails de la sortie</h1> <h1 class="text-4xl font-bold text-center text-gray-800 mb-8">🎉 Détails de la sortie</h1>
<div class="grid grid-cols-1 lg:grid-cols-12 gap-8"> <div class="grid grid-cols-1 lg:grid-cols-12 gap-8">
<!-- Informations principales -->
<div class="lg:col-span-7 bg-white rounded-lg shadow p-6"> <div class="lg:col-span-7 bg-white rounded-lg shadow p-6">
<h2 class="text-2xl font-bold text-gray-700 border-b pb-4 mb-6">📋 Informations principales</h2> <h2 class="text-2xl font-bold text-gray-700 border-b pb-4 mb-6">📋 Informations principales</h2>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4"> <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
@@ -46,7 +45,6 @@
</p> </p>
</div> </div>
<!-- Description -->
<div class="bg-gray-100 rounded-lg p-4 mt-6"> <div class="bg-gray-100 rounded-lg p-4 mt-6">
<h3 class="text-xl font-semibold text-gray-700">📝 Description</h3> <h3 class="text-xl font-semibold text-gray-700">📝 Description</h3>
<p class="text-gray-800 text-lg mt-2"> <p class="text-gray-800 text-lg mt-2">
@@ -54,7 +52,6 @@
</p> </p>
</div> </div>
<!-- Participants -->
<div class="bg-gray-100 rounded-lg p-4 mt-6"> <div class="bg-gray-100 rounded-lg p-4 mt-6">
<h3 class="text-xl font-semibold text-gray-700">👥 Participants inscrits</h3> <h3 class="text-xl font-semibold text-gray-700">👥 Participants inscrits</h3>
{% if sortie.participants is not empty %} {% if sortie.participants is not empty %}
@@ -68,7 +65,6 @@
{% endif %} {% endif %}
</div> </div>
<!-- Bouton S'inscrire -->
{% if app.user and sortie.etat.libelle == 'Ouverte' and not sortie.participants.contains(app.user) %} {% if app.user and sortie.etat.libelle == 'Ouverte' and not sortie.participants.contains(app.user) %}
<form action="{{ path('sortie_inscription', { id: sortie.idSortie }) }}" method="post" class="mt-6"> <form action="{{ path('sortie_inscription', { id: sortie.idSortie }) }}" method="post" class="mt-6">
<button type="submit" class="px-6 py-3 bg-green-500 text-white rounded-md shadow hover:bg-green-600"> <button type="submit" class="px-6 py-3 bg-green-500 text-white rounded-md shadow hover:bg-green-600">
@@ -81,7 +77,6 @@
</div> </div>
{% endif %} {% endif %}
<!-- Modifier (visible uniquement pour l'organisateur) -->
{% if app.user and app.user.idParticipant == sortie.organisateur.idParticipant %} {% if app.user and app.user.idParticipant == sortie.organisateur.idParticipant %}
<div class="mt-6 flex justify-end"> <div class="mt-6 flex justify-end">
<a href="{{ path('sortie_edit', { id: sortie.idSortie }) }}" <a href="{{ path('sortie_edit', { id: sortie.idSortie }) }}"
@@ -92,7 +87,6 @@
{% endif %} {% endif %}
</div> </div>
<!-- Carte -->
<div class="lg:col-span-5 bg-white rounded-lg shadow p-6"> <div class="lg:col-span-5 bg-white rounded-lg shadow p-6">
<h2 class="text-2xl font-bold text-gray-700 border-b pb-4 mb-6">📍 Localisation</h2> <h2 class="text-2xl font-bold text-gray-700 border-b pb-4 mb-6">📍 Localisation</h2>
<div id="map" class="w-full h-96 rounded-lg shadow"></div> <div id="map" class="w-full h-96 rounded-lg shadow"></div>