templates/home/pageprotocole.html.twig line 1
{% extends 'base.html.twig' %}
{% block title %}{{ protocole.titre }}{% endblock %}
{% block stylesheets %}
<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') }}" />
{% 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 ~ "'" %} #}
{% set nom = url|lower %}
/ <a href="{{ path('categoriefiltrenom_page', {'type': 1, 'nom': nom }) }}">{{ url|capitalize }}</a>
{% endfor %}
{% else %}
/ <a href="{{ path('categoriefiltre_page', {'type': 1}) }}">Protocoles</a>
{% endif %}
/ <a href="{{ path('protocole_page', { 'id' : protocole.id, 'nom': protocole.titre }) }}">{{ protocole.titre }}</a></div>
</div>
<div class="container-main pageprotocole">
<h1 class="titrevert-color margin-bottom-30">Protocole : {{ protocole.titre }}</h1>
<br/>
<div class="protocole">
{# instruments #}
<div>
{% if protocole.urlvideo is not empty %}
<!-- https://www.youtube.com/watch?v=04JhVF_LLMY width="560" height="315" -->
<!-- https://jsfiddle.net/thelevicole/5g6dbpx3/2/ https://www.youtube.com/watch?v=04JhVF_LLMY -->
<div class="videocenter">
{% if 'youtube' in protocole.urlvideo %}
<iframe width="360px" height="259px" src="{{ protocole.urlvideo }}" frameborder="0" ></iframe>
{% else %}
<video width="360px" height="259px" src="{{ protocole.urlvideo }}" controls></video>
{% endif %}
</div>
{% endif %}
<form id="formMateriels" action="{{ path('addusermateriel_ajax', { 'id':0}) }}">
<div class="instruments">
<h2>Instruments nécessaires</h2>
{% if protocole.materiels|length > 0 %}
{# Comptes des codes #}
{% set nbP = 0 %}
{% set nbA = 0 %}
{% set nbM = 0 %}
{% for child in protocole.materiels|sort((a, b) => a.nom <=> b.nom) %}
{% if (child.codePA=='P' or child.codePA=='2') and child.archive==0 %}
{% set nbP = nbP+1 %}
{% elseif (child.codePA=='A' or child.codePA=='2') and child.archive==0 %}
{% set nbA = nbA+1 %}
{% elseif child.codePA=='M' and child.archive==0 %}
{% set nbM = nbM+1 %}
{% endif %}
{% endfor %}
{# Plateau Praticien #}
{% if nbP > 0 %}
<h3>Plateau praticien</h3>
<ul>
{% for child in protocole.materiels|sort((a, b) => a.nom <=> b.nom) %}
{% if (child.codePA=='P' or child.codePA=='2') and child.archive==0 %}
<li>
<input type="checkbox" class="choix matos" data-id="{{ child.id }}"
{% if child.id in usermateriels %} checked {% endif %}
/>
<a href="{{ path('materiel_page', {'id': child.id}) }}" target="_blank">{{ child.nom }}</a>
{% if child.kitmateriels|length >0 %}
<ul class="kit">
{% for kit in child.kitmateriels|sort((a, b) => a.nom <=> b.nom) %}
<li><i class="fas fa-chevron-right"></i> {{ kit.nom }}</li>
{% endfor %}
</ul>
{% endif %}
</li>
{% endif %}
{% endfor %}
</ul>
<hr/>
{% endif %}
{# Plateau Assistante #}
{% if nbA > 0 %}
<h3>Plateau assistante</h3>
<ul>
{% for child in protocole.materiels|sort((a, b) => a.nom <=> b.nom) %}
{% if (child.codePA=='A' or child.codePA=='2') and child.archive==0 %}
<li>
<input type="checkbox" class="choix matos" data-id="{{ child.id }}"
{% if child.id in usermateriels %} checked {% endif %}
/>
<a href="{{ path('materiel_page', {'id': child.id}) }}" target="_blank">{{ child.nom }}</a>
{% if child.kitmateriels|length >0 %}
<ul class="kit">
{% for kit in child.kitmateriels|sort((a, b) => a.nom <=> b.nom) %}
<li><i class="fas fa-chevron-right"></i> {{ kit.nom }}</li>
{% endfor %}
</ul>
{% endif %}
</li>
{% endif %}
{% endfor %}
</ul>
<hr/>
{% endif %}
{# Equipement #}
{% if nbM > 0 %}
<h3>Equipement</h3>
<ul>
{% for child in protocole.materiels|sort((a, b) => a.nom <=> b.nom) %}
{% if child.codePA=='M' and child.archive==0 %}
<input type="checkbox" class="choix matos" data-id="{{ child.id }}"
{% if child.id in usermateriels %} checked {% endif %}
/>
<li><a href="{{ path('materiel_page', {'id': child.id}) }}" target="_blank">{{ child.nom }}</a></li>
{% endif %}
{% endfor %}
</ul>
<hr/>
{% endif %}
{% if protocole.materiels|length > 0 %}
<div class="text-center">
<button class="bleuclair" >Ajouter à ma sélection</button>
<p style="font-size:12px; font-style:italic; margin-top:10px;">
Les instruments sélectionnés sont accessibles <br/>
depuis la page de <a href="{{ path('infoscompte_page') }}" style="font-size:12px">votre compte</a>
</p>
</div>
{% endif %}
{% else %}
<p><i>Pas d'instrument</i></p>
{% endif %}
</div>
</form>
{% if protocole.protocoleinstrimgs|length > 0 %}
{% set indeximg = 1 %}
<div class="btn-images">
{% for instrimg in protocole.protocoleinstrimgs %}
{% if indeximg < 10 %}
<div><img src="{{ asset('download/') }}{{ instrimg.image.urlfichier }}" title="{{ instrimg.image.legende }}"
id="img{{ instrimg.image.id }}" onclick="clickImage( {{ instrimg.image.id }}, false)" /> </div>
{% set indeximg = indeximg +1 %}
{% endif %}
{% endfor %}
</div>
{% endif %}
</div>
{# protocole #}
<div class="deroule">
{# <h2>{{ protocole.titre }}</h2> #}
<div class="grid">
{# photos #}
{% if protocolephotos|length > 0 %}
<div class="photos">
{% for child in protocolephotos %}
<div><img src="{{ asset('download/') }}{{ child.image.urlfichier }}" id="img{{ child.image.id }}" onclick="clickImage({{ child.image.id }})" /></div>
<p class="legend" id="legend{{ child.image.id }}" >{{ child.image.legende }}</p>
{% endfor %}
</div>
{% endif %}
{# deroulé #}
<div class="deroule-protocole">
<h2>Le protocole</h2>
{{ protocole.protocole|raw }}
{% if is_granted('ROLE_USER') %}
{% if isFavori == true %}
<form id="formMateriels" action="{{ path('removeuserprotocole_ajax', {'id': protocole.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('adduserprotocole_ajax', {'id': protocole.id }) }}" method="post">
<button class="clair small" id="addFavori" >Ajouter à mes favoris <i class="far fa-star"></i></button>
</form>
{% endif %}
{% endif %}
</div>
</div>
</div>
</div>
</div>
{# actes associés, administration et information #}
<section class="sectiononglets">
<div class="container pageprotocole">
<div class="onglets">
<div class="ongletsbuttons">
<button class="btnlinks active" onclick="openOnglet(event, 'administration')">Astuces</button>
<button class="btnlinks" onclick="openOnglet(event, 'actesassocies')">Actes associés</button>
<button class="btnlinks" onclick="openOnglet(event, 'information')">Informations</button>
</div>
<div>
<div id="administration" class="ongletcontent active">
<div>
<div class="padding-30">{{ protocole.administration|raw }}</div>
</div>
</div>
<div id="actesassocies" class="ongletcontent ">
<div>
<div class="padding-0-30">
{% if protocole.categoriesassocies|length > 0 %}
<h3 class="text-left margin-bottom-0 padding-0 margin-top-30">Catégories associées</h3>
<ul>
{% for child in protocole.categoriesassocies %}
<li>
<a href="{{ path('categoriefiltre_page', {'type': 1, 'code':child.id}) }}">{{ child.titre }}</a>
</li>
{% endfor %}
</ul>
{% endif %}
{% if protocole.actesassocies|length > 0 %}
<h3 class="text-left margin-bottom-0 padding-0 margin-top-30">Protocoles associés</h3>
<ul>
{% for child in protocole.actesassocies %}
<li>
<a href="{{ path('protocole_page', {'id':child.id, 'nom':child.titre}) }}">{{ child.titre }}</a>
{% if child.resume|length >0 %} <p>{{ child.resume }}</p>{% endif %}
</li>
{% endfor %}
</ul>
{% endif %}
</div>
<br/>
</div>
</div>
<div id="information" class="ongletcontent">
<div>
<div class="padding-30">{{ protocole.information|raw }}</div>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- 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" />
<p id="biglegend"></p>
</div>
</div>
{% endblock %}
{% block javascripts %}
<script>
//gestion des onglets
function openOnglet(evt, cityName) {
let i, tabcontent, tablinks;
tabcontent = document.getElementsByClassName("ongletcontent");
for (i = 0; i < tabcontent.length; i++) {
tabcontent[i].className = tabcontent[i].className.replace(" active", "");
}
tablinks = document.getElementsByClassName("btnlinks");
for (i = 0; i < tablinks.length; i++) {
tablinks[i].className = tablinks[i].className.replace(" active", "");
}
document.getElementById(cityName).className += " active";
evt.currentTarget.className += " active";
}
//ajout des matériel en favori
let formMateriels = document.getElementById("formMateriels");
formMateriels.addEventListener("submit", function(e) {
e.preventDefault();
//url d'ajout du materiel
let url=formMateriels.action; //console.log(url );
//parcourt la liste des materiels
let inputs = formMateriels.getElementsByClassName("matos");
for(let i = 0; i < inputs.length; i++) {
if(inputs[i].checked == true) {
console.log(url + inputs[i].dataset.id );
fetch( url + inputs[i].dataset.id );
}
}
});
//ouverture de la fenetre modale sur clic de l'image
let modal = document.getElementById("myModal");
function clickImage(id, aveclegend=true) {
//recup de l'image mis en data
let image = document.getElementById('img'+id).src;
let legend = "";
if(aveclegend) {
legend = document.getElementById('legend'+id).textContent;
}
else {
legend = document.getElementById('img'+id).title;
}
document.getElementById('bigimage').src = image;
document.getElementById('biglegend').textContent = legend;
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>
{% endblock %}