templates/recherche/carteCentre.html.twig line 1

Open in your IDE?
  1. {% if centres | length != 0 %}
  2.     {% for centre in centres %}
  3.     <div class="card" id="{{centre.id}}" data-latitude="{{centre.latitude}}" data-longitude="{{centre.longitude}}">
  4.         <div class="row">
  5.             <div class="col-md-3 containerInfo">
  6.                 <img class="imgCentre imgCentreClick " src="{{BASE_API}}centre/image/{{centre.id}}" alt="{{centre.name}}" onclick='goToCentre({{centre.id}},"{{centre.city}}","{{centre.postale}}","{{centre.slug}}")' />
  7.                 <div class="note">
  8.                     <span>{{centre.averageRating}}/5</span>
  9.                     <span class="material-icons">star</span>
  10.                     <span>({{centre.nbrReview}})</span>
  11.                 </div>
  12.             </div>
  13.             <div class="col-md-9 containerCentre">
  14.                 <span class="centreName centreNameClick" onclick='goToCentre({{centre.id}},"{{centre.city}}","{{centre.postale}}","{{centre.slug}}")'>{{centre.name}}</span>
  15.                 <div class="row">
  16.                     <div class="col-md-6 containerAudioChoice">
  17.                         <select id="audioCentre{{centre.id}}" data-centre="{{centre.id}}"  onchange="changeHoraireAudio(this)" class="audioCentre form-select" name="audioCentre{{centre.id}}">
  18.                             {% set i = 0 %}
  19.                             {% for audio in centre.audio %}
  20.                                 <option value="{{audio.id}}" {% if i == 0 %} selected {% endif %}>{{audio.lastname}} {{audio.name}}</option>
  21.                                 {% set i = i + 1 %}
  22.                             {% endfor %}
  23.                         </select>
  24.                         
  25.                     </div>
  26.                     <div class="col-md-6 containerAdresse">
  27.                         <p class="adresse">{{centre.address}}</p>
  28.                         <p class="CP">{{centre.postale}} {{centre.city}}</p>
  29.                     </div> 
  30.                 </div>
  31.             </div>
  32.         </div>
  33.         <div class="row avaibility-row">
  34.             {% set i = 0 %}
  35.             {% for audio in centre.audio %}
  36.                 <!-- Modify your motif select box -->
  37.                 <select class="form-select motif-select mot{{centre.id}}" data-id="{{centre.id}}" id="motif{{audio.id}}{{centre.id}}" data-audio-id="{{audio.id}}" onchange="changeHoraire({{audio.id}}, {{centre.id}})" {% if loop.first %} {% else %}style="display: none;"{% endif %}>
  38.                     <option hidden style="text-align:center;">Choisissez votre motif de consultation</option>
  39.                     {% for motif in audio.motifs %}
  40.                     {% if motif.isRdvonline and motif.titre != "Rendez-vous pro externe" and motif.titre != "Google Agenda" and motif.titre != "Suivie de l’essai" and motif.titre != "Confirmation de l’essai" and motif.titre != "Validation de l’appareillage" and motif.titre != "Facturation de l’appareillage" %}
  41.                         <option value="{{motif.id}}-{{motif.duration}}" data-duration="">{{motif.titre}} </option>
  42.                         {% endif %}
  43.                     {% endfor %}
  44.                 </select>
  45.                 <!-- Enclose the select within a div with a common class -->
  46.                 <div class="motif-container mot{{centre.id}}" id="motif-container{{audio.id}}" {% if loop.first %} {% else %}style="display: none;"{% endif %}>
  47.                     <!-- Your other elements and code here -->
  48.                     <div class="row avaibility-row">
  49.                         <div class="choixMotif mapChoice" id="choixMotif{{audio.id}}{{centre.id}}" style="display:none">Veuillez choisir un motif de consultation</div>
  50.                         <div id="avaibility{{audio.id}}{{centre.id}}" data-audio="{{audio.id}}" data-centre="{{centre.id}}" class="avaibility-container avaibility{{centre.id}} col-md-12"></div>
  51.                         <div class="loading-container" id="loading{{audio.id}}{{centre.id}}" style="display:none;">
  52.                             <img class="loading" src="/assets/img/recherche/loading.gif" alt="loading" />
  53.                         </div>
  54.                                                 <div id="alertDate{{audio.id}}{{centre.id}}" style="display:none" class="alertDate">Veuillez sélectionner un horaire</div>
  55. <div class="btnMap">                      
  56.                         <button class="prendreRDV btn btn-vert-inverse" id="rdv{{audio.id}}"  onclick="encodeAndCallVerificationSelection({{audio.id}}, {{centre.id}}, '{{centre.name|replace({'\'' : '\\\''})}}','{{audio.lastname}} {{audio.name}}');">Je prends RDV</button>
  57.                     </div>
  58.                     </div>
  59.                 </div>
  60.                 {% set i = i + 1 %}
  61.             {% endfor %}
  62.             
  63. <!-- Modal confirmatio info RDV -->
  64.     
  65.     </div></div>
  66.     <script>
  67.  var dateSelectionne = "";
  68.     {% set i = 0 %}
  69.     {% for audio in centre.audio %}
  70.         {% if i == 0 %}
  71.            dispo =  {{audio.schedule | json_encode() | raw}};
  72.             dispoSplit = getTimeAvailable(dispo);
  73.             dispoSplit = addEmptyTime(dispoSplit);
  74.             nextHtml = getChevronNext('{{audio.id}}');
  75.             prevHtml = getChevronPrev('{{audio.id}}');
  76.             initCalendar('{{audio.id}}','{{centre.id}}', dispoSplit);
  77.             $(".precedent").css("display","none");
  78.             $(".available-time-hide").css("display","none");
  79.     
  80.         {% endif %}
  81.         {% set i = i + 1 %}
  82.     {% endfor %}
  83.     var image = { 
  84.         url:"./assets/img/recherche/pointer.png",
  85.         scaledSize: new google.maps.Size(33,47), // scaled size
  86.     };
  87.     lati = "{{centre.latitude}}";// On récupère la latitude
  88.     lon = "{{centre.longitude}}"; // On récupère la longitude
  89.     var pos = {
  90.         lat: lati,
  91.         lng: lon
  92.     };
  93.     point = new google.maps.LatLng(lati, lon);
  94.     optionsMarqueur = {
  95.         position: point,
  96.         icon: image,
  97.         map: map,
  98.         animation: google.maps.Animation.DROP
  99.     }
  100.     marqueur = new google.maps.Marker(optionsMarqueur);
  101.     contenue = '<a href="#{{centre.id}}" onclick="cacherMap();"><img class="imgCentre" src="{{BASE_API}}centre/image/{{centre.id}}" alt="{{centre.name}}" style="width:120px; height:120px; object-fit:contain;"/></a>';
  102.     bindInfoWindow(marqueur, contenue);
  103.  function changeHoraire(audio_id, centre_id){
  104.  
  105.     $("#loading"+audio_id).css("display","flex");
  106.     $("#choixMotif"+audio_id+centre_id).css("display","none");
  107.     value = document.getElementById("motif"+audio_id).value;
  108.     id  = value.split('-')[0];
  109.     motifDuration = parseInt(value.split('-')[1]);
  110.     datetime = dateFormat(new Date(), "dd/mm/yyyy").toString();
  111.     getHoraire(audio_id,centre_id, datetime);
  112.     dateSelectionne = "";
  113.     $("#loading"+audio_id+centre_id).css("display","none");
  114.     $(".alertDate").css("display","none");
  115. }
  116. // Add an event listener to each audio select box
  117. $('.audioCentre').on('change', function () {
  118.     // Get the selected audio ID
  119.     var selectedAudioId = $(this).val();
  120.     var center = $(this).attr('data-centre');
  121.     console.log(center);
  122.     // Hide all motif select boxes
  123.     $('.mot'+center).hide();
  124.     // Show the motif select box corresponding to the selected audio
  125.     $('#motif' + selectedAudioId).show();
  126.     $('#motif-container' + selectedAudioId).show();
  127. });
  128. function encodeAndCallVerificationSelection(audio_id, centre_id, centre_name, audio_name) {
  129.     var motifFirst = $("#motif"+audio_id+centre_id+" option:selected").text();
  130.     if(motifFirst === "Choisissez votre motif de consultation"){
  131. $("#choixMotif"+audio_id+centre_id).show();
  132.     }
  133.     else{
  134.     //alert(motifFirst);
  135.     var encodedCentreName = encodeURIComponent(centre_name);
  136.     var encodedAudioName = encodeURIComponent(audio_name);
  137.     verificationSelection(audio_id, centre_id, encodedCentreName, encodedAudioName);
  138.     }
  139. }
  140. function verificationSelection(audio_id, centre_id, centre_name, audio_name) {
  141.     var decodedCentreName = decodeURIComponent(centre_name);
  142.     var decodedAudioName = decodeURIComponent(audio_name);
  143.     // Now you can use the decodedCentreName as needed
  144.     if (dateSelectionne !== "") {
  145.         if (getCookie('token') === "" || getCookie('token') === null) {
  146.             rendezVousEnCours = 1;
  147.             audioIDSelectionne = audio_id;
  148.             $('#loginModal').modal('show');     
  149.            // alert("sel");
  150.            
  151.         } else {
  152.             $("#loadingRDV").css("display", "flex");
  153.             rendezVousEnCours = 1;
  154.             infoRdvHtmlMotif(audio_id, centre_id, decodedCentreName, decodedAudioName);    
  155.         }
  156.     } else {
  157.         $("#alertDate" + audio_id + centre_id).css("display", "block");
  158.     }
  159.      $(document).on('hidden.bs.modal', '#loginModal', function () {
  160.        //alert("lgoin");
  161.         if (rendezVousEnCours == 1 && getCookie('token') != "" && getCookie('token') != null ){
  162.  $("#loadingRDV").css("display", "flex");
  163.             rendezVousEnCours = 1;
  164.             infoRdvHtmlMotif(audio_id, centre_id, decodedCentreName, decodedAudioName);         }
  165.       })
  166. }
  167. function audioActif(id){
  168.     audios = document.getElementsByClassName('audioInfo');
  169.     for (audio of audios){
  170.         audio.classList.remove("actif");
  171.     }
  172.     audio_actif_id = id;
  173.     document.getElementById(id).classList.add("actif");
  174.     changeHoraireAudio(id);
  175.     
  176. }
  177.     </script>
  178.     <style>
  179.     .gm-style .gm-style-iw-c{
  180.         padding:0 !important;
  181.             border: 1px solid #E2E2E2 !important;
  182.     }
  183.     .gm-style-iw-d{
  184.         overflow:hidden !important;
  185.     }
  186.     button.gm-ui-hover-effect img {
  187.         display: none !important;
  188.     }
  189.     </style>
  190.     {% endfor %}
  191. {% else  %}
  192. {% endif %}