des trucs
BIN
public/img/default-placeholder.png
Normal file
|
After Width: | Height: | Size: 6.5 KiB |
BIN
public/img/sortie/67486f16d749f714047616.jpg
Normal file
|
After Width: | Height: | Size: 8.6 KiB |
BIN
public/img/sortie/6748776b50dd7956593274.jpg
Normal file
|
After Width: | Height: | Size: 8.6 KiB |
BIN
public/img/sortie/674877c384db5339345332.jpg
Normal file
|
After Width: | Height: | Size: 8.6 KiB |
BIN
public/img/sortie/67487aa8a2f87536902687.jpg
Normal file
|
After Width: | Height: | Size: 3.0 KiB |
BIN
public/upload/image/profile/telechargement-67487571ad685.jpg
Normal file
|
After Width: | Height: | Size: 3.0 KiB |
BIN
public/upload/image/profile/telechargement-674875c34500d.jpg
Normal file
|
After Width: | Height: | Size: 3.0 KiB |
BIN
public/upload/image/profile/telechargement-674875ed7e500.jpg
Normal file
|
After Width: | Height: | Size: 3.0 KiB |
@@ -9,6 +9,7 @@ use App\Repository\EtatRepository;
|
||||
use App\Repository\LieuRepository;
|
||||
use App\Repository\ParticipantRepository;
|
||||
use App\Repository\SortieRepository;
|
||||
use App\Service\FileUploader;
|
||||
use DateTime;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use OpenAI\Factory;
|
||||
@@ -25,9 +26,13 @@ class SortieController extends AbstractController
|
||||
{
|
||||
#[Route('/sortie/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', '');
|
||||
@@ -42,6 +47,7 @@ class SortieController extends AbstractController
|
||||
$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(),
|
||||
]);
|
||||
@@ -231,10 +237,19 @@ class SortieController extends AbstractController
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
// Vérification et mise à jour du lieu
|
||||
$lieu = $form->get('lieu')->getData();
|
||||
if ($lieu) {
|
||||
$sortie->setLieu($lieu);
|
||||
}
|
||||
|
||||
// Gestion du fichier image
|
||||
$imageFile = $form->get('imageFile')->getData();
|
||||
if ($imageFile) {
|
||||
$sortie->setImageFile($imageFile);
|
||||
}
|
||||
|
||||
// Sauvegarde des modifications
|
||||
$entityManager->flush();
|
||||
|
||||
$this->addFlash('success', 'Les modifications ont été enregistrées.');
|
||||
|
||||
@@ -70,6 +70,22 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="sortie_imageFile">Image de la sortie</label>
|
||||
{{ form_widget(form.imageFile, { 'attr': { 'class': 'block w-full p-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500', 'onchange': 'previewImage(event)' } }) }}
|
||||
<small class="text-gray-500">Formats acceptés : JPG, PNG (max. 5 Mo).</small>
|
||||
|
||||
{% if sortie and sortie.image %}
|
||||
<div class="mt-4">
|
||||
<img id="image-preview" src="{{ asset('img/sortie/' ~ sortie.image) }}" alt="Image prévisualisée" class="max-w-xs h-auto rounded-lg border border-gray-300">
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="mt-4">
|
||||
<img id="image-preview" src="" alt="Aucune image sélectionnée" class="max-w-xs h-auto rounded-lg border border-gray-300 hidden">
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="flex justify-end mt-8 space-x-4">
|
||||
<a href="{{ path('sortie_view', { id: sortie.getIdSortie() }) }}" class="btnAnnule">
|
||||
❌ Annuler
|
||||
@@ -81,4 +97,24 @@
|
||||
|
||||
{{ form_end(form) }}
|
||||
</div>
|
||||
{% block javascripts %}
|
||||
<script>
|
||||
function previewImage(event) {
|
||||
const input = event.target;
|
||||
const preview = document.getElementById('image-preview');
|
||||
|
||||
if (input.files && input.files[0]) {
|
||||
const reader = new FileReader();
|
||||
reader.onload = function (e) {
|
||||
preview.src = e.target.result;
|
||||
preview.classList.remove('hidden');
|
||||
};
|
||||
reader.readAsDataURL(input.files[0]);
|
||||
} else {
|
||||
preview.src = '';
|
||||
preview.classList.add('hidden');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
@@ -77,6 +77,7 @@
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
|
||||
{% if app.user and sortie.etat.libelle == 'Ouverte' and not sortie.participants.contains(app.user) and date(sortie.dateLimiteInscription) > date() %}
|
||||
<form action="{{ path('sortie_inscription', { id: sortie.idSortie }) }}" method="post" class="mt-6">
|
||||
<button type="submit" class="btnPrimary">
|
||||
|
||||