set front

This commit is contained in:
jleroy2023
2024-11-18 14:41:52 +01:00
parent 9bdde39dde
commit 8f75b8a125
30 changed files with 2650 additions and 18 deletions

View File

@@ -0,0 +1,90 @@
<div class="transition-all duration-150 flex px-4 py-6 w-80 ">
<div class="flex flex-col items-stretch min-h-full min-w-full pb-4 mb-6 transition-all duration-150 rounded-lg shadow-xl hover:shadow-2xl overflow-hidden bg-light-card dark:bg-dark-card">
<div class="md:flex-shrink-0">
<img src="{{ outing.getPoster() ? asset('uploads/' ~ outing.getPoster()) | imagine_filter('outings') : asset('placeholder.png') | imagine_filter('outings') }}" alt="" class="object-cover w-full rounded-lg rounded-b-none md:h-56"/>
</div>
<div class="flex items-center justify-between px-4 py-2 overflow-hidden">
<div>
{% if outing.status.label == 'Annulée' %}
<span class="text-xs font-medium text-light-danger dark:text-dark-danger uppercase">
Sortie annulée
</span>
{% elseif outing.organizer == app.user %}
<span class="text-xs font-medium text-light-success dark:text-dark-success uppercase">
Je suis l'organisateur
</span>
{% elseif outing.isUserRegistered(app.user) %}
<span class="text-xs font-medium text-light-success dark:text-dark-success uppercase">
Je suis inscrit
</span>
{% elseif outing.canRegister() %}
<span class="text-xs font-medium text-light-info dark:text-dark-success uppercase">
Inscriptions ouvertes
</span>
{% elseif outing.registrations.count == outing.registrationsMax %}
<span class="text-xs font-medium text-light-danger dark:text-dark-danger uppercase">
Sortie complète
</span>
{% elseif outing.status.label == 'Activité en cours'%}
<span class="text-xs font-medium text-light-warning dark:text-dark-warning uppercase">
Activité en cours
</span>
{% elseif outing.status.label == 'Passée' or outing.startDate|date("Y-m-d H:i:s") > "now"|date("Y-m-d H:i:s") %}
<span class="text-xs font-medium text-light-warning dark:text-dark-warning uppercase">
Sortie passée
</span>
{% else %}
<span class="text-xs font-medium text-light-danger dark:text-dark-danger uppercase">
Inscriptions fermées
</span>
{% endif %}
{% if outing.canRegister() %}
<div class="flex flex-row items-center text-light-primary dark:text-dark-primary">
<span class="text-xs font-medium uppercase">
Inscription : {{ outing.registrations.count }}/{{ outing.registrationsMax }}
</span>
</div>
{% endif %}
</div>
<div class="flex items-center">
<span class="text-xs font-medium text-light-primary dark:text-light-font uppercase">
{{ outing.startDate|date("d/m/Y") }} à {{ outing.startDate|date("H:i") }}
</span>
</div>
</div>
<hr class="border-light-primary dark:border-dark-primary"/>
<div class="flex flex-wrap items-center flex-1 px-4 py-1 text-center mx-auto overflow-hidden">
<a href="{{ path('outing_preview', {'id': outing.id}) }}" class="hover:underline">
<h2 class="text-2xl font-bold tracking-normal text-light-primary dark:text-dark-primary line-clamp-3 truncate">
{{ outing.title }}
</h2>
</a>
</div>
<hr class="border-light-primary dark:border-dark-primary"/>
<p class="line-clamp-3 w-full px-4 my-2 overflow-hidden text-sm text-justify text-light-primary dark:text-light-font">
{{ outing.description }}
</p>
<hr class="border-light-primary dark:border-dark-primary"/>
<section class="px-4 py-2 mt-2">
<div class="flex items-center justify-between">
<div class="flex items-center flex-1 overflow-hidden">
<a href="{{ path('user_show', {'pseudo':outing.organizer.pseudo}) }}" class="w-10 h-10 min-w-fit">
<img
class="object-cover rounded-full min-w-full min-h-full w-10 h-10"
src="{{ outing.organizer.getProfilePicture() ? asset('uploads/' ~ outing.organizer.getProfilePicture()) | imagine_filter('profile_navbar') : asset('profilDefault.png') | imagine_filter('profile_navbar') }}"
alt="Avatar"
/>
</a>
<div class="flex flex-col mx-2 overflow-hidden">
<a href="{{ path('user_show', {'pseudo':outing.organizer.pseudo}) }}" class="font-semibold text-light-primary dark:text-light-font hover:underline truncate" title="{{ outing.organizer.pseudo }} ({{ outing.organizer.site.name }})">
{{ outing.organizer.pseudo }}
</a>
</div>
</div>
<a href="{{ path('outing_preview', {'id':outing.id}) }}" class="font-medium text-light-primary dark:text-dark-primary hover:underline">En savoir
plus</a>
</div>
</section>
</div>
</div>

View File

@@ -0,0 +1,273 @@
{% extends 'base.html.twig' %}
{% set isModif = outing is defined and outing.id is not null %}
{% block title %}{% if isModif %}Modifier la sortie "{{ outing.title }}"{% else %}Créer une sortie{% endif %} | {{ parent() }}{% endblock %}
{% block body %}
<section class="p-5">
<h1 class="font-semibold text-3xl my-5 text-center align-items-center light:text-light-primary dark:text-light-font">Créer une sortie</h1>
{{ form_start(form) }}
<div class="py-8 p-5 dark:bg-dark-card bg-light-card rounded-lg lg:w-2/3 mx-auto shadow-md">
<div class="relative mb-5">
{{ form_widget(form.title, {
'attr': {
'class': 'block rounded-lg px-2.5 pb-2.5 pt-5 w-full text-sm dark:bg-dark-font dark:text-white dark:border-dark-primary focus:ring-light-primary dark:focus:ring-dark-primary focus:border-light-primary dark:focus:border-dark-primary dark:placeholder-gray-300 peer',
'id': 'title',
'placeholder': ''
}
}) }}
{{ form_label(form.title, 'Nom de la sortie', {
'label_attr': {
'class': 'absolute text-sm text-light-primary dark:text-gray-300 duration-300 transform -translate-y-4 scale-75 top-4 z-10 origin-[0] start-2.5 peer-focus:text-light-primary dark:peer-focus:text-dark-primary peer-placeholder-shown:scale-100 peer-placeholder-shown:translate-y-0 peer-focus:scale-75 peer-focus:-translate-y-4 rtl:peer-focus:translate-x-1/4 rtl:peer-focus:left-auto'
}
}) }}
</div>
<div class="grid gap-6 mb-6 md:grid-cols-2">
<div class="relative">
<input type="text" id="school"
class="block rounded-lg px-2.5 pb-2.5 pt-5 w-full text-sm dark:bg-dark-font dark:text-white dark:border-dark-primary focus:ring-light-primary dark:focus:ring-dark-primary focus:border-light-primary dark:focus:border-dark-primary dark:placeholder-gray-300 peer"
placeholder="" readonly value="{{ app.user.site.name }}"/>
<label for="school"
class="absolute text-sm text-light-primary dark:text-gray-300 duration-300 transform -translate-y-4 scale-75 top-4 z-10 origin-[0] start-2.5 peer-focus:text-light-primary dark:peer-focus:text-dark-primary peer-placeholder-shown:scale-100 peer-placeholder-shown:translate-y-0 peer-focus:scale-75 peer-focus:-translate-y-4 rtl:peer-focus:translate-x-1/4 rtl:peer-focus:left-auto">Campus d'accueil</label>
</div>
<div class="relative">
{{ form_widget(form.startDate, {
'attr': {
'class': 'block rounded-lg px-2.5 pb-2.5 pt-5 w-full text-sm dark:bg-dark-font dark:text-white dark:border-dark-primary focus:ring-light-primary dark:focus:ring-dark-primary focus:border-light-primary dark:focus:border-dark-primary dark:placeholder-gray-300 peer',
'id': 'startDate',
'placeholder': ''
}
}) }}
{{ form_label(form.startDate, 'Date et heure de la sortie', {
'label_attr': {
'class': 'absolute text-sm text-light-primary dark:text-gray-300 duration-300 transform -translate-y-4 scale-75 top-4 z-10 origin-[0] start-2.5 peer-focus:text-light-primary dark:peer-focus:text-dark-primary peer-placeholder-shown:scale-100 peer-placeholder-shown:translate-y-0 peer-focus:scale-75 peer-focus:-translate-y-4 rtl:peer-focus:translate-x-1/4 rtl:peer-focus:left-auto'
}
}) }}
</div>
<div class="relative">
{{ form_widget(form.closingDate, {
'attr': {
'class': 'block rounded-lg px-2.5 pb-2.5 pt-5 w-full text-sm dark:bg-dark-font dark:text-white dark:border-dark-primary focus:ring-light-primary dark:focus:ring-dark-primary focus:border-light-primary dark:focus:border-dark-primary dark:placeholder-gray-300 peer',
'id': 'closingDate',
'placeholder': ''
}
}) }}
{{ form_label(form.closingDate, 'Date limite d\'inscription', {
'label_attr': {
'class': 'absolute text-sm text-light-primary dark:text-gray-300 duration-300 transform -translate-y-4 scale-75 top-4 z-10 origin-[0] start-2.5 peer-focus:text-light-primary dark:peer-focus:text-dark-primary peer-placeholder-shown:scale-100 peer-placeholder-shown:translate-y-0 peer-focus:scale-75 peer-focus:-translate-y-4 rtl:peer-focus:translate-x-1/4 rtl:peer-focus:left-auto'
}
}) }}
</div>
<div class="relative">
{{ form_widget(form.registrationsMax, {
'attr': {
'class': 'block rounded-lg px-2.5 pb-2.5 pt-5 w-full text-sm dark:bg-dark-font dark:text-white dark:border-dark-primary focus:ring-light-primary dark:focus:ring-dark-primary focus:border-light-primary dark:focus:border-dark-primary dark:placeholder-gray-300 peer',
'id': 'registrationsMax',
'placeholder': ''
}
}) }}
{{ form_label(form.registrationsMax, 'Nombre de place', {
'label_attr': {
'class': 'absolute text-sm text-light-primary dark:text-gray-300 duration-300 transform -translate-y-4 scale-75 top-4 z-10 origin-[0] start-2.5 peer-focus:text-light-primary dark:peer-focus:text-dark-primary peer-placeholder-shown:scale-100 peer-placeholder-shown:translate-y-0 peer-focus:scale-75 peer-focus:-translate-y-4 rtl:peer-focus:translate-x-1/4 rtl:peer-focus:left-auto'
}
}) }}
</div>
<div class="relative">
{{ form_widget(form.duration, {
'attr': {
'class': 'block rounded-lg px-2.5 pb-2.5 pt-5 w-full text-sm dark:bg-dark-font dark:text-white dark:border-dark-primary focus:ring-light-primary dark:focus:ring-dark-primary focus:border-light-primary dark:focus:border-dark-primary dark:placeholder-gray-300 peer',
'id': 'duration',
'placeholder': ''
}
}) }}
{{ form_label(form.duration, 'Durée (en minutes)', {
'label_attr': {
'class': 'absolute text-sm text-light-primary dark:text-gray-300 duration-300 transform -translate-y-4 scale-75 top-4 z-10 origin-[0] start-2.5 peer-focus:text-light-primary dark:peer-focus:text-dark-primary peer-placeholder-shown:scale-100 peer-placeholder-shown:translate-y-0 peer-focus:scale-75 peer-focus:-translate-y-4 rtl:peer-focus:translate-x-1/4 rtl:peer-focus:left-auto'
}
}) }}
</div>
<div class="relative">
{{ form_widget(form.place.city, {
'attr': {
'class': 'block rounded-t-lg px-2.5 pb-2.5 pt-5 w-full text-sm dark:bg-dark-font dark:text-white dark:border-dark-primary focus:ring-light-primary dark:focus:ring-dark-primary focus:border-light-primary dark:focus:border-dark-primary dark:placeholder-gray-300 peer',
'id': 'city',
'placeholder': ''
}
}) }}
{{ form_label(form.place.city, 'Ville', {
'label_attr': {
'class': 'absolute text-sm text-light-primary dark:text-gray-300 duration-300 transform -translate-y-4 scale-75 top-4 z-10 origin-[0] start-2.5 peer-focus:text-light-primary dark:peer-focus:text-dark-primary peer-placeholder-shown:scale-100 peer-placeholder-shown:translate-y-0 peer-focus:scale-75 peer-focus:-translate-y-4 rtl:peer-focus:translate-x-1/4 rtl:peer-focus:left-auto'
}
}) }}
</div>
<div class="relative">
{{ form_widget(form.place.name, {
'attr': {
'class': 'block rounded-lg px-2.5 pb-2.5 pt-5 w-full text-sm dark:bg-dark-font dark:text-white dark:border-dark-primary focus:ring-light-primary dark:focus:ring-dark-primary focus:border-light-primary dark:focus:border-dark-primary dark:placeholder-gray-300 peer',
'id': 'placeName',
'placeholder': ''
}
}) }}
{{ form_label(form.place.name, 'Lieu', {
'label_attr': {
'class': 'absolute text-sm text-light-primary dark:text-gray-300 duration-300 transform -translate-y-4 scale-75 top-4 z-10 origin-[0] start-2.5 peer-focus:text-light-primary dark:peer-focus:text-dark-primary peer-placeholder-shown:scale-100 peer-placeholder-shown:translate-y-0 peer-focus:scale-75 peer-focus:-translate-y-4 rtl:peer-focus:translate-x-1/4 rtl:peer-focus:left-auto'
}
}) }}
</div>
<div class="relative">
{{ form_widget(form.place.address, {
'attr': {
'class': 'block rounded-lg px-2.5 pb-2.5 pt-5 w-full text-sm dark:bg-dark-font dark:text-white dark:border-dark-primary focus:ring-light-primary dark:focus:ring-dark-primary focus:border-light-primary dark:focus:border-dark-primary dark:placeholder-gray-300 peer',
'id': 'placeAddress',
'placeholder': ''
}
}) }}
{{ form_label(form.place.address, 'Adresse', {
'label_attr': {
'class': 'absolute text-sm text-light-primary dark:text-gray-300 duration-300 transform -translate-y-4 scale-75 top-4 z-10 origin-[0] start-2.5 peer-focus:text-light-primary dark:peer-focus:text-dark-primary peer-placeholder-shown:scale-100 peer-placeholder-shown:translate-y-0 peer-focus:scale-75 peer-focus:-translate-y-4 rtl:peer-focus:translate-x-1/4 rtl:peer-focus:left-auto'
}
}) }}
</div>
<div class="relative">
{{ form_widget(form.place.latitude, {
'attr': {
'class': 'block rounded-lg px-2.5 pb-2.5 pt-5 w-full text-sm dark:bg-dark-font dark:text-white dark:border-dark-primary focus:ring-light-primary dark:focus:ring-dark-primary focus:border-light-primary dark:focus:border-dark-primary dark:placeholder-gray-300 peer',
'id': 'placeLatitude',
'placeholder': ''
}
}) }}
{{ form_label(form.place.latitude, 'Latitude', {
'label_attr': {
'class': 'absolute text-sm text-light-primary dark:text-gray-300 duration-300 transform -translate-y-4 scale-75 top-4 z-10 origin-[0] start-2.5 peer-focus:text-light-primary dark:peer-focus:text-dark-primary peer-placeholder-shown:scale-100 peer-placeholder-shown:translate-y-0 peer-focus:scale-75 peer-focus:-translate-y-4 rtl:peer-focus:translate-x-1/4 rtl:peer-focus:left-auto'
}
}) }}
</div>
<div class="relative">
{{ form_widget(form.place.longitude, {
'attr': {
'class': 'block rounded-lg px-2.5 pb-2.5 pt-5 w-full text-sm dark:bg-dark-font dark:text-white dark:border-dark-primary focus:ring-light-primary dark:focus:ring-dark-primary focus:border-light-primary dark:focus:border-dark-primary dark:placeholder-gray-300 peer',
'id': 'placeLongitude',
'placeholder': ''
}
}) }}
{{ form_label(form.place.longitude, 'Longitude', {
'label_attr': {
'class': 'absolute text-sm text-light-primary dark:text-gray-300 duration-300 transform -translate-y-4 scale-75 top-4 z-10 origin-[0] start-2.5 peer-focus:text-light-primary dark:peer-focus:text-dark-primary peer-placeholder-shown:scale-100 peer-placeholder-shown:translate-y-0 peer-focus:scale-75 peer-focus:-translate-y-4 rtl:peer-focus:translate-x-1/4 rtl:peer-focus:left-auto'
}
}) }}
</div>
</div>
<div class="relative w-full pb-5">
{{ form_widget(form.description, {
'attr': {
'class': 'block rounded-lg px-2.5 pb-2.5 pt-5 w-full text-sm dark:bg-dark-font dark:text-white dark:border-dark-primary focus:ring-light-primary dark:focus:ring-dark-primary focus:border-light-primary dark:focus:border-dark-primary dark:placeholder-gray-300 peer columns-2',
'id': 'description',
'placeholder': ''
}
}) }}
{{ form_label(form.description, 'Description', {
'label_attr': {
'class': 'absolute text-sm text-light-primary dark:text-gray-300 duration-300 transform -translate-y-4 scale-75 top-4 z-10 origin-[0] start-2.5 peer-focus:text-light-primary dark:peer-focus:text-dark-primary peer-placeholder-shown:scale-100 peer-placeholder-shown:translate-y-0 peer-focus:scale-75 peer-focus:-translate-y-4 rtl:peer-focus:translate-x-1/4 rtl:peer-focus:left-auto'
},
}) }}
</div>
<div class="relative">
<div class="flex items-center justify-center w-full">
<label for="create_outing_poster" class="flex flex-col items-center justify-center w-full h-64 border-2 border-gray-300 border-dashed rounded-lg cursor-pointer bg-gray-50 dark:hover:bg-bray-800 dark:bg-dark-font hover:bg-gray-100 dark:border-dark-primary dark:hover:border-dark-primary/75 dark:hover:bg-dark-font/75">
<div class="flex flex-col items-center justify-center pt-5 pb-6">
<svg class="w-8 h-8 mb-4 text-gray-500 dark:text-gray-400" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 20 16">
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 13h3a3 3 0 0 0 0-6h-.025A5.56 5.56 0 0 0 16 6.5 5.5 5.5 0 0 0 5.207 5.021C5.137 5.017 5.071 5 5 5a4 4 0 0 0 0 8h2.167M10 15V6m0 0L8 8m2-2 2 2"></path>
</svg>
<p class="mb-2 text-sm text-gray-500 dark:text-gray-400"><span class="font-semibold">Cliquez pour insérer</span> une image</p>
<p class="text-xs text-gray-500 dark:text-gray-400">SVG, PNG ou JPG</p>
</div>
{{ form_widget(form.poster, {'attr': {'class': 'hidden', 'enctype': 'multipart/form-data'}}) }}
<span id="file-name" class="flex items-center justify-center cursor-pointer text-gray-500 dark:text-gray-400 font-semibold">
{% if outing is defined and outing.poster is not null %}
{{ outing.poster }}
{% endif %}
</span>
</label>
</div>
</div>
<script>
const fileInput = document.getElementById('create_outing_poster');
const fileNameDisplay = document.getElementById('file-name');
fileInput.addEventListener('change', function() {
if (fileInput.files.length > 0) {
fileNameDisplay.textContent = fileInput.files[0].name;
} else {
fileNameDisplay.textContent = 'Aucun fichier choisi';
}
});
</script>
</div>
<div class="mt-6 grid w-full grid-cols-2 justify-end space-x-4 md:flex">
<div class="flex w-full justify-center">
<button type="submit"
class="px-4 py-2 mx-4 text-white dark:text-light-font uppercase bg-light-primary dark:bg-dark-primary border-2 border-transparent rounded-lg text-md hover:bg-light-secondary dark:hover:bg-dark-primary/75 transition duration-300">
{% if isModif %}
Modifier
{% else %}
Publier
{% endif %}
</button>
{% if isModif %}
<button data-modal-target="popup-cancel" data-modal-toggle="popup-cancel" class="px-4 py-2 mx-4 text-white dark:text-light-font uppercase bg-light-danger dark:bg-dark-danger border-2 border-transparent rounded-lg text-md hover:bg-light-danger/75 dark:hover:bg-dark-danger/75 transition duration-300" type="button">
Annuler la sortie
</button>
<a href="{{ path('outing_preview', {'id': outing.id}) }}" class="px-4 py-2 mx-4 text-light-primary dark:text-dark-primary dark:hover:text-dark-primary hover:text-light-font uppercase bg-transparent rounded-lg hover:bg-light-secondary dark:hover:bg-dark-secondary cursor-pointer transition duration-300">
Retour
</a>
<div id="popup-cancel" tabindex="-1" class="hidden overflow-y-auto overflow-x-hidden fixed top-0 right-0 left-0 z-50 justify-center items-center w-full md:inset-0 h-[calc(100%-1rem)] max-h-full">
<div class="relative p-4 w-full max-w-md max-h-full">
<div class="relative bg-white rounded-lg shadow dark:bg-gray-700">
<button type="button" class="absolute top-3 end-2.5 text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm w-8 h-8 ms-auto inline-flex justify-center items-center dark:hover:bg-gray-600 dark:hover:text-white" data-modal-hide="popup-cancel">
<svg class="w-3 h-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 14 14">
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m1 1 6 6m0 0 6 6M7 7l6-6M7 7l-6 6"></path>
</svg>
<span class="sr-only">Fermer la popup</span>
</button>
<div class="p-4 md:p-5 text-center">
<svg class="mx-auto mb-4 text-gray-400 w-12 h-12 dark:text-gray-200" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 20 20">
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 11V6m0 8h.01M19 10a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"></path>
</svg>
<h3 class="mb-5 text-lg font-normal text-gray-500 dark:text-gray-400">Êtes-vous sûr de vouloir annuler la sortie ?</h3>
<a href="{{ path('outing_cancel', {'id': outing.id}) }}" data-modal-hide="popup-cancel" type="button" class="text-white bg-red-600 hover:bg-red-800 focus:ring-4 focus:outline-none focus:ring-red-300 dark:focus:ring-red-800 font-medium rounded-lg text-sm inline-flex items-center px-5 py-2.5 text-center me-2">
Oui, annuler
</a>
<button data-modal-hide="popup-cancel" type="button" class="text-gray-500 bg-white hover:bg-gray-100 focus:ring-4 focus:outline-none focus:ring-gray-200 rounded-lg border border-gray-200 text-sm font-medium px-5 py-2.5 hover:text-gray-900 focus:z-10 dark:bg-gray-700 dark:text-gray-300 dark:border-gray-500 dark:hover:text-white dark:hover:bg-gray-600 dark:focus:ring-gray-600">Non</button>
</div>
</div>
</div>
</div>
{% else %}
<button class="px-4 py-2 mx-4 text-light-primary dark:text-dark-primary dark:hover:text-dark-primary hover:text-light-font uppercase bg-transparent rounded-lg hover:bg-light-secondary dark:hover:bg-dark-secondary cursor-pointer" onclick="window.history.back()">
Retour
</button>
{% endif %}
</div>
</div>
{{ form_end(form) }}
</section>
{% endblock %}

View File

@@ -0,0 +1,25 @@
{% extends 'base.html.twig' %}
{% block title %}Liste des sorties | {{ parent() }}{% endblock %}
{% block body %}
<section class="flex flex-row justify-center flex-wrap mx-auto p-6">
<div class="m-2 w-full lg:w-5/6 sm:w-full">
{% include 'outing/search.html.twig' with {'formSearch':formSearch} only %}
</div>
{% if outings|length == 0 %}
<h2 class="w-full text-3xl mt-5 text-center font-extrabold text-black sm:text-4xl">Aucune sortie ne correspond à
votre
recherche</h2>
{% else %}
<section class="flex flex-row justify-center flex-wrap mx-auto p-6 lg:px-32">
{% for outing in outings %}
{% include 'outing/card.html.twig' with {'outing': outing} %}
{% endfor %}
</section>
{% endif %}
</section>
{% endblock %}

View File

@@ -0,0 +1,176 @@
{% extends 'base.html.twig' %}
{% block title %}{{ outing.title }} | {{ parent() }}{% endblock %}
{% block body %}
<main class="mt-10 px-8">
<div class="flex flex-col-reverse lg:flex-row">
<div class="flex flex-col lg:flex-row lg:space-x-12 lg:w-1/3">
<div class="w-full mx-3 m-auto">
{% if weather is not null %}
<div class="p-4 border-t border-b md:border rounded-2xl shadow-xl dark:border-dark-primary bg-light-card dark:bg-dark-card flex flex-col items-center m-auto mb-5">
<div class="text-center">
<h2 class="text-xl font-semibold p-2 text-gray-700 dark:text-light-card">{{ outing.place.city.name }}</h2>
</div>
{% if weather.weather == 0 %}
<img src="{{ asset('weather/day.svg') }}" alt="Météo"
class="w-48 h-48 rounded-full">
{% elseif weather.weather > 0 and weather.weather < 10 %}
<img src="{{ asset('weather/cloudy-day-2.svg') }}" alt="Météo"
class="w-48 h-48 rounded-full">
{% elseif weather.weather >= 10 and weather.weather < 60 %}
<img src="{{ asset('weather/rainy-2.svg') }}" alt="Météo"
class="w-48 h-48 rounded-full">
{% elseif weather.weather >= 60 and weather.weather < 79 %}
<img src="{{ asset('weather/snowy-4.svg') }}" alt="Météo"
class="w-48 h-48 rounded-full">
{% elseif weather.weather >= 78 and weather.weather < 138 %}
<img src="{{ asset('weather/thunder.svg') }}" alt="Météo"
class="w-48 h-48 rounded-full">
{% else %}
<img src="{{ asset('weather/day.svg') }}" alt="Météo"
class="w-48 h-48 rounded-full">
{% endif %}
<div class="mb-2 text-3xl font-semibold p-2 text-gray-700 dark:text-light-card">{{ weather.tmin }}°C / {{ weather.tmax }}°C
</div>
</div>
{% endif %}
<div class="p-4 border-t border-b md:border rounded-2xl shadow-xl dark:border-dark-primary bg-light-card dark:bg-dark-card">
<p class="font-semibold text-gray-700 dark:text-light-card text-lg">Publié par :</p>
<a href="{{ path('user_show', {'pseudo': outing.organizer.pseudo}) }}" class="flex py-2 w-fit">
{% if outing.organizer.profilePicture %}
<img src="{{ asset('uploads/' ~ outing.organizer.profilePicture) | imagine_filter('profile') }}"
class="h-10 w-10 rounded-full mr-2 object-cover"
alt="Photo de profil de {{ outing.organizer.pseudo }}"/>
{% else %}
<img src="{{ asset('profilDefault.png') }}"
class="h-10 w-10 rounded-full mr-2 object-cover"
alt="Photo de profil de {{ outing.organizer.pseudo }}"/>
{% endif %}
<div>
<p class="font-semibold text-gray-700 text-sm dark:text-light-card">
{% if outing.organizer == app.user %}
Vous
{% else %}
{{ outing.organizer.firstname|capitalize }} {{ outing.organizer.lastname|upper }}
{% endif %}
</p>
<p class="font-semibold text-gray-400 text-xs">@{{ outing.organizer.pseudo }}</p>
<p class="font-semibold text-gray-600 text-xs dark:text-dark-primary">{{ outing.organizer.site.name }}</p>
</div>
</a>
<div class="flex flex-col items-center justify-center text-center">
{% if outing.status.label == "Annulée" %}
<button class="px-4 py-2 m-2 mt-4 w-full text-white dark:text-light-font uppercase bg-light-danger/75 dark:bg-dark-danger/75 border-2 border-transparent rounded-lg text-md"
disabled>
Sortie annulée
</button>
{% else %}
{% if outing.isUserRegistered(app.user) and outing.organizer != app.user %}
<a href="{{ path('outing_unregister', {'id':outing.id}) }}"
class="px-4 py-2 m-2 mt-4 w-full text-white dark:text-light-font uppercase bg-light-danger dark:bg-dark-danger border-2 border-transparent rounded-lg text-md hover:bg-light-danger/75 dark:hover:bg-dark-danger/75">
Se désister
</a>
{% elseif outing.canUserRegister(app.user) %}
<a href="{{ path('outing_register', {'id':outing.id}) }}"
class="px-4 py-2 m-2 w-full text-white dark:text-light-font uppercase bg-light-success dark:bg-dark-success border-2 border-transparent rounded-lg text-md hover:bg-light-success/75 dark:hover:bg-dark-success/75">
S'inscrire
</a>
{% elseif outing.organizer != app.user %}
<button class="px-4 py-2 m-2 mt-4 w-full text-white dark:text-light-font uppercase bg-light-danger/75 dark:bg-dark-danger/75 border-2 border-transparent rounded-lg text-md"
disabled>
Inscriptions fermées
</button>
{% endif %}
{% if outing.organizer == app.user %}
<a href="{{ path('outing_edit', {'id':outing.id}) }}"
class="px-4 py-2 m-2 w-full text-white dark:text-dark-primary uppercase bg-light-secondary dark:bg-dark-secondary hover:bg-light-secondary/75 dark:hover:bg-dark-secondary/75 rounded-lg text-md">
Modifier
</a>
{% endif %}
{% endif %}
</div>
</div>
</div>
</div>
<div class="mb-4 md:mb-0 mx-3 w-full mx-auto relative">
<div class="px-4 lg:px-0 my-3 text-center text-gray-600">
<h2 class="text-4xl font-semibold text-gray-800 dark:text-light-font leading-tight overflow-hidden truncate">
{{ outing.title }}
</h2>
<div class="pt-2 flex-col items-center justify-center">
{# On regarde le label du statut de l'outing, si c'est créée ou ouverte on met le texte en success, si c'est activité en cours on met text-warning, sinon on met text-danger #}
{% set labelColor = outing.status.label == 'Créée' or outing.status.label == 'Ouverte' ? 'text-dark-success text-light-success' : outing.status.label == 'Activité en cours' ? 'text-dark-warning text-light-warning' : 'text-dark-danger text-light-danger' %}
<h2 class="{{ labelColor }}">
{{ outing.status.label }}
</h2>
</div>
{% if outing.poster %}
<img src="{{ asset('uploads/' ~ outing.poster) | imagine_filter('outings') }}"
class="h-auto max-w-full md:max-w-md lg:max-w-lg mx-auto rounded-lg shadow-xl my-3"
alt="poster"/>
{% endif %}
{% if app.user %}
<h2 class="dark:text-light-font"><span
class="font-bold dark:text-dark-primary">Lieu</span> : {{ outing.place.name }}</h2>
<h2 class="dark:text-light-font"><span class="font-bold dark:text-dark-primary">Adresse</span>
: {{ outing.place.address }}, {{ outing.place.city.name }} ({{ outing.place.city.postcode }}
)</h2>
<h2 class="dark:text-light-font"><span class="font-bold dark:text-dark-primary">Date</span>
: {{ outing.startDate|format_datetime('long', 'short', locale='fr') }}</h2>
{% if outing.closingDate > date('now') %}
<h3 class="dark:text-light-font"><span class="font-bold dark:text-dark-primary">Clôture des inscriptions</span>
:
<span class="text-dark-danger text-light-danger">{{ outing.closingDate|format_datetime('long', 'short', locale='fr') }}</span>
</h3>
{% endif %}
{% endif %}
<h3 class="dark:text-light-font"><span class="font-bold dark:text-dark-primary">Nombre de participants inscrits </span>
:
<span class="font-bold {% if (outing.registrationsMax - outing.registrations|length) > outing.registrations|length / 2 %}text-dark-success text-light-success{% elseif (outing.registrationsMax - outing.registrations|length) > outing.registrations|length %}text-dark-warning text-light-warning{% else %}text-dark-danger text-light-danger{% endif %}">
{{ outing.registrations|length }} / {{ outing.registrationsMax }}
</span>
</h3>
</div>
<div class="px-4 lg:px-0 mt-12 text-gray-700 text-lg leading-relaxed w-full lg:w-3/4 order-first lg:order-last">
<p class="pb-6 dark:text-light-font">{{ outing.description }}</p>
</div>
</div>
</div>
{% if outing.registrations|length > 0 %}
<section class="mt-8 px-8">
<h2 class="text-2xl font-semibold text-center mb-4 dark:text-light-font">Liste des participants</h2>
<div class="flex flex-wrap justify-center">
{% for registration in outing.registrations %}
<div class="max-w-xs mx-4 mb-8">
<a href="{{ path('user_show', {'pseudo': registration.participant.pseudo}) }}">
<div class="bg-light-card dark:bg-dark-card rounded-lg shadow-md hover:shadow-xl transition overflow-hidden cursor-pointer w-44">
<img src="{{ registration.participant.profilePicture ? asset('uploads/' ~ registration.participant.profilePicture) | imagine_filter('profile') : asset('profilDefault.png') }}"
class="w-full h-40 object-cover"
alt="Photo de profil de {{ registration.participant.pseudo }}">
<div class="p-4 text-center">
<p class="text-lg font-semibold dark:text-light-font">
@{{ registration.participant.pseudo }}</p>
<p class="text-gray-500 text-sm dark:text-dark-primary">{{ registration.participant.site.name }}</p>
</div>
</div>
</a>
</div>
{% endfor %}
</div>
</section>
{% endif %}
</main>
{% endblock %}

View File

@@ -0,0 +1,108 @@
{% if formSearch %}
{{ form_start(formSearch) }}
<div class="rounded-xl bg-light-card dark:bg-dark-card p-6 shadow-md">
<h2 class="text-light-primary dark:text-light-font text-xl font-bold">Rechercher une sortie</h2>
<div class="flex items-center my-5 relative w-full">
<div class="flex absolute inset-y-0 left-0 items-center pl-3 pointer-events-none">
<svg class="w-5 h-5 text-gray-500 dark:text-gray-400" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" d="M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z" clip-rule="evenodd"></path>
</svg>
</div>
{{ form_widget(formSearch.name, {
'attr': {
'class': 'block w-full pl-10 p-2.5 text-sm rounded-lg dark:bg-dark-font dark:text-white dark:border-dark-primary focus:ring-light-primary dark:focus:ring-dark-primary focus:border-light-primary dark:focus:border-dark-primary dark:placeholder-gray-300',
'id': 'simple-search',
'placeholder': 'Recherche'
}
}) }}
</div>
<div class="my-5 grid grid-flow-row-dense grid-cols-1 gap-6 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4">
<div class="flex flex-col col-span-4 md:col-span-2">
<label for="campus" class="text-light-primary dark:text-light-font text-sm font-medium">Campus</label>
{{ form_widget(formSearch.site, {
'attr': {
'id': 'campus',
'class': 'text-sm rounded-lg my-2 block w-full border-gray-200 dark:bg-dark-font dark:text-white dark:border-dark-primary focus:ring-light-primary dark:focus:ring-dark-primary focus:border-light-primary dark:focus:border-dark-primary dark:placeholder-gray-300'
}
}) }}
</div>
<div class="flex flex-col col-span-4 md:col-span-1">
<label for="startDate" class="text-light-primary dark:text-light-font text-sm font-medium">Date de début</label>
{{ form_widget(formSearch.startDate, {
'attr': {
'id': 'startDate',
'class': 'text-sm rounded-lg my-2 block w-full border-gray-200 dark:bg-dark-font dark:text-white dark:border-dark-primary focus:ring-light-primary dark:focus:ring-dark-primary focus:border-light-primary dark:focus:border-dark-primary dark:placeholder-gray-300'
}
}) }}
</div>
<div class="flex flex-col col-span-4 md:col-span-1">
<label for="endDate" class="text-light-primary dark:text-light-font text-sm font-medium">Date de fin</label>
{{ form_widget(formSearch.endDate, {
'attr': {
'id': 'endDate',
'class': 'text-sm rounded-lg my-2 block w-full border-gray-200 dark:bg-dark-font dark:text-white dark:border-dark-primary focus:ring-light-primary dark:focus:ring-dark-primary focus:border-light-primary dark:focus:border-dark-primary dark:placeholder-gray-300'
}
}) }}
</div>
<div class="flex flex-col col-span-4">
<ul class="items-center w-full text-sm font-medium rounded-lg sm:flex bg-white dark:bg-dark-font border border-gray-300 dark:border-dark-primary text-light-primary dark:text-light-font">
<li class="w-full border-b border-gray-200 dark:border-dark-primary sm:border-b-0 sm:border-r">
<div class="flex items-center ps-3">
{{ form_widget(formSearch.isOrganizer, {
'id': 'author',
'attr': {
'class': 'text-sm rounded-lg cursor-pointer w-4 h-4 bg-white dark:bg-dark-font border border-gray-300 text-light-primary dark:text-dark-primary focus:ring-0 dark:focus:ring-dark-primary'
}
}) }}
<label for="author" class="w-full py-3 ms-2 text-sm font-medium text-light-primary dark:text-light-font">Sorties dont je suis l'organisateur/trice</label>
</div>
</li>
<li class="w-full border-b border-gray-200 dark:border-dark-primary sm:border-b-0 sm:border-r">
<div class="flex items-center ps-3">
{{ form_widget(formSearch.isRegistered, {
'id': 'register',
'attr': {
'class': 'text-sm rounded-lg cursor-pointer w-4 h-4 bg-white dark:bg-dark-font border border-gray-300 text-light-primary dark:text-dark-primary focus:ring-0 dark:focus:ring-dark-primary'
}
}) }}
<label for="register" class="w-full py-3 ms-2 text-sm font-medium text-light-primary dark:text-light-font">Sorties auxquelles je suis inscrit/e</label>
</div>
</li>
<li class="w-full border-b border-gray-200 dark:border-dark-primary sm:border-b-0 sm:border-r">
<div class="flex items-center ps-3">
{{ form_widget(formSearch.isNotRegistered, {
'id': 'notResgister',
'attr': {
'class': 'text-sm rounded-lg cursor-pointer w-4 h-4 bg-white dark:bg-dark-font border border-gray-300 text-light-primary dark:text-dark-primary focus:ring-0 dark:focus:ring-dark-primary'
}
}) }}
<label for="notResgister" class="w-full py-3 ms-2 text-sm font-medium text-light-primary dark:text-light-font">Sorties auxquelles je ne suis pas inscrit/e</label>
</div>
</li>
<li class="w-full border-b border-gray-200 dark:border-dark-primary sm:border-b-0 sm:border-r">
<div class="flex items-center ps-3">
{{ form_widget(formSearch.isFinished, {
'id': 'endOuting',
'attr': {
'class': 'text-sm rounded-lg cursor-pointer w-4 h-4 bg-white dark:bg-dark-font border border-gray-300 text-light-primary dark:text-dark-primary focus:ring-0 dark:focus:ring-dark-primary'
}
}) }}
<label for="endOuting" class="w-full py-3 ms-2 text-sm font-medium text-light-primary dark:text-light-font">Sorties passées</label>
</div>
</li>
</ul>
</div>
</div>
<div class="mt-6 grid w-full grid-cols-2 justify-end space-x-4 md:flex">
<button type="reset" class="px-4 py-2 text-light-primary dark:text-dark-primary dark:hover:text-dark-primary hover:text-light-font uppercase bg-transparent rounded-lg hover:bg-light-secondary dark:hover:bg-dark-secondary text-md transition duration-300">
Annuler les filtres
</button>
<button type="submit" class="px-4 py-2 mr-4 text-white dark:text-light-font uppercase bg-light-primary dark:bg-dark-primary border-2 border-transparent rounded-lg text-md hover:bg-light-secondary dark:hover:bg-dark-primary/75 transition duration-300">
Rechercher
</button>
</div>
</div>
{{ form_end(formSearch) }}
{% endif %}