templates/home/pageprotocole.html.twig line 1

  1. {% extends 'base.html.twig' %}
  2. {% block title %}{{ protocole.titre }}{% endblock %}
  3. {% block stylesheets %}
  4.     <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x" crossorigin="anonymous" />
  5.     <link rel="stylesheet" href="{{ asset('assets/front/protocole.css') }}" />
  6. {% endblock %}
  7. {% block body %}
  8.     <div class="breadcrumb"><div class="container">
  9.         <a href="{{ path('home_page') }}">Accueil</a>&nbsp;        
  10.         {% if urls|length >0 %}
  11.             {% for url in urls %}
  12.                 {# {% set nom = "'" ~ url|lower ~ "'" %} #}
  13.                 {% set nom = url|lower %}
  14.                 /&nbsp;<a href="{{ path('categoriefiltrenom_page', {'type': 1, 'nom': nom }) }}">{{ url|capitalize  }}</a>&nbsp;
  15.             {% endfor %}
  16.         {% else %}
  17.             /&nbsp;<a href="{{ path('categoriefiltre_page', {'type': 1}) }}">Protocoles</a>&nbsp;
  18.         {% endif %}
  19.         /&nbsp;<a href="{{ path('protocole_page', { 'id' : protocole.id, 'nom': protocole.titre }) }}">{{ protocole.titre }}</a></div>
  20.     </div>
  21.     <div class="container-main pageprotocole">
  22.         <h1 class="titrevert-color margin-bottom-30">Protocole : {{ protocole.titre }}</h1> 
  23.         <br/>
  24.         <div class="protocole">
  25.             {# instruments #}  
  26.             <div>
  27.                 {% if protocole.urlvideo is not empty %}        
  28.                     <!-- https://www.youtube.com/watch?v=04JhVF_LLMY  width="560" height="315"   -->
  29.                     <!-- https://jsfiddle.net/thelevicole/5g6dbpx3/2/ https://www.youtube.com/watch?v=04JhVF_LLMY -->
  30.                     <div class="videocenter">           
  31.                         {% if 'youtube' in protocole.urlvideo %}  
  32.                             <iframe width="360px" height="259px" src="{{ protocole.urlvideo }}" frameborder="0" ></iframe>
  33.                         {% else %}
  34.                             <video width="360px" height="259px" src="{{ protocole.urlvideo }}" controls></video>
  35.                         {% endif %}
  36.                     </div>
  37.                 {% endif %}
  38.                 <form id="formMateriels" action="{{ path('addusermateriel_ajax', { 'id':0}) }}">
  39.                 <div class="instruments">
  40.                     <h2>Instruments nécessaires</h2>
  41.                     {% if protocole.materiels|length > 0 %}  
  42.                     
  43.                         {# Comptes des codes #}
  44.                         {% set nbP = 0 %}  
  45.                         {% set nbA = 0 %}  
  46.                         {% set nbM = 0 %} 
  47.                         {% for child in protocole.materiels|sort((a, b) => a.nom <=> b.nom)  %}
  48.                             {% if (child.codePA=='P' or child.codePA=='2') and child.archive==0 %}
  49.                                 {% set nbP = nbP+1 %}  
  50.                             {% elseif (child.codePA=='A' or child.codePA=='2') and child.archive==0 %}
  51.                                 {% set nbA = nbA+1 %}  
  52.                             {% elseif child.codePA=='M' and child.archive==0 %}
  53.                                 {% set nbM = nbM+1 %} 
  54.                             {% endif %}
  55.                         {% endfor %}    
  56.                         {# Plateau Praticien #}
  57.                         {% if nbP > 0 %}  
  58.                         <h3>Plateau praticien</h3>
  59.                         <ul>
  60.                             {% for child in protocole.materiels|sort((a, b) => a.nom <=> b.nom) %}
  61.                                 {% if (child.codePA=='P' or child.codePA=='2') and child.archive==0 %}
  62.                                     <li>
  63.                                         <input type="checkbox" class="choix matos" data-id="{{ child.id }}" 
  64.                                         {% if child.id in usermateriels %} checked {% endif %}
  65.                                         />
  66.                                         <a href="{{ path('materiel_page', {'id': child.id}) }}" target="_blank">{{ child.nom }}</a>
  67.                                         {% if child.kitmateriels|length >0 %} 
  68.                                         <ul class="kit">
  69.                                             {% for kit in child.kitmateriels|sort((a, b) => a.nom <=> b.nom)  %}
  70.                                             <li><i class="fas fa-chevron-right"></i>&nbsp;{{ kit.nom }}</li>
  71.                                             {% endfor %} 
  72.                                         </ul>
  73.                                         {% endif %}
  74.                                     </li>
  75.                                 {% endif %}
  76.                             {% endfor %}                
  77.                         </ul>
  78.                         <hr/>
  79.                         {% endif %}
  80.                         
  81.                         
  82.                         {# Plateau Assistante #}
  83.                         {% if nbA > 0 %}  
  84.                         <h3>Plateau assistante</h3>
  85.                         <ul>
  86.                             {% for child in protocole.materiels|sort((a, b) => a.nom <=> b.nom)  %}
  87.                                 {% if (child.codePA=='A' or child.codePA=='2') and child.archive==0 %}
  88.                                     <li>
  89.                                         <input type="checkbox" class="choix matos" data-id="{{ child.id }}" 
  90.                                         {% if child.id in usermateriels %} checked {% endif %}
  91.                                         />
  92.                                         <a href="{{ path('materiel_page', {'id': child.id}) }}" target="_blank">{{ child.nom }}</a>
  93.                                         {% if child.kitmateriels|length >0 %} 
  94.                                         <ul class="kit">
  95.                                             {% for kit in child.kitmateriels|sort((a, b) => a.nom <=> b.nom)  %}
  96.                                             <li><i class="fas fa-chevron-right"></i>&nbsp;{{ kit.nom }}</li>
  97.                                             {% endfor %} 
  98.                                         </ul>
  99.                                         {% endif %}
  100.                                     </li>
  101.                                 {% endif %}
  102.                             {% endfor %}                
  103.                         </ul>
  104.                         <hr/>
  105.                         {% endif %}
  106.                         
  107.                         {# Equipement #}
  108.                         {% if nbM > 0 %}  
  109.                         <h3>Equipement</h3>
  110.                         <ul>
  111.                             {% for child in protocole.materiels|sort((a, b) => a.nom <=> b.nom)  %}
  112.                                 {% if child.codePA=='M' and child.archive==0 %}
  113.                                     <input type="checkbox" class="choix matos" data-id="{{ child.id }}" 
  114.                                     {% if child.id in usermateriels %} checked {% endif %}
  115.                                     />
  116.                                     <li><a href="{{ path('materiel_page', {'id': child.id}) }}" target="_blank">{{ child.nom }}</a></li>
  117.                                 {% endif %}
  118.                             {% endfor %}                
  119.                         </ul>
  120.                         <hr/>
  121.                         {% endif %}
  122.                         
  123.                         {% if protocole.materiels|length > 0 %}  
  124.                             <div class="text-center">
  125.                             <button class="bleuclair" >Ajouter à ma sélection</button>   
  126.                             <p style="font-size:12px; font-style:italic; margin-top:10px;">
  127.                             Les instruments sélectionnés sont accessibles <br/>
  128.                             depuis la page de <a href="{{ path('infoscompte_page') }}" style="font-size:12px">votre compte</a>
  129.                             </p>         
  130.                             </div>                    
  131.                         {% endif %}
  132.                     {% else %} 
  133.                     <p><i>Pas d'instrument</i></p>
  134.                     {% endif %} 
  135.                 </div>
  136.                 </form>
  137.                 {% if protocole.protocoleinstrimgs|length > 0 %}   
  138.                 {% set indeximg = 1 %}
  139.                 <div class="btn-images">                    
  140.                     {% for instrimg in protocole.protocoleinstrimgs %}       
  141.                         {% if indeximg < 10  %}   
  142.                             <div><img src="{{ asset('download/') }}{{ instrimg.image.urlfichier }}" title="{{ instrimg.image.legende }}"
  143.                                     id="img{{ instrimg.image.id }}" onclick="clickImage( {{ instrimg.image.id }}, false)" /> </div>
  144.                             {% set indeximg = indeximg +1 %}
  145.                         {% endif %}
  146.                     {% endfor %}                     
  147.                 </div>
  148.                 {% endif %}
  149.             </div>
  150.             {# protocole #}
  151.             <div class="deroule">
  152.                 {# <h2>{{ protocole.titre }}</h2> #}
  153.                 <div class="grid">   
  154.                  {# photos #}
  155.                     {% if protocolephotos|length > 0 %}  
  156.                     <div class="photos">
  157.                         {% for child in protocolephotos %}
  158.                             <div><img src="{{ asset('download/') }}{{ child.image.urlfichier }}" id="img{{ child.image.id }}" onclick="clickImage({{ child.image.id }})" /></div>
  159.                             <p class="legend" id="legend{{ child.image.id }}" >{{ child.image.legende }}</p>
  160.                         {% endfor %}
  161.                     
  162.                     </div>
  163.                     {% endif %}
  164.                     {# deroulé  #}
  165.                     <div class="deroule-protocole">
  166.                         <h2>Le protocole</h2>
  167.                         {{ protocole.protocole|raw }}
  168.                         {% if is_granted('ROLE_USER') %} 
  169.                         {% if isFavori == true %}
  170.                             <form id="formMateriels" action="{{ path('removeuserprotocole_ajax', {'id': protocole.id }) }}" method="post">
  171.                             <button class="clair small" id="addFavori">Retirer de mes favoris <i class="fas fa-star" style="color:#FDD46A"></i></button>
  172.                             </form>
  173.                             <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>
  174.                         {% else %}
  175.                             <form id="formMateriels" action="{{ path('adduserprotocole_ajax', {'id': protocole.id }) }}" method="post">
  176.                             <button class="clair small" id="addFavori" >Ajouter à mes favoris <i class="far fa-star"></i></button>
  177.                             </form>
  178.                         {% endif %}
  179.                         {% endif %}
  180.                     </div>     
  181.                 </div>
  182.             </div>
  183.         
  184.         </div>
  185.     </div>
  186.     {# actes associés, administration et information  #} 
  187.     <section class="sectiononglets">       
  188.     <div class="container pageprotocole">
  189.         <div class="onglets">
  190.             <div class="ongletsbuttons">
  191.                 <button class="btnlinks active" onclick="openOnglet(event, 'administration')">Astuces</button>
  192.                 <button class="btnlinks" onclick="openOnglet(event, 'actesassocies')">Actes associés</button>
  193.                 <button class="btnlinks" onclick="openOnglet(event, 'information')">Informations</button>
  194.             </div>
  195.             <div>
  196.             <div id="administration" class="ongletcontent active">
  197.                     <div>
  198.                         <div class="padding-30">{{ protocole.administration|raw }}</div>
  199.                     </div>                   
  200.                 </div> 
  201.                 <div id="actesassocies" class="ongletcontent ">
  202.                     <div>
  203.                        <div class="padding-0-30"> 
  204.                        {% if protocole.categoriesassocies|length > 0 %}  
  205.                         <h3 class="text-left margin-bottom-0 padding-0 margin-top-30">Catégories associées</h3>
  206.                         <ul>
  207.                             {% for child in protocole.categoriesassocies %}
  208.                                 <li>
  209.                                     <a href="{{ path('categoriefiltre_page', {'type': 1, 'code':child.id}) }}">{{ child.titre }}</a>
  210.                                   
  211.                                 </li>
  212.                             {% endfor %}                
  213.                         </ul>
  214.                         {% endif %}
  215.                         {% if protocole.actesassocies|length > 0 %}  
  216.                         <h3 class="text-left margin-bottom-0 padding-0 margin-top-30">Protocoles associés</h3>
  217.                         <ul>
  218.                             {% for child in protocole.actesassocies %}
  219.                                 <li>
  220.                                     <a href="{{ path('protocole_page', {'id':child.id, 'nom':child.titre}) }}">{{ child.titre }}</a>
  221.                                     {% if child.resume|length >0 %} <p>{{ child.resume }}</p>{% endif %}
  222.                                 </li>
  223.                             {% endfor %}                
  224.                         </ul>
  225.                         {% endif %}
  226.                        </div>
  227.                        <br/>
  228.                     </div>                    
  229.                 </div>              
  230.                 <div id="information" class="ongletcontent">
  231.                     <div>
  232.                         <div class="padding-30">{{ protocole.information|raw }}</div>
  233.                     </div>                    
  234.                 </div>   
  235.             </div>                  
  236.         </div>
  237.     </div>
  238.     </section>
  239.     <!-- Commentaire -->
  240.     <section class="commentaires" style="background-image: url('{{ asset('assets/img/comments-cover.jpg') }}');">  
  241.         <div class="container">
  242.             <h2>Commentaires</h2>
  243.             {% for commentaire in commentaires %}
  244.                 <div class="commentaire">
  245.                     <p class="dateuser">Le {{ commentaire.datepubli|date('d/m/Y') }} par {{ commentaire.auteur.prenom }} {{ commentaire.auteur.nom }}</p>
  246.                     <p class="comment">{{ commentaire.comment }}</p>
  247.                 </div>
  248.             {% else %}
  249.                 <p class="nocomment">Aucun commentaire</p>
  250.             {% endfor %}
  251.             {% if is_granted('ROLE_USER') and app.user.isVerified %} 
  252.                 <div class="newcommentaire">
  253.                 {{ form_start(form) }}
  254.                     {{ form_widget(form) }}
  255.                     <button class="btn-send">{{ button_label|default('Envoyer') }}</button>
  256.                 {{ form_end(form) }}
  257.                 </div>
  258.             {% endif %}
  259.         </div>
  260.     </section>
  261.     <!-- la fenêtre popup modale -->
  262.     <div id="myModal" class="modal">
  263.     <div class="modal-content">
  264.         <span class="close" id="modalClose">&times;</span>
  265.         <img id="bigimage" />
  266.         <p id="biglegend"></p>
  267.     </div>
  268.     </div>
  269.    
  270. {% endblock %}
  271. {% block javascripts %}
  272.     <script>
  273.         //gestion des onglets
  274.         function openOnglet(evt, cityName) {
  275.             let i, tabcontent, tablinks;
  276.             tabcontent = document.getElementsByClassName("ongletcontent");
  277.             for (i = 0; i < tabcontent.length; i++) {
  278.                 tabcontent[i].className = tabcontent[i].className.replace(" active", "");
  279.             }
  280.             tablinks = document.getElementsByClassName("btnlinks");
  281.             for (i = 0; i < tablinks.length; i++) {
  282.                 tablinks[i].className = tablinks[i].className.replace(" active", "");
  283.                 
  284.             }
  285.             document.getElementById(cityName).className += " active";
  286.             evt.currentTarget.className += " active";
  287.         }
  288.         //ajout des matériel en favori
  289.         let formMateriels = document.getElementById("formMateriels");
  290.         formMateriels.addEventListener("submit", function(e) {
  291.             e.preventDefault(); 
  292.             //url d'ajout du materiel
  293.             let url=formMateriels.action;  //console.log(url );
  294.             
  295.             //parcourt la liste des materiels
  296.             let inputs = formMateriels.getElementsByClassName("matos");
  297.             for(let i = 0; i < inputs.length; i++) {
  298.                 if(inputs[i].checked == true) {
  299.                     
  300.                     console.log(url + inputs[i].dataset.id );
  301.                     fetch( url + inputs[i].dataset.id );
  302.                 }
  303.             }
  304.         });
  305.         //ouverture de la fenetre modale sur clic de l'image
  306.         let modal = document.getElementById("myModal");
  307.         function clickImage(id, aveclegend=true) { 
  308.             //recup de l'image mis en data
  309.             let image = document.getElementById('img'+id).src;  
  310.             let legend = "";
  311.             if(aveclegend) {
  312.                 legend = document.getElementById('legend'+id).textContent; 
  313.             }
  314.             else {
  315.                 legend = document.getElementById('img'+id).title; 
  316.             }
  317.             document.getElementById('bigimage').src = image;           
  318.             document.getElementById('biglegend').textContent = legend;  
  319.             modal.style.display = "block";
  320.         }
  321.         // Fermeture de la fenêtre modale
  322.         document.getElementById('modalClose').onclick = function() {
  323.             modal.style.display = "none";
  324.         }
  325.         window.onclick = function(event) {
  326.             if (event.target == modal) {
  327.                 modal.style.display = "none";
  328.             }
  329.         }
  330.     
  331.     </script> 
  332. {% endblock %}