templates/home/pagemateriel.html.twig line 1
{% extends 'base.html.twig' %}
{% block title %}{{ materiel.nom }}{% endblock %}
{% block stylesheets %}
<link rel="stylesheet" href="https://unpkg.com/swiper/swiper-bundle.min.css" />
<link rel="stylesheet" href="{{ asset('assets/front/swiper.css') }}" />
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x" crossorigin="anonymous" />
<link rel="stylesheet" href="{{ asset('assets/front/protocole.css') }}" />
<script src="https://unpkg.com/swiper/swiper-bundle.min.js"></script>
{% endblock %}
{% block body %}
<div class="breadcrumb"><div class="container">
<a href="{{ path('home_page') }}">Accueil</a>
{% if urls|length >0 %}
{% for url in urls %}
{% set nom = "'" ~ url|lower ~ "'" %}
/ <a href="{{ path('categoriefiltrenom_page', {'type': 2, 'nom': nom }) }}">{{ url|capitalize }}</a>
{% endfor %}
{% else %}
/ <a href="{{ path('categoriefiltre_page', {'type': 2}) }}">Materiels</a>
{% endif %}
/ <a href="{{ path('materiel_page', { 'id' : materiel.id }) }}">{{ materiel.nom }}</a></div>
</div>
<div class="container-main pagemateriel">
{# Titre #}
{% if materiel.codeSC == 'S' %}
<h1>Instrument : {{ materiel.nom }}</h1>
{% elseif materiel.codeSC == 'C' %}
<h1>Consommable : {{ materiel.nom }}</h1>
{% elseif materiel.codeSC == 'E' %}
<h1>Equipement : {{ materiel.nom }}</h1>
{% else %}
<h1>{{ materiel.nom }}</h1>
{% endif %}
<br/>
<div class="materiel">
{# image à gauche ou en haut #}
<div class="images">
<div class="container-image">
<div>
<img id="laphoto" onclick="clickImage()"
{% if materielphotos|length > 0 %} src="{{ asset('download/') }}{{ materielphotos[0].image.urlfichier }}"
{% else %} src="{{ asset('assets/img/materiel.jpg') }}" {% endif %} />
</div>
</div>
{% if materielphotos|length > 1 %}
<div class="btn-images">
{% for photo in materielphotos %}
<div><img src="{{ asset('download/') }}{{ photo.image.urlfichier }}" onclick="affichephoto(this)" /> </div>
{% endfor %}
</div>
{% endif %}
</div>
<div class="materiel-description flex-vertical-spac-ebetween">
<div class="text-normal">
{# <h2 class="materiel-h2">{{ materiel.nom }}</h2> #}
{{ materiel.description|raw }}
{# kit ? #}
{% if materiel.kitmateriels|length >0 %}
<h4 class="text-left margin-left-30">Contenu du kit</h4>
<ul class="kitLarge">
{% for kit in materiel.kitmateriels %}
<li><a href="{{ path('materiel_page', { 'id' : kit.id }) }}"><i class="fas fa-chevron-right"></i> {{ kit.nom }}</a></li>
{% endfor %}
</ul>
{% endif %}
</div>
<div class="materiel-categories">
<span class="gray-light text-big">Catégories:</span>
<span class="gray-medium text-big">
{% for child in materiel.categories %}
<a href="{{ path('categoriefiltre_page', {'type': 2, 'code': child.id}) }}">{{ child.titre }}</a>{% if loop.last %}{% else %}, {% endif %}
{% endfor %}
</div>
{# {% if materiel.protocoles|length > 0%}
<div class="materiel-categories">
<span class="gray-light text-big">Protocoles associées:</span>
<span class="gray-medium text-big">
{% for child in materiel.protocoles %}
<a href="{{ path('protocole_page', {'id': child.id}) }}">{{ child.titre }}</a>{% if loop.last %}{% else %}, {% endif %}
{% endfor %}
</span>
</div>
{% endif %} #}
{% if is_granted('ROLE_USER') %}
<div class="btnFavori" >
{% if isFavori == true %}
<form id="formMateriels" action="{{ path('removeusermateriel_ajax', {'id': materiel.id }) }}" method="post">
<button class="clair small" id="addFavori">Retirer de mes favoris <i class="fas fa-star" style="color:#FDD46A"></i></button>
</form>
<i style="font-size:12px">Les favoris sont accessibles depuis la page de <a href="{{ path('infoscompte_page') }}" style="font-size:12px">votre compte</a></i>
{% else %}
<form id="formMateriels" action="{{ path('addusermateriel', {'id': materiel.id }) }}" method="post">
<button class="clair small" id="addFavori" >Ajouter à mes favoris <i class="far fa-star"></i></button>
</form>
{% endif %}
</div>
{% endif %}
</div>
</div>
{# Onglets #}
<br/>
<div class="tabs">
<div class="tab">
<button class="tablinks active" onclick="openTab(event, 'description')">Conditionnement</button>
<button class="tablinks" onclick="openTab(event, 'tarif')">Tarifs</button>
<button class="tablinks" onclick="openTab(event, 'protos')">Protocoles</button>
</div>
<div class="tabcontents pagemateriel">
<div id="description" class="tabcontent active">
<h3 style="margin-top:10px;">Conditionnement</h3>
{{ materiel.presentation|raw }}
</div>
<div id="protos" class="tabcontent">
<h3 style="margin-top:10px;">Protocoles associés</h3>
<div class="vignette">
{% for child in materiel.protocoles %}
{# <a href="{{ path('protocole_page', {'id': child.id}) }}">{{ child.titre }}</a><br/> #}
<a href="{{ path('protocole_page', {'id': child.id, 'nom': child.titre}) }}">
{% if child.protocolephotos is null or child.protocolephotos|length <1 %}
<img src="{{ asset('assets/img/protocole.jpg') }}" />
{% else %}
<img src="{{ asset('download/') }}{{ child.PhotoDefault }}" />
{% endif %}
<h3>{{ child.titre }}</h3>
</a>
{% endfor %}
</div>
</div>
<div id="tarif" class="tabcontent">
<h3 style="margin-top:10px;">Tarifs</h3>
{{ materiel.tarif }}
</div>
</div>
</div>
{# Produits associés #}
<br/><br/>
{% include 'home/prodassocies.html.twig' %}
</div>
<!-- Commentaire -->
<section class="commentaires" style="background-image: url('{{ asset('assets/img/comments-cover.jpg') }}');">
<div class="container">
<h2>Commentaires</h2>
{% for commentaire in commentaires %}
<div class="commentaire">
<p class="dateuser">Le {{ commentaire.datepubli|date('d/m/Y') }} par {{ commentaire.auteur.prenom }} {{ commentaire.auteur.nom }}</p>
<p class="comment">{{ commentaire.comment }}</p>
</div>
{% else %}
<p class="nocomment">Aucun commentaire</p>
{% endfor %}
{% if is_granted('ROLE_USER') and app.user.isVerified %}
<div class="newcommentaire">
{{ form_start(form) }}
{{ form_widget(form) }}
<button class="btn-send">{{ button_label|default('Envoyer') }}</button>
{{ form_end(form) }}
</div>
{% endif %}
</div>
</section>
<!-- la fenêtre popup modale -->
<div id="myModal" class="modal">
<div class="modal-content">
<span class="close" id="modalClose">×</span>
<img id="bigimage" />
</div>
</div>
{% endblock %}
{% block javascripts %}
<script>
function openTab(evt, cityName) {
let i, tabcontent, tablinks;
tabcontent = document.getElementsByClassName("tabcontent");
for (i = 0; i < tabcontent.length; i++) {
tabcontent[i].className = tabcontent[i].className.replace(" active", "");
}
tablinks = document.getElementsByClassName("tablinks");
for (i = 0; i < tablinks.length; i++) {
tablinks[i].className = tablinks[i].className.replace(" active", "");
}
document.getElementById(cityName).className += " active";
evt.currentTarget.className += " active";
}
//affichage de l'image dans le carré de sélection
function affichephoto(img) {
document.getElementById("laphoto").src = img.src;
}
//ouverture de la fenetre modale sur clic de l'image
let modal = document.getElementById("myModal");
function clickImage() {
//recup de l'image mis en data
let image = document.getElementById('laphoto').src;
document.getElementById('bigimage').src = image;
modal.style.display = "block";
}
// Fermeture de la fenêtre modale
document.getElementById('modalClose').onclick = function() {
modal.style.display = "none";
}
window.onclick = function(event) {
if (event.target == modal) {
modal.style.display = "none";
}
}
</script>
<!-- Swiper JS -->
<script src="https://unpkg.com/swiper/swiper-bundle.min.js"></script>
<!-- Initialize Swiper du slider -->
<script>
var swiper = new Swiper(".mySwiper", {
speed: 600,
slidesPerView: 4,
parallax: true,
autoplay: {
delay: 2500,
disableOnInteraction: false,
},
pagination: {
el: ".swiper-pagination",
clickable: true,
},
navigation: {
nextEl: ".swiper-button-next",
prevEl: ".swiper-button-prev",
},
});
</script>
{# <!-- Initialize Swiper des protocoles -->
<script>
var swiper = new Swiper('.swiper', {
slidesPerView: 6,
spaceBetween: 10,
direction: 'horizontal',
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
},
breakpoints: {
1300: {
slidesPerView: 6,
spaceBetween: 10,
},
1024: {
slidesPerView: 5,
},
768: {
slidesPerView: 4,
},
640: {
slidesPerView: 3,
},
480: {
slidesPerView: 2,
spaceBetween: 20,
},
100: {
slidesPerView: 1,
spaceBetween: 20,
},
},
}); #}
/* function getDirection() {
var windowWidth = window.innerWidth;
var direction = window.innerWidth <= 760 ? 'vertical' : 'horizontal';
return direction;
} */
</script>
{% endblock %}