Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c7cc6b20a0 | ||
|
|
2e89691ade | ||
|
|
42db692853 | ||
|
|
df68d55e5c |
Binary file not shown.
|
Before Width: | Height: | Size: 8.6 KiB |
@@ -24,7 +24,7 @@ use OpenAI\Client;
|
|||||||
#[Route('/sortie', name: 'sortie_')]
|
#[Route('/sortie', name: 'sortie_')]
|
||||||
class SortieController extends AbstractController
|
class SortieController extends AbstractController
|
||||||
{
|
{
|
||||||
#[Route('/liste', name: 'list', methods: ['GET'])]
|
#[Route('/sortie/liste', name: 'list', methods: ['GET'])]
|
||||||
public function index(
|
public function index(
|
||||||
TokenStorageInterface $tokenStorage,
|
TokenStorageInterface $tokenStorage,
|
||||||
SortieRepository $sortieRepository,
|
SortieRepository $sortieRepository,
|
||||||
@@ -43,6 +43,7 @@ class SortieController extends AbstractController
|
|||||||
$passees = $request->query->get('passees', false);
|
$passees = $request->query->get('passees', false);
|
||||||
|
|
||||||
$sorties = $sortieRepository->findWithFilters($search, $siteId, $startDate, $endDate, $organisateur, $inscrit, $nonInscrit, $passees, $userConnect);
|
$sorties = $sortieRepository->findWithFilters($search, $siteId, $startDate, $endDate, $organisateur, $inscrit, $nonInscrit, $passees, $userConnect);
|
||||||
|
|
||||||
return $this->render('sortie/list.html.twig', [
|
return $this->render('sortie/list.html.twig', [
|
||||||
'profile' => $userConnect,
|
'profile' => $userConnect,
|
||||||
'sorties' => $sorties,
|
'sorties' => $sorties,
|
||||||
@@ -104,7 +105,7 @@ class SortieController extends AbstractController
|
|||||||
$entityManager->flush();
|
$entityManager->flush();
|
||||||
|
|
||||||
$this->addFlash('success', 'La sortie a été créée avec succès.');
|
$this->addFlash('success', 'La sortie a été créée avec succès.');
|
||||||
return $this->redirectToRoute('sortie_view', ['id'=> $sortie->getIdSortie()]);
|
return $this->redirectToRoute('home');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->render('sortie/create.html.twig', [
|
return $this->render('sortie/create.html.twig', [
|
||||||
@@ -128,14 +129,6 @@ class SortieController extends AbstractController
|
|||||||
return $this->redirectToRoute('home');
|
return $this->redirectToRoute('home');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Changer l'état si date de début commencé.
|
|
||||||
if($sortie->getDateLimiteInscription() < new DateTime()){
|
|
||||||
$sortie->setEtat($entityManager->getRepository(Etat::class)->findOneBy(['libelle' => 'Clôturée']));
|
|
||||||
}
|
|
||||||
if ($sortie->getDateHeureDebut() <= (new DateTime())) {
|
|
||||||
$sortie->setEtat($entityManager->getRepository(Etat::class)->findOneBy(['libelle' => 'En cours']));
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->render('sortie/view.html.twig', [
|
return $this->render('sortie/view.html.twig', [
|
||||||
'sortie' => $sortie,
|
'sortie' => $sortie,
|
||||||
]);
|
]);
|
||||||
@@ -286,22 +279,4 @@ class SortieController extends AbstractController
|
|||||||
return $this->redirectToRoute('home');
|
return $this->redirectToRoute('home');
|
||||||
}
|
}
|
||||||
|
|
||||||
#[Route('/confirm/{id}', name: 'confirm', methods: ['POST'])]
|
|
||||||
public function confirm(string $id, EntityManagerInterface $entityManager, TokenStorageInterface $tokenStorage)
|
|
||||||
{
|
|
||||||
$user = $tokenStorage->getToken()?->getUser();
|
|
||||||
$sortie = $entityManager->getRepository(Sortie::class)->find($id);
|
|
||||||
|
|
||||||
if (!$sortie || $sortie->getOrganisateur()->getIdParticipant() !== $user->getIdParticipant()) {
|
|
||||||
$this->addFlash('error', 'Vous n\'avez pas l\'autorisation de démarrer les inscriptions pour cette sortie.');
|
|
||||||
return $this->redirectToRoute('sortie_view', ['id' => $id]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$sortie->setEtat($entityManager->getRepository(Etat::class)->findOneBy(['libelle' => 'Ouverte']));
|
|
||||||
$entityManager->flush();
|
|
||||||
|
|
||||||
$this->addFlash('success', 'Les inscriptions sont ouvertes pour cette sortie');
|
|
||||||
return $this->redirectToRoute('sortie_view', ['id' => $id]);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>{% block title %}📣 Sortir.com 🔊{% endblock %}</title>
|
<title>{% block title %}📣 Sortie.com 🔊{% endblock %}</title>
|
||||||
<link rel="icon" href="{{ asset('favicon.ico') }}" type="image/x-icon">
|
<link rel="icon" href="{{ asset('favicon.ico') }}" type="image/x-icon">
|
||||||
{% block stylesheets %}
|
{% block stylesheets %}
|
||||||
{{ encore_entry_link_tags('app') }}
|
{{ encore_entry_link_tags('app') }}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
<nav class="flex justify-between items-center py-4 px-6 shadow-md bg-gradient-to-r from-[#2A8D57] via-[#008167] to-[#1B5667]">
|
<nav class="flex justify-between items-center py-4 px-6 shadow-md bg-gradient-to-r from-[#2A8D57] via-[#008167] to-[#1B5667]">
|
||||||
<a href="/" class="flex items-center space-x-3">
|
<a href="/" class="flex items-center space-x-3">
|
||||||
<img src="{{ asset('img/logo.svg') }}" alt="Logo" class="h-10">
|
<img src="{{ asset('img/logo.svg') }}" alt="Logo" class="h-10">
|
||||||
<h3 class="text-3xl text-white font-bold">Sortir</h3>
|
<h3 class="text-3xl text-white font-bold">Sortie</h3>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<ul class="hidden md:flex space-x-6 text-white font-medium">
|
<ul class="hidden md:flex space-x-6 text-white font-medium">
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
<div class="container mx-auto p-4 sm:p-6 bg-gray-50 rounded-lg shadow-lg mt-4 sm:mt-6">
|
<div class="container mx-auto p-4 sm:p-6 bg-gray-50 rounded-lg shadow-lg mt-4 sm:mt-6">
|
||||||
<h1 class="text-2xl sm:text-3xl font-bold text-center text-gray-800 mb-6 sm:mb-8">🎉 Liste des sorties</h1>
|
<h1 class="text-2xl sm:text-3xl font-bold text-center text-gray-800 mb-6 sm:mb-8">🎉 Liste des sorties</h1>
|
||||||
|
|
||||||
<form method="GET" action="{{ path('sortie_list') }}" 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 sm:grid-cols-2 lg:grid-cols-4 gap-4 sm:gap-6">
|
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4 sm:gap-6">
|
||||||
<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>
|
||||||
|
|||||||
@@ -11,9 +11,6 @@
|
|||||||
#delete-modal {
|
#delete-modal {
|
||||||
z-index: 1050;
|
z-index: 1050;
|
||||||
}
|
}
|
||||||
#confirm-modal {
|
|
||||||
z-index: 1050;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</head>
|
</head>
|
||||||
@@ -97,32 +94,18 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if app.user and app.user.idParticipant == sortie.organisateur.idParticipant %}
|
{% if app.user and app.user.idParticipant == sortie.organisateur.idParticipant and sortie.etat.libelle == 'Créée' %}
|
||||||
<div class="mt-6 flex justify-end space-x-4">
|
<div class="mt-6 flex justify-end space-x-4">
|
||||||
{% if sortie.etat.libelle == 'Créée' or sortie.etat.libelle == 'Ouverte'%}
|
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
id="open-delete-modal"
|
id="open-delete-modal"
|
||||||
class="btnAnnule">
|
class="btnAnnule">
|
||||||
❌ Annuler la sortie
|
❌ Annuler la sortie
|
||||||
</button>
|
</button>
|
||||||
{% endif %}
|
<a href="{{ path('sortie_edit', { id: sortie.idSortie }) }}"
|
||||||
{% if sortie.etat.libelle == 'Créée' %}
|
class="btnSecondary">
|
||||||
<a href="{{ path('sortie_edit', { id: sortie.idSortie }) }}"
|
✏️ Modifier la sortie
|
||||||
class="px-6 py-3 bg-yellow-500 text-white rounded-md shadow hover:bg-yellow-600">
|
</a>
|
||||||
✏️ Modifier la sortie
|
|
||||||
</a>
|
|
||||||
{# <a href="{{ path('sortie_open', { id: sortie.idSortie }) }}"#}
|
|
||||||
{# class="px-6 py-3 bg-yellow-500 text-white rounded-md shadow hover:bg-yellow-600">#}
|
|
||||||
{# 🚀 Démarrer les inscriptions#}
|
|
||||||
{# </a>#}
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
id="open-confirm-modal"
|
|
||||||
class="px-6 py-3 bg-green-500 text-white rounded-md shadow hover:bg-green-600">
|
|
||||||
🚀 Démarrer les inscriptions
|
|
||||||
</button>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
@@ -179,31 +162,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{# Modale pour ouvrir les inscriptions d'une sortie#}
|
|
||||||
<div id="confirm-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-lg">
|
|
||||||
<h2 class="text-xl font-bold mb-4">Ouvrir les inscriptions</h2>
|
|
||||||
<form action="{{ path('sortie_confirm', {id: sortie.idSortie}) }}" method="post">
|
|
||||||
<div class="mb-4">
|
|
||||||
<p class="text-base">La modification de cette sortie ne sera pu possible une fois les inscriptions ouverte</p>
|
|
||||||
</div>
|
|
||||||
<div class="flex justify-end space-x-4">
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
id="cancel-confirm-modal"
|
|
||||||
class="px-4 py-2 bg-gray-500 text-white rounded-md hover:bg-gray-600">
|
|
||||||
Annuler
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
type="submit"
|
|
||||||
class="btnThird">
|
|
||||||
Démarrer les inscriptions
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex justify-center mt-8">
|
<div class="flex justify-center mt-8">
|
||||||
<a href="{{ path('home') }}" class="px-6 py-3 bg-blue-500 text-white rounded-md shadow hover:bg-blue-600">
|
<a href="{{ path('home') }}" class="px-6 py-3 bg-blue-500 text-white rounded-md shadow hover:bg-blue-600">
|
||||||
🔙 Retour à l'accueil
|
🔙 Retour à l'accueil
|
||||||
@@ -234,27 +192,16 @@
|
|||||||
.openPopup();
|
.openPopup();
|
||||||
|
|
||||||
const openModalButton = document.getElementById('open-delete-modal');
|
const openModalButton = document.getElementById('open-delete-modal');
|
||||||
const openModalConfirm = document.getElementById('open-confirm-modal');
|
|
||||||
|
|
||||||
const cancelModalButton = document.getElementById('cancel-modal');
|
const cancelModalButton = document.getElementById('cancel-modal');
|
||||||
const cancelModalConfirm = document.getElementById('cancel-confirm-modal')
|
|
||||||
|
|
||||||
const deleteModal = document.getElementById('delete-modal');
|
const deleteModal = document.getElementById('delete-modal');
|
||||||
const confirmModal = document.getElementById('confirm-modal');
|
|
||||||
|
|
||||||
openModalButton?.addEventListener('click', () => {
|
openModalButton?.addEventListener('click', () => {
|
||||||
deleteModal.classList.remove('hidden');
|
deleteModal.classList.remove('hidden');
|
||||||
});
|
});
|
||||||
|
|
||||||
cancelModalButton?.addEventListener('click', () => {
|
cancelModalButton?.addEventListener('click', () => {
|
||||||
deleteModal.classList.add('hidden');
|
deleteModal.classList.add('hidden');
|
||||||
});
|
});
|
||||||
|
|
||||||
openModalConfirm?.addEventListener('click', () => {
|
|
||||||
confirmModal.classList.remove('hidden');
|
|
||||||
})
|
|
||||||
cancelModalConfirm?.addEventListener('click', () => {
|
|
||||||
confirmModal.classList.add('hidden')
|
|
||||||
})
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
Reference in New Issue
Block a user