set front
This commit is contained in:
273
templates/outing/create.html.twig
Normal file
273
templates/outing/create.html.twig
Normal 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 %}
|
||||
Reference in New Issue
Block a user