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

View File

@@ -11,24 +11,7 @@
<h1 class="text-2xl font-semibold mb-4">Gestion des utilisateurs</h1>
<!-- Actions: Import/Export -->
<div class="flex flex-row items-center mb-4">
<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>
<div class="flex flex-row mb-4 justify-between">
<button
id="openModal"
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 -->
<form method="POST" action="{{ path('participant_export') }}">
<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>
</button>
<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">
<a href="{{ path('participant_export') }}">Exporter CSV</a>
</button>
</div>
<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">
@@ -195,6 +185,36 @@
</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#}
<script>
@@ -209,6 +229,16 @@
});
</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>
document.addEventListener('DOMContentLoaded', function () {
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">
ENI &copy; Sortie {{ "now"|date("Y") }}
</div>

View File

@@ -31,8 +31,10 @@
</button>
{% 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">
<li><a href="{{ path('home') }}" class="text-gray-700 font-bold hover:text-blue-500">Accueil</a></li>
{% 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>
{% endif %}
{% 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">
<i class="fas fa-map-marker-alt mr-2 text-slate-400 opacity-75"></i>{{ profile.pseudo }}
</div>
{% if isActiveUser %}
<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 }}
</div>
{% endif %}
</div>
{% if isActiveUser %}
<div class="mt-6 py-6 border-t border-slate-200 text-center">

View File

@@ -5,46 +5,16 @@
<title>Liste des sorties</title>
{% block stylesheets %}
{{ 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 %}
</head>
{% endblock %}
{% block content %}
<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>
<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>
<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>
<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', '') }}"
@@ -77,7 +47,7 @@
</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">
<input type="checkbox" name="organisateur" id="organisateur" value="1"
{% if app.request.query.get('organisateur') %}checked{% endif %}
@@ -114,35 +84,16 @@
</div>
</form>
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4 sm:gap-6">
<a href="/sortie/creates" class="hidden sm:block">
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-6 gap-6">
<a href="/sortie/creates">
<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>
</div>
</a>
{% for sortie in sorties %}
<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>
</div>
<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>
@@ -154,30 +105,8 @@
</div>
</div>
{% 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 %}
</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 %}

View File

@@ -62,7 +62,11 @@
{% if sortie.participants is not empty %}
<ul class="list-disc pl-6 text-gray-800 mt-2">
{% 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 %}
</ul>
{% else %}
@@ -112,7 +116,7 @@
<li><strong>🏢 Nom :</strong> {{ sortie.lieu.nom }}</li>
<li><strong>📍 Rue :</strong> {{ sortie.lieu.rue }}</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>🌍 Longitude :</strong> {{ sortie.lieu.longitude }}</li>
</ul>