From bacd365306da00f96db32603335f73c2153d71f9 Mon Sep 17 00:00:00 2001 From: mepiphana2023 Date: Mon, 25 Nov 2024 16:21:50 +0100 Subject: [PATCH] Motif anulation --- assets/js/add-lieu.js | 17 ++++++++++++++--- src/Entity/Sortie.php | 19 +++++++++++++++++++ 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/assets/js/add-lieu.js b/assets/js/add-lieu.js index 2188c13..38fd429 100644 --- a/assets/js/add-lieu.js +++ b/assets/js/add-lieu.js @@ -22,10 +22,21 @@ document.addEventListener("DOMContentLoaded", () => { // Initialiser la carte map = L.map("map").setView([48.8566, 2.3522], 13); // Coordonnées par défaut (Paris) L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", { - maxZoom: 19, - minZoom: 13, + maxZoom: 22, // Zoom infini + minZoom: 3, }).addTo(map); + // Ajouter la barre de recherche + const searchControl = new GeoSearch.GeoSearchControl({ + provider: new GeoSearch.OpenStreetMapProvider(), + style: 'bar', // Style de la barre de recherche + showMarker: false, // Ne pas ajouter de marqueur automatique + retainZoomLevel: false, + keepResult: true, + searchLabel: "Rechercher un lieu...", + }); + map.addControl(searchControl); + // Gérer les clics sur la carte map.on("click", async (e) => { const { lat, lng } = e.latlng; @@ -123,4 +134,4 @@ document.addEventListener("DOMContentLoaded", () => { alert("Une erreur inattendue s'est produite."); }); }); -}); \ No newline at end of file +}); diff --git a/src/Entity/Sortie.php b/src/Entity/Sortie.php index 9665236..0a0d7ee 100644 --- a/src/Entity/Sortie.php +++ b/src/Entity/Sortie.php @@ -60,6 +60,13 @@ class Sortie #[ORM\ManyToMany(targetEntity: Participant::class, mappedBy: 'sortiesParticipants')] private Collection $participants; + #[ORM\Column(type: Types::TEXT, nullable: true)] + #[Assert\Length( + max: 1000, + maxMessage: 'Le motif d\'annulation ne peut pas dépasser {{ limit }} caractères.' + )] + private ?string $motifAnnul = null; + public function __construct() { $this->participants = new ArrayCollection(); @@ -215,4 +222,16 @@ class Sortie return $this; } + + public function getMotifAnnul(): ?string + { + return $this->motifAnnul; + } + + public function setMotifAnnul(?string $motifAnnul): self + { + $this->motifAnnul = $motifAnnul; + + return $this; + } }