{% extends 'base.html.twig' %}
{% block title %}Accueil - CinéDevRT{% endblock %}
{% block body %}
<main>
<div id="slider_container">
<div> Les films du moment </div>
<section id="slider">
<div>
<a> </a>
{% set sliderImgNumber = "-2" %}
{% for movie in movies %}
<a href="{{ path('filmsShow', {id: movie.id}) }}">
<img src="{{ asset('uploads/' ~ movie.file) }}">
<div id="sliderImg{{ sliderImgNumber }}"> </div>
</a>
{% set sliderImgNumber = sliderImgNumber + 1 %}
{% endfor %}
<a> </a>
</div>
</section>
<div id="arrow">
<div> <i id="arrowLeft" onclick="slideLeft()" class="fas fa-chevron-circle-left"></i> </div>
<div> <i id="arrowRight" onclick="slideRight()" class="fas fa-chevron-circle-right"></i> </div>
</div>
</div>
<section id="onDisplay">
<div> <h2> Films à l'affiche </h2> </div>
<section>
{% for movie in movies %}
<div>
<div> <img src="{{ asset('uploads/' ~ movie.file) }}"> </div>
<div>
<h3> {{ movie.title }} </h3>
<div>
<div> <strong> Durée : </strong> 2h </div>
<div> <strong> Genres : </strong> Fantaisie, Action </div>
<div> <strong> Réalisateurs : </strong> {{ movie.realisedBy }} </div>
</div>
<a href="{{ path('filmsShow', {id: movie.id}) }}"> Séances </a>
</div>
</div>
{% endfor %}
</section>
</section>
{# modal #}
<div id="modal">
<div>
<h2> Ce site est un petit projet fictif de développeur </h2>
<h3> Le projet est actuellement en pause et non terminé </h3>
<p> Vous pouvez tout de même tester les fonctionnalités actuelles en créant votre compte </p>
<p> Retrouvez davantage d'information dans la page "Contact" </p>
<p> (Non responsive pour le moment) </p>
<button onclick="closeModal()"> Fermer la pop up </button>
</div>
</div>
{# end modal #}
</main>
<script>
function closeModal(){
document.getElementById("modal").style.display = "none";
}
var valueInitR;
var valueInitL;
var counter = 0;
function resetLeftArrow() {
document.getElementById("arrowLeft").style.transform = "rotate(0deg)";
}
function resetRightArrow() {
document.getElementById("arrowRight").style.transform = "rotate(0deg)";
}
function resetTransitionLeftArrow() {
document.getElementById("arrowLeft").style.transition = "unset";
}
function resetTransitionRightArrow() {
document.getElementById("arrowRight").style.transition = "unset";
}
function slideLeft() {
console.log(counter);
switch (counter) {
case -2:
break;
case -1:
document.getElementById("slider").style.right = "33.33%";
document.getElementById("slider").style.transform = "translateX(33.33%)";
document.getElementById("arrowLeft").style.transform = "rotate(360deg)";
document.getElementById("arrowLeft").style.transition = "transform 0.5s";
document.getElementById("sliderImg-2").style.opacity = "unset";
document.getElementById("sliderImg-2").style.backgroundColor = "unset";
document.getElementById("sliderImg-1").style.opacity = "0.7";
document.getElementById("sliderImg-1").style.backgroundColor = "black";
counter--;
break;
case 0:
document.getElementById("slider").style.right = "16.66%";
document.getElementById("slider").style.transform = "translateX(-16.66%)";
document.getElementById("arrowLeft").style.transform = "rotate(360deg)";
document.getElementById("arrowLeft").style.transition = "transform 0.5s";
document.getElementById("sliderImg-1").style.opacity = "unset";
document.getElementById("sliderImg-1").style.backgroundColor = "unset";
document.getElementById("sliderImg0").style.opacity = "0.7";
document.getElementById("sliderImg0").style.backgroundColor = "black";
counter--;
break;
case 1:
document.getElementById("slider").style.right = "33.33%";
document.getElementById("slider").style.transform = "translateX(-33.33%)";
document.getElementById("arrowLeft").style.transform = "rotate(360deg)";
document.getElementById("arrowLeft").style.transition = "transform 0.5s";
document.getElementById("sliderImg0").style.opacity = "unset";
document.getElementById("sliderImg0").style.backgroundColor = "unset";
document.getElementById("sliderImg1").style.opacity = "0.7";
document.getElementById("sliderImg1").style.backgroundColor = "black";
counter--;
break;
case 2:
document.getElementById("slider").style.right = "49.99%";
document.getElementById("slider").style.transform = "translateX(-49.99%)";
document.getElementById("arrowLeft").style.transform = "rotate(360deg)";
document.getElementById("arrowLeft").style.transition = "transform 0.5s";
document.getElementById("sliderImg1").style.opacity = "unset";
document.getElementById("sliderImg1").style.backgroundColor = "unset";
document.getElementById("sliderImg2").style.opacity = "0.7";
document.getElementById("sliderImg2").style.backgroundColor = "black";
counter--;
break;
default:
break;
}
setTimeout(resetTransitionLeftArrow, 501);
setTimeout(resetLeftArrow, 502);
}
function slideRight() {
console.log(counter);
switch (counter) {
case -2:
document.getElementById("slider").style.right = "16.66%";
document.getElementById("slider").style.transform = "translateX(-16.66%)";
document.getElementById("arrowRight").style.transform = "rotate(360deg)";
document.getElementById("arrowRight").style.transition = "transform 0.5s";
document.getElementById("sliderImg-1").style.opacity = "unset";
document.getElementById("sliderImg-1").style.backgroundColor = "unset";
document.getElementById("sliderImg-2").style.opacity = "0.7";
document.getElementById("sliderImg-2").style.backgroundColor = "black";
counter++;
break;
case -1:
document.getElementById("slider").style.right = "33.33%";
document.getElementById("slider").style.transform = "translateX(-33.33%)";
document.getElementById("arrowRight").style.transform = "rotate(360deg)";
document.getElementById("arrowRight").style.transition = "transform 0.5s";
document.getElementById("sliderImg0").style.opacity = "unset";
document.getElementById("sliderImg0").style.backgroundColor = "unset";
document.getElementById("sliderImg-1").style.opacity = "0.7";
document.getElementById("sliderImg-1").style.backgroundColor = "black";
counter++;
break;
case 0:
document.getElementById("slider").style.right = "49.99%";
document.getElementById("slider").style.transform = "translateX(-49.99%)";
document.getElementById("arrowRight").style.transform = "rotate(360deg)";
document.getElementById("arrowRight").style.transition = "transform 0.5s";
document.getElementById("sliderImg1").style.opacity = "unset";
document.getElementById("sliderImg1").style.backgroundColor = "unset";
document.getElementById("sliderImg0").style.opacity = "0.7";
document.getElementById("sliderImg0").style.backgroundColor = "black";
counter++;
break;
case 1:
document.getElementById("slider").style.right = "66.66%";
document.getElementById("slider").style.transform = "translateX(-66.66%)";
document.getElementById("arrowRight").style.transform = "rotate(360deg)";
document.getElementById("arrowRight").style.transition = "transform 0.5s";
document.getElementById("sliderImg2").style.opacity = "unset";
document.getElementById("sliderImg2").style.backgroundColor = "unset";
document.getElementById("sliderImg1").style.opacity = "0.7";
document.getElementById("sliderImg1").style.backgroundColor = "black";
counter++;
break;
case 2:
break;
default:
break;
}
setTimeout(resetTransitionRightArrow, 501);
setTimeout(resetRightArrow, 502);
}
</script>
{% endblock %}