des trucs
This commit is contained in:
@@ -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>
|
||||
{% endblock %}
|
||||
{% 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">
|
||||
|
||||
Reference in New Issue
Block a user