sortie > 1 month

This commit is contained in:
Olivier PARPAILLON
2024-11-25 16:22:18 +01:00
parent 72719df7c2
commit e853743b01
2 changed files with 14 additions and 11 deletions

View File

@@ -89,6 +89,10 @@ class SortieController extends AbstractController
$this->addFlash('error', 'Cette sortie n\'existe pas.');
return $this->redirectToRoute('home');
}
if ($sortie->getDateHeureDebut() < (new DateTime())->modify('-1 month')) {
$this->addFlash('error', "Cette sortie à plus de 30 jours.");
return $this->redirectToRoute('home');
}
return $this->render('sortie/view.html.twig', [
'sortie' => $sortie,

View File

@@ -92,18 +92,17 @@
</div>
</a>
{% for sortie in sorties %}
<div class="bg-white rounded-lg shadow-md p-4">
<h2 class="text-lg font-semibold text-gray-800">{{ sortie.nom }}</h2>
<p class="mt-2 text-gray-600">
<strong>Date de début :</strong> {{ sortie.dateHeureDebut|date('d/m/Y H:i') }}<br>
<strong>Durée :</strong> {{ sortie.duree }} minutes<br>
<strong>Inscriptions max :</strong> {{ sortie.nbInscriptionsMax }}<br>
<strong>Infos :</strong> {{ sortie.infosSortie }}
</p>
<div class="mt-4 flex justify-end">
<a href="{{ path('sortie_view', { id: sortie.idSortie }) }}" class="text-blue-500 hover:text-blue-700 font-medium">Voir plus</a>
<a href="{{ path('sortie_view', { id: sortie.idSortie }) }}" class="text-blue-500 hover:text-blue-700 font-medium">
<div class="bg-white rounded-lg shadow-md p-4">
<h2 class="text-lg font-semibold text-gray-800">{{ sortie.nom }}</h2>
<p class="mt-2 text-gray-600">
<strong>Date de début :</strong> {{ sortie.dateHeureDebut|date('d/m/Y H:i') }}<br>
<strong>Durée :</strong> {{ sortie.duree }} minutes<br>
<strong>Inscriptions max :</strong> {{ sortie.nbInscriptionsMax }}<br>
<strong>Infos :</strong> {{ sortie.infosSortie }}
</p>
</div>
</div>
</a>
{% else %}
<p class="text-gray-600 text-center col-span-6">Aucune sortie ne correspond à vos critères.</p>
{% endfor %}