Merge branch 'main' into Marvin

# Conflicts:
#	src/Repository/SortieRepository.php
#	templates/sortie/list.html.twig
This commit is contained in:
mepiphana2023
2024-11-26 15:59:06 +01:00
17 changed files with 326 additions and 159 deletions

2
.env
View File

@@ -15,7 +15,7 @@
# https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration # https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration
###> symfony/framework-bundle ### ###> symfony/framework-bundle ###
APP_ENV=prod APP_ENV=dev
APP_SECRET=ba1ab1eaa1c6662c10564a7a82901198 APP_SECRET=ba1ab1eaa1c6662c10564a7a82901198
###< symfony/framework-bundle ### ###< symfony/framework-bundle ###

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 Version20241125095027 extends AbstractMigration final class Version20241125154648 extends AbstractMigration
{ {
public function getDescription(): string public function getDescription(): string
{ {
@@ -20,12 +20,12 @@ final class Version20241125095027 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 lieu ADD ville VARCHAR(255) NOT NULL, ADD code_postal INT NOT NULL'); $this->addSql('ALTER TABLE sortie ADD motif_annul LONGTEXT DEFAULT NULL');
} }
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 lieu DROP ville, DROP code_postal'); $this->addSql('ALTER TABLE sortie DROP motif_annul');
} }
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 KiB

View File

@@ -38,7 +38,7 @@ class AdminController extends AbstractController
{ {
$token = $tokenStorage->getToken(); $token = $tokenStorage->getToken();
$userConnect = $token?->getUser(); $userConnect = $token?->getUser();
return $this->render('admin/index.html.twig', [ return $this->render('admin/list.html.twig', [
'profile' => $userConnect, 'profile' => $userConnect,
'controller_name' => 'AdminController', 'controller_name' => 'AdminController',
]); ]);

View File

@@ -17,7 +17,7 @@ class LieuController extends AbstractController
#[Route('/lieu', name: 'app_lieu')] #[Route('/lieu', name: 'app_lieu')]
public function index(): Response public function index(): Response
{ {
return $this->render('lieu/index.html.twig', [ return $this->render('lieu/list.html.twig', [
'controller_name' => 'LieuController', 'controller_name' => 'LieuController',
]); ]);
} }

View File

@@ -2,6 +2,7 @@
namespace App\Controller; namespace App\Controller;
use App\Repository\ParticipantRepository;
use App\Repository\SiteRepository; use App\Repository\SiteRepository;
use App\Repository\SortieRepository; use App\Repository\SortieRepository;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
@@ -21,30 +22,32 @@ class MainController extends AbstractController
$token = $tokenStorage->getToken(); $token = $tokenStorage->getToken();
$userConnect = $token?->getUser(); $userConnect = $token?->getUser();
// Récupérer les paramètres de filtre $sorties = $sortieRepository->findForDashboard();
$search = $request->query->get('search', ''); $sortiesParticipation = $sortieRepository->findUserParticipation($userConnect);
$siteId = $request->query->get('site', ''); $sortiesOrganisation = $sortieRepository->findUserOrganisation($userConnect);
$startDate = $request->query->get('start_date', '');
$endDate = $request->query->get('end_date', '');
$organisateur = $request->query->get('organisateur', false);
$inscrit = $request->query->get('inscrit', false);
$nonInscrit = $request->query->get('non_inscrit', false);
$passees = $request->query->get('passees', false);
$sorties = $sortieRepository->findWithFilters($search, $siteId, $startDate, $endDate, $organisateur, $inscrit, $nonInscrit, $passees, $userConnect); return $this->render('main/dashboard.html.twig', [
return $this->render('main/index.html.twig', [
'profile' => $userConnect, 'profile' => $userConnect,
'sorties' => $sorties, 'sorties' => $sorties,
'sites' => $sortieRepository->findAllSites(), 'sortiesParticipation' => $sortiesParticipation,
'sortiesOrganisation' => $sortiesOrganisation,
]); ]);
} }
#[Route('/inscription', name: 'inscription')] #[Route('/inscription', name: 'inscription')]
public function inscription(TokenStorageInterface $tokenStorage): Response public function inscription(TokenStorageInterface $tokenStorage): Response
{ {
return $this->render('main/inscription.html.twig'); return $this->render('main/inscription.html.twig');
} }
#[Route('/participants', name: 'participants')]
public function participants(TokenStorageInterface $tokenStorage, ParticipantRepository $participantRepository): Response
{
$token = $tokenStorage->getToken();
$userConnect = $token?->getUser();
return $this->render('main/participants.html.twig', [
'profile' => $userConnect,
'participants' => $participantRepository->findAll(),
]);
}
} }

View File

@@ -116,6 +116,6 @@ class PasswordResetController extends AbstractController
return $this->redirectToRoute('app_login'); return $this->redirectToRoute('app_login');
} }
return $this->render('password_reset/index.html.twig', ['token' => $token]); return $this->render('password_reset/list.html.twig', ['token' => $token]);
} }
} }

View File

@@ -8,6 +8,7 @@ use App\Form\SortieType;
use App\Repository\EtatRepository; use App\Repository\EtatRepository;
use App\Repository\LieuRepository; use App\Repository\LieuRepository;
use App\Repository\ParticipantRepository; use App\Repository\ParticipantRepository;
use App\Repository\SortieRepository;
use DateTime; use DateTime;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
@@ -19,6 +20,34 @@ use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInt
#[Route('/sortie', name: 'sortie_')] #[Route('/sortie', name: 'sortie_')]
class SortieController extends AbstractController class SortieController extends AbstractController
{ {
#[Route('/liste', name: 'list', methods: ['GET'])]
public function index(
TokenStorageInterface $tokenStorage,
SortieRepository $sortieRepository,
Request $request
): Response {
$token = $tokenStorage->getToken();
$userConnect = $token?->getUser();
// Récupérer les paramètres de filtre
$search = $request->query->get('search', '');
$siteId = $request->query->get('site', '');
$startDate = $request->query->get('start_date', '');
$endDate = $request->query->get('end_date', '');
$organisateur = $request->query->get('organisateur', false);
$inscrit = $request->query->get('inscrit', false);
$nonInscrit = $request->query->get('non_inscrit', false);
$passees = $request->query->get('passees', false);
$sorties = $sortieRepository->findWithFilters($search, $siteId, $startDate, $endDate, $organisateur, $inscrit, $nonInscrit, $passees, $userConnect);
return $this->render('sortie/list.html.twig', [
'profile' => $userConnect,
'sorties' => $sorties,
'sites' => $sortieRepository->findAllSites(),
]);
}
#[Route('/creates', name: 'create', methods: ['GET', 'POST'])] #[Route('/creates', name: 'create', methods: ['GET', 'POST'])]
public function create( public function create(
Request $request, Request $request,
@@ -90,6 +119,10 @@ class SortieController extends AbstractController
$this->addFlash('error', 'Cette sortie n\'existe pas.'); $this->addFlash('error', 'Cette sortie n\'existe pas.');
return $this->redirectToRoute('home'); 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', [ return $this->render('sortie/view.html.twig', [
'sortie' => $sortie, 'sortie' => $sortie,

View File

@@ -17,59 +17,45 @@ class SortieRepository extends ServiceEntityRepository
parent::__construct($registry, Sortie::class); parent::__construct($registry, Sortie::class);
} }
public function findWithFilters($search, $siteId, $startDate, $endDate, $organisateur, $inscrit, $nonInscrit, $passees, $userConnect) public function findWithFilters($search, $siteId, $startDate, $endDate, $organisateur, $inscrit, $nonInscrit, $passees, $user)
{ {
$qb = $this->createQueryBuilder('s') $qb = $this->createQueryBuilder('s');
->leftJoin('s.etat', 'e')
->addSelect('e')
->leftJoin('s.participants', 'p')
->addSelect('p')
->where('e.libelle != :annulee')
->setParameter('annulee', 'Annulée');
// Filtre par nom if ($search) {
if (!empty($search)) {
$qb->andWhere('s.nom LIKE :search') $qb->andWhere('s.nom LIKE :search')
->setParameter('search', '%' . $search . '%'); ->setParameter('search', '%' . $search . '%');
} }
// Filtre par site if ($siteId) {
if (!empty($siteId)) {
$qb->andWhere('s.site = :siteId') $qb->andWhere('s.site = :siteId')
->setParameter('siteId', $siteId); ->setParameter('siteId', $siteId);
} }
// Filtre par date de début if ($startDate) {
if (!empty($startDate)) {
$qb->andWhere('s.dateHeureDebut >= :startDate') $qb->andWhere('s.dateHeureDebut >= :startDate')
->setParameter('startDate', $startDate); ->setParameter('startDate', new \DateTime($startDate));
} }
// Filtre par date de fin if ($endDate) {
if (!empty($endDate)) {
$qb->andWhere('s.dateHeureDebut <= :endDate') $qb->andWhere('s.dateHeureDebut <= :endDate')
->setParameter('endDate', $endDate); ->setParameter('endDate', new \DateTime($endDate));
} }
// Filtre par organisateur if ($organisateur) {
if ($organisateur && $userConnect) { $qb->andWhere('s.organisateur = :user')
$qb->andWhere('s.organisateur = :organisateur') ->setParameter('user', $user);
->setParameter('organisateur', $userConnect);
} }
// Filtre par inscription if ($inscrit) {
if ($inscrit && $userConnect) { $qb->andWhere(':user MEMBER OF s.participants')
$qb->andWhere(':userConnect MEMBER OF s.participants') ->setParameter('user', $user);
->setParameter('userConnect', $userConnect);
} }
// Filtre par non-inscription if ($nonInscrit) {
if ($nonInscrit && $userConnect) { $qb->andWhere(':user NOT MEMBER OF s.participants')
$qb->andWhere(':userConnect NOT MEMBER OF s.participants') ->setParameter('user', $user);
->setParameter('userConnect', $userConnect);
} }
// Filtre par sorties passées
if ($passees) { if ($passees) {
$qb->andWhere('s.dateHeureDebut < :now') $qb->andWhere('s.dateHeureDebut < :now')
->setParameter('now', new \DateTime()); ->setParameter('now', new \DateTime());
@@ -81,7 +67,6 @@ class SortieRepository extends ServiceEntityRepository
return $qb->getQuery()->getResult(); return $qb->getQuery()->getResult();
} }
public function findAllSites() public function findAllSites()
{ {
return $this->getEntityManager() return $this->getEntityManager()

View File

@@ -11,24 +11,7 @@
<h1 class="text-2xl font-semibold mb-4">Gestion des utilisateurs</h1> <h1 class="text-2xl font-semibold mb-4">Gestion des utilisateurs</h1>
<!-- Actions: Import/Export --> <!-- Actions: Import/Export -->
<div class="flex flex-row items-center mb-4"> <div class="flex flex-row mb-4 justify-between">
<form action="{{ path('participant_import') }}" method="post" enctype="multipart/form-data" class="flex items-center">
<button
type="submit"
class="bg-green-500 text-white mr-4 px-4 py-2 rounded hover:bg-green-600">
Importer CSV
</button>
<input
type="file"
name="csv_file"
accept=".csv"
class="block w-full text-sm text-gray-500
file:mr-4 file:py-2 file:px-4
file:rounded file:border-0
file:text-sm file:font-semibold
file:bg-gray-800 file:text-white
hover:file:bg-gray-700" />
</form>
<button <button
id="openModal" id="openModal"
class="bg-green-600 text-white px-4 py-2 rounded hover:bg-green-700 items-end justify-end"> class="bg-green-600 text-white px-4 py-2 rounded hover:bg-green-700 items-end justify-end">
@@ -38,9 +21,16 @@
<!-- Participants Table --> <!-- Participants Table -->
<form method="POST" action="{{ path('participant_export') }}"> <form method="POST" action="{{ path('participant_export') }}">
<div class="flex flex-row">
<button
id="openModalCsv" type="button"
class="bg-green-500 text-white mb-4 mr-4 px-4 py-2 rounded hover:bg-green-600">
Importer CSV
</button>
<button type="submit" class="bg-blue-500 text-white px-4 py-2 mb-4 rounded hover:bg-blue-600"> <button type="submit" class="bg-blue-500 text-white px-4 py-2 mb-4 rounded hover:bg-blue-600">
<a href="{{ path('participant_export') }}">Exporter CSV</a> <a href="{{ path('participant_export') }}">Exporter CSV</a>
</button> </button>
</div>
<div class="overflow-x-auto bg-white rounded shadow"> <div class="overflow-x-auto bg-white rounded shadow">
<table class="min-w-full bg-white divide-y divide-gray-200"> <table class="min-w-full bg-white divide-y divide-gray-200">
<thead class="bg-gray-50"> <thead class="bg-gray-50">
@@ -195,6 +185,36 @@
</div> </div>
</div> </div>
<div id="modalCsv" class="fixed inset-0 z-50 hidden bg-gray-900 bg-opacity-50">
<div class="flex justify-center items-center min-h-screen">
<div class="bg-white p-6 rounded shadow-md w-1/3">
<h2 class="text-xl font-semibold mb-4">Importer un CSV</h2>
<form id="addCSVForm" method="post" enctype="multipart/form-data" class="flex flex-col items-center" action="{{ path('participant_import') }}">
<div class="mb-4">
<input
type="file"
name="csv_file"
accept=".csv"
class="block w-full text-sm text-gray-500
file:mr-4 file:py-2 file:px-4
file:rounded file:border-0
file:text-sm file:font-semibold
file:bg-gray-800 file:text-white
hover:file:bg-gray-700" />
</div>
<div class="flex flex-row">
<button
type="submit"
class="bg-green-500 text-white mr-4 px-4 py-2 rounded hover:bg-green-600">
Importer CSV
</button>
<button type="button" id="closeModalCsv" class="ml-2 bg-gray-500 text-white px-4 py-2 rounded hover:bg-gray-700">Annuler</button>
</div>
</form>
</div>
</div>
</div>
{# Modale import CSV#} {# Modale import CSV#}
<script> <script>
@@ -209,6 +229,16 @@
}); });
</script> </script>
<script>
document.getElementById('openModalCsv').addEventListener('click', function() {
document.getElementById('modalCsv').classList.remove('hidden')
})
document.getElementById('closeModalCsv').addEventListener('click', function() {
document.getElementById('modalCsv').classList.add('hidden')
})
</script>
<script> <script>
document.addEventListener('DOMContentLoaded', function () { document.addEventListener('DOMContentLoaded', function () {
const selectAllCheckbox = document.getElementById('selectAll'); const selectAllCheckbox = document.getElementById('selectAll');

View File

@@ -0,0 +1,135 @@
{% extends 'main/base.html.twig' %}
{% block head %}
<head>
<meta charset="UTF-8">
{% block title %}&#128227; Sortie.com {{ profile.pseudo }} &#128266;{% endblock %}
{% block stylesheets %}
{{ encore_entry_link_tags('app') }}
{% endblock %}
</head>
{% endblock %}
{% block content %}
<h3 class="text-center text-base mb-8 mt-4 font-bold uppercase">Bonjour, {{ profile.nom }} {{ profile.prenom }}</h3>
{# Tableau des sorties globales#}
<div class="flex flex-col bg-white shadow-lg rounded-lg mx-8 mb-10">
<h4 class="text-start bg-gray-50 items-start justify-start text-base p-2 font-bold uppercase">Les sorties en cours</h4>
<table class="min-w-full bg-white divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Nom</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Etat</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Adresse</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Date début</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Durée</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Date limite inscription</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Action</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-200">
{% for sortie in sorties %}
<tr>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{{ sortie.nom }}</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{{ sortie.etat.libelle }}</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">
{{ sortie.lieu ? (sortie.lieu.ville ?: '') ~ ' ' ~ (sortie.lieu.codePostal ?: '') ~ ', ' ~ (sortie.lieu.rue ?: '') : '' }}
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{{ sortie.dateHeureDebut|date('d/m/Y H:i') }}</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{{ sortie.duree }}</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{{ sortie.dateLimiteInscription|date('d/m/Y H:i') }}</td>
<td class="flex flex-row px-6 py-4 whitespace-nowrap text-base text-gray-900">
{% if not sortie.participants.contains(app.user) and sortie.etat.libelle == 'Ouverte' %}
<form action="{{ path('sortie_inscription', { id: sortie.idSortie }) }}" method="post">
<button type="submit">🔔</button>
</form>
{% elseif sortie.participants.contains(app.user) and sortie.etat.libelle == 'Ouverte' %}
<form method="post" action="{{ path('sortie_unsubscribe', { id: sortie.idSortie }) }}">
<button type="submit">🔕</button>
</form>
{% endif %}
<form method="post" action="{{ path('sortie_view', { id: sortie.idSortie }) }}">
<button type="submit">👁️</button>
</form>
</td>
</tr>
{% else %}
<tr>
<td colspan="8" class="px-6 py-4 text-center text-gray-500">Aucune participant trouvé</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<div class="flex flex-row flex-wrap mx-8">
{# Tableau des sorties dont je suis participant#}
<div class="w-1/2 p-4 shadow-lg rounded-lg">
<h4 class="text-start bg-gray-50 items-start justify-start text-base p-2 font-bold uppercase">Mes participations</h4>
<table class="min-w-full bg-white divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Nom</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Adresse</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Date début</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Durée</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Action</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-200">
{% for sortie in sortiesParticipation %}
<tr>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{{ sortie.nom }}</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">
{{ sortie.lieu ? (sortie.lieu.ville ?: '') ~ ' ' ~ (sortie.lieu.codePostal ?: '') ~ ', ' ~ (sortie.lieu.rue ?: '') : '' }}
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{{ sortie.dateHeureDebut|date('d/m/Y H:i') }}</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{{ sortie.duree }}</td>
<td class="flex flex-row px-6 py-4 whitespace-nowrap text-base text-gray-900">
<a href={{ path('sortie_view', { id: sortie.idSortie }) }}>👁️</a>
</td>
</tr>
{% else %}
<tr>
<td colspan="8" class="px-6 py-4 text-center text-gray-500">Vous ne participez à aucune sortie</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{# Tableau des sorties dont je suis organisateur #}
<div class="w-1/2 p-4 shadow-lg rounded-lg">
<h4 class="text-start bg-gray-50 items-start justify-start text-base p-2 font-bold uppercase">Mes organisations</h4>
<table class="min-w-full bg-white divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Nom</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Adresse</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Date début</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Durée</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Action</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-200">
{% for sortie in sortiesOrganisation %}
<tr>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{{ sortie.nom }}</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">
{{ sortie.lieu ? (sortie.lieu.ville ?: '') ~ ' ' ~ (sortie.lieu.codePostal ?: '') ~ ', ' ~ (sortie.lieu.rue ?: '') : '' }}
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{{ sortie.dateHeureDebut|date('d/m/Y H:i') }}</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{{ sortie.duree }}</td>
<td class="flex flex-row px-6 py-4 whitespace-nowrap text-base text-gray-900">
<a href={{ path('sortie_view', { id: sortie.idSortie }) }}>👁️</a>
</td>
</tr>
{% else %}
<tr>
<td colspan="8" class="px-6 py-4 text-center text-gray-500">Vous n'organisez aucune sortie</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% endblock %}

View File

@@ -1,4 +1,4 @@
<footer class="w-full bg-green-700 text-white py-4"> <footer class="w-full text-white py-4">
<div class="flex justify-center"> <div class="flex justify-center">
ENI &copy; Sortie {{ "now"|date("Y") }} ENI &copy; Sortie {{ "now"|date("Y") }}
</div> </div>

View File

@@ -31,8 +31,10 @@
</button> </button>
{% endif %} {% endif %}
<ul id="navbar" class="hidden absolute top-20 right-0 w-max bg-white shadow-md p-4 pl-2 flex-col space-y-4"> <ul id="navbar" class="hidden absolute top-20 right-0 w-max bg-white shadow-md p-4 pl-2 flex-col space-y-4">
<li><a href="{{ path('home') }}" class="text-gray-700 font-bold hover:text-blue-500">Accueil</a></li>
{% if app.user %} {% if app.user %}
<li><a href="{{ path('home') }}" class="text-gray-700 font-bold hover:text-blue-500">Accueil</a></li>
<li><a href="{{ path('sortie_list') }}" class="text-gray-700 font-bold hover:text-blue-500">Liste des sorties</a></li>
<li><a href="{{ path('participants') }}" class="text-gray-700 font-bold hover:text-blue-500">Participants</a></li>
<li><a href="{{ path('profile_view', {'uuid': app.user.idParticipant}) }}" class="text-gray-700 font-bold hover:text-blue-500">Mon profile</a></li> <li><a href="{{ path('profile_view', {'uuid': app.user.idParticipant}) }}" class="text-gray-700 font-bold hover:text-blue-500">Mon profile</a></li>
{% endif %} {% endif %}
{% if app.user and ('ROLE_ADMIN' in app.user.roles) %} {% if app.user and ('ROLE_ADMIN' in app.user.roles) %}

View File

@@ -0,0 +1,44 @@
{% extends 'main/base.html.twig' %}
{% block head %}
<head>
<meta charset="UTF-8">
<title>Liste des participants</title>
{% block stylesheets %}
{{ encore_entry_link_tags('app') }}
{% endblock %}
</head>
{% endblock %}
{% block content %}
<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 participants inscrit sur le site</h1>
<div class="overflow-x-auto bg-white rounded shadow">
<table class="min-w-full bg-white divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">PP</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Pseudo</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-200">
{% for participant in participants %}
<tr>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">
<img src="{{ participant.fileName ? asset('upload/image/profile/' ~ participant.fileName) : asset('upload/image/profile/default.png') }}" class="w-16 h-16 rounded-full mr-4" />
</td>
</tr>
<tr>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{{ participant.pseudo }}</td>
</tr>
{% else %}
<tr>
<td colspan="8" class="px-6 py-4 text-center text-gray-500">Aucun participant</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% endblock %}

View File

@@ -24,9 +24,11 @@
<div class="text-sm mt-0 mb-2 text-slate-400 font-bold uppercase"> <div class="text-sm mt-0 mb-2 text-slate-400 font-bold uppercase">
<i class="fas fa-map-marker-alt mr-2 text-slate-400 opacity-75"></i>{{ profile.pseudo }} <i class="fas fa-map-marker-alt mr-2 text-slate-400 opacity-75"></i>{{ profile.pseudo }}
</div> </div>
{% if isActiveUser %}
<div class="text-xs mt-0 mb-2 text-slate-400 font-bold uppercase"> <div class="text-xs mt-0 mb-2 text-slate-400 font-bold uppercase">
<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>
{% endif %}
</div> </div>
{% if isActiveUser %} {% 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">

View File

@@ -5,46 +5,16 @@
<title>Liste des sorties</title> <title>Liste des sorties</title>
{% block stylesheets %} {% block stylesheets %}
{{ encore_entry_link_tags('app') }} {{ encore_entry_link_tags('app') }}
<style>
.pin-creee {
background-color: #4CAF50;
}
.pin-ouverte {
background-color: #2196F3;
}
.pin-archivee {
background-color: #FF9800;
}
.pin-en-cours {
background-color: #FFC107;
}
.pin-terminee {
background-color: #9E9E9E;
}
.pin-annulee {
background-color: #f44336;
}
.pin-default {
background-color: #E0E0E0;
}
.pin {
display: inline-block;
width: 12px;
height: 12px;
border-radius: 50%;
margin-right: 8px;
}
</style>
{% endblock %} {% endblock %}
</head> </head>
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<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-6 bg-gray-50 rounded-lg shadow-lg 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-3xl font-bold text-center text-gray-800 mb-8">🎉 Liste des sorties</h1>
<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 sm:grid-cols-2 lg:grid-cols-4 gap-4 sm:gap-6"> <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 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>
<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', '') }}"
@@ -77,7 +47,7 @@
</div> </div>
</div> </div>
<div class="mt-4 grid grid-cols-1 sm: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"
{% if app.request.query.get('organisateur') %}checked{% endif %} {% if app.request.query.get('organisateur') %}checked{% endif %}
@@ -114,35 +84,16 @@
</div> </div>
</form> </form>
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4 sm: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" class="hidden sm:block"> <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">
<img src="/img/add.svg" alt="Créer une sortie" class="w-24 h-24 mx-auto mb-4"> <img src="/img/add.svg" alt="Créer une sortie" class="w-40 h-40 mx-auto mb-4">
<h2 class="text-lg font-semibold">Créer une sortie</h2> <h2 class="text-lg font-semibold">Créer une sortie</h2>
</div> </div>
</a> </a>
{% for sortie in sorties %} {% for sortie in sorties %}
<div class="bg-white rounded-lg shadow-md p-4"> <div class="bg-white rounded-lg shadow-md p-4">
<div class="flex items-center mb-2">
<div class="pin
{% if sortie.etat.libelle == 'Créée' %}
pin-creee
{% elseif sortie.etat.libelle == 'Ouverte' %}
pin-ouverte
{% elseif sortie.etat.libelle == 'Archivée' %}
pin-archivee
{% elseif sortie.etat.libelle == 'En cours' %}
pin-en-cours
{% elseif sortie.etat.libelle == 'Terminée' %}
pin-terminee
{% elseif sortie.etat.libelle == 'Annulée' %}
pin-annulee
{% else %}
pin-default
{% endif %}
"></div>
<h2 class="text-lg font-semibold text-gray-800">{{ sortie.nom }}</h2> <h2 class="text-lg font-semibold text-gray-800">{{ sortie.nom }}</h2>
</div>
<p class="mt-2 text-gray-600"> <p class="mt-2 text-gray-600">
<strong>Date de début :</strong> {{ sortie.dateHeureDebut|date('d/m/Y H:i') }}<br> <strong>Date de début :</strong> {{ sortie.dateHeureDebut|date('d/m/Y H:i') }}<br>
<strong>Durée :</strong> {{ sortie.duree }} minutes<br> <strong>Durée :</strong> {{ sortie.duree }} minutes<br>
@@ -154,30 +105,8 @@
</div> </div>
</div> </div>
{% else %} {% else %}
<p class="text-gray-600 text-center col-span-4">Aucune sortie ne correspond à vos critères.</p> <p class="text-gray-600 text-center col-span-6">Aucune sortie ne correspond à vos critères.</p>
{% endfor %} {% endfor %}
</div> </div>
</div> </div>
{% block javascripts %}
{{ encore_entry_script_tags('app') }}
<script>
document.addEventListener('DOMContentLoaded', () => {
const inscritCheckbox = document.getElementById('inscrit');
const nonInscritCheckbox = document.getElementById('non_inscrit');
inscritCheckbox.addEventListener('change', () => {
if (inscritCheckbox.checked) {
nonInscritCheckbox.checked = false;
}
});
nonInscritCheckbox.addEventListener('change', () => {
if (nonInscritCheckbox.checked) {
inscritCheckbox.checked = false;
}
});
});
</script>
{% endblock %}
{% endblock %} {% endblock %}

View File

@@ -62,7 +62,11 @@
{% if sortie.participants is not empty %} {% if sortie.participants is not empty %}
<ul class="list-disc pl-6 text-gray-800 mt-2"> <ul class="list-disc pl-6 text-gray-800 mt-2">
{% for participant in sortie.participants %} {% for participant in sortie.participants %}
<li>{{ participant.nom }} {{ participant.prenom }}</li> <li>
<a href="{{ path('profile_view', {'uuid': participant.idParticipant}) }}">
{{ participant.nom }} {{ participant.prenom }}
</a>
</li>
{% endfor %} {% endfor %}
</ul> </ul>
{% else %} {% else %}
@@ -112,7 +116,7 @@
<li><strong>🏢 Nom :</strong> {{ sortie.lieu.nom }}</li> <li><strong>🏢 Nom :</strong> {{ sortie.lieu.nom }}</li>
<li><strong>📍 Rue :</strong> {{ sortie.lieu.rue }}</li> <li><strong>📍 Rue :</strong> {{ sortie.lieu.rue }}</li>
<li><strong>🏙️ Ville :</strong> {{ sortie.lieu.ville }}</li> <li><strong>🏙️ Ville :</strong> {{ sortie.lieu.ville }}</li>
<li><strong>✉️ Code postal :</strong> {{ sortie.lieu.ville }}</li> <li><strong>✉️ Code postal :</strong> {{ sortie.lieu.codePostal }}</li>
<li><strong>🌍 Latitude :</strong> {{ sortie.lieu.latitude }}</li> <li><strong>🌍 Latitude :</strong> {{ sortie.lieu.latitude }}</li>
<li><strong>🌍 Longitude :</strong> {{ sortie.lieu.longitude }}</li> <li><strong>🌍 Longitude :</strong> {{ sortie.lieu.longitude }}</li>
</ul> </ul>