templates/components/google_avis.html.twig line 1

Open in your IDE?
  1. <style>
  2. @media screen and (max-width: 480px) {
  3.     .row .note-google .jq-star{
  4.         width: 30px !important;
  5.         height: 30px !important;
  6.     }
  7.     .note-google h2{
  8.         font-size: 24px !important;
  9.     }
  10. }
  11. @media screen and (max-width: 1700px) {
  12.     .note-google .jq-star{
  13.         width: 40px !important;
  14.         height: 40px !important;
  15.     }
  16. }
  17. .note-google h2{
  18.     font-size: 32px 
  19. }
  20. </style>
  21. <section class=" p-20"
  22.     style="background-color:{{centreGroupe.centregroupecss.bg1}};border-bottom: 1px solid rgba(120,130,140,0.13);">
  23.     <div class="row">
  24.         <div class={{centre.ctrparametrecentre.pcavisgoogle ? "col-lg-4" :"col-lg-6"}}>
  25.             <h2 class="PN-Black PN-color1">
  26.                 Coordonnées
  27.             </h2>
  28.             {# <div id="map_{{key}}" style="height: 500px; width:100%"></div> #}
  29.             {% if array_centres[key]['avis']['result'] is defined %}
  30.                 <iframe
  31.                         src="https://maps.google.com/maps?&q={{array_centres[key].avis.result.name|replace({' ' : '+'})}},{{array_centres[key].avis.result.formatted_address|replace({' ' : '+'})}}&output=embed"
  32.                         width="100%" height="500px"></iframe>
  33.             {% endif %}
  34.         </div>
  35.         <div class={% if centre.ctrparametrecentre.pcavisgoogle %} "col-lg-3 p-t-30" {% else %} "col-lg-6 p-t-30" {%
  36.             endif %}>
  37.             <h4 class="PN-Black PN-color1">Adresse</h4>
  38.             <p class=" PN-color1">
  39.                 {{centre.ctradresse.adrrue}} <br>
  40.                 {% if centre.ctradresse.adrcomplement %}
  41.                     {{centre.ctradresse.adrcomplement}} <br>
  42.                 {% endif %}
  43.                 {{centre.ctradresse.adrcodepostal}} {{centre.ctradresse.adrville}}
  44.             </p>
  45.             <h4 class="PN-Black PN-color1 p-t-20">Contact</h4>
  46.             <a href="tel:{{centre.ctrtelephone}}">
  47.                 <h4 class="PN-color1"><span class="mdi mdi-phone mdi-rotate-45"> </span>{{centre.ctrtelephone}}</h4>
  48.             </a>
  49.             <a href="mailto:{{centre.ctremail}}">
  50.                 <h4 class="PN-color1"><span class="mdi mdi-email"> </span>{{centre.ctremail}}</h4>
  51.             </a>
  52.             <h4 class="PN-Black PN-color1 p-t-20">Horaires</h4>
  53.             {% set trans_day_hash = {
  54.             "Monday": "Lundi",
  55.             "Tuesday": "Mardi",
  56.             "Wednesday": "Mercredi",
  57.             "Thursday": "Jeudi",
  58.             "Friday": "Vendredi",
  59.             "Saturday": "Samedi",
  60.             "Sunday": "Dimanche"
  61.             }
  62.             %}
  63.             {% for key1,row in array_centres[key]['Horaires'] %}
  64.                 {% if row.matin.ouvert or row.apres_midi.ouvert %}
  65.                     <h4 class=" 0-0 {% if trans_day_hash[" now"|date('l')]==key1 %} text-info {% else %} PN-color1 {% endif %}">
  66.                     {{key1}} : <span class="  ">
  67.                     {% if row.matin.ouvert %}
  68.                         {{row.matin.ouverture|date("H:i")}}
  69.                         {% if row.apres_midi.ouverture|date("H:i") != row.matin.fermeture|date("H:i") or row.apres_midi.ouvert == false%}
  70.                             - {{row.matin.fermeture|date("H:i")}}
  71.                         {% endif %}
  72.                         {% if row.apres_midi.ouvert and row.apres_midi.ouverture|date("H:i") != row.matin.fermeture|date("H:i") %}
  73.                             et
  74.                         {% endif %}
  75.                     {% endif %}
  76.                     {% if row.apres_midi.ouvert %}
  77.                         {% if row.apres_midi.ouverture|date("H:i") != row.matin.fermeture|date("H:i") or row.matin.ouvert == false %}
  78.                             {{row.apres_midi.ouverture|date("H:i")}}
  79.                         {% endif %}
  80.                         - {{row.apres_midi.fermeture|date("H:i")}}
  81.                     {% endif %}
  82.                     </span></h4>
  83.                 {% endif %}
  84.             {% endfor %}
  85.         </div>
  86.         {% if centre.ctrparametrecentre.pcavisgoogle %}
  87.         <div class="col-lg-5 row">
  88.             <div class="col-lg-12">
  89.                 <h2 class="PN-Black PN-color1 m-b-20">
  90.                     Ce que pensent nos clients sur google
  91.                 </h2>
  92.             </div>
  93.             <div class="col-lg-12">
  94.                 <h4 class="PN-Black PN-color1">
  95.                     {% if array_centres[key]['avis'] %}
  96.                         {% if array_centres[key]['avis']['result'] is defined %}
  97.                             {{array_centres[key]['avis']['result']['name']}}
  98.                         {% endif %}
  99.                     {% endif %}
  100.                 </h4>
  101.             </div>
  102.             <div class="rating col-lg-8 d-flex align-items-center note-google">
  103.                 <h2 class="PN-Black PN-color1 p-r-10">
  104.                     {% if array_centres[key]['avis'] %}
  105.                         {% if array_centres[key]['avis']['result'] is defined %}
  106.                             {{array_centres[key]['avis']['result']['rating']}}</h2>
  107.                         {% endif %}
  108.                     {% endif %}
  109.                 <div class="stars_{{key}} p-r-10"></div>
  110.                 <div>
  111.                     <h4 class=" PN-color1 p-r-20">
  112.                         {% if array_centres[key]['avis'] %}
  113.                             {% if array_centres[key]['avis']['result'] is defined %}
  114.                                 {{array_centres[key]['avis']['result']['user_ratings_total']}} Avis</h4>
  115.                             {% endif %}
  116.                         {% endif %}
  117.                 </div>
  118.             </div>
  119.             <div class="col-lg-4">
  120.                 {% if array_centres[key]['avis'] %}
  121.                     {% if array_centres[key]['avis']['result'] is defined %}
  122.                         <a href="{{array_centres[key]['avis']['result']['url']}}" target="_blank"
  123.                            class="btn btn-outline-custom-bg2 PN-colorbg1 btn-rounded p-l-20 border-0"
  124.                            style="font-size: 15px;background-color: white;color:{{centreGroupe.centregroupecss.bg1}}">
  125.                         <span style="display: flex;align-items: center;"> Plus d'avis
  126.                             <i class="mdi mdi-open-in-new mdi-24px"></i></span>
  127.                         </a>
  128.                     {% endif %}
  129.                 {% endif %}
  130.             </div>
  131.             <div class="col-lg-12 row p-t-20" style="display: flex;justify-content: flex-end;">
  132.                 {% set nb_reviews = 0 %}
  133.                 {% if array_centres[key]['avis'] %}
  134.                     {% if array_centres[key]['avis']['result'] is defined %}
  135.                         {% for row in array_centres[key]['avis']['result']['reviews'] %}
  136.                             {% set nb_reviews = nb_reviews + 1 %}
  137.                             {% if nb_reviews < 5 %} <div class="col-lg-12 col-xl-6  row p-t-10 ">
  138.                                 <div class="btn-rounded row "
  139.                                      style="background-color:white;border-radius: 25px;margin-right: 25px;">
  140.                                     <div class="col-auto">
  141.                                         <img src="{{row.profile_photo_url}}" alt="" width="60px">
  142.                                     </div>
  143.                                     <div class="col-auto">
  144.                                         <p class="PN-Light PN-blue PN-Bold m-0" style="font-size: 12px;">
  145.                                             {{row.relative_time_description}}</p>
  146.                                         <p class="PN-Light PN-blue m-0" style="font-size: 12px;">{{row.author_name}}</p>
  147.                                         <div class="stars_{{key}}_{{nb_reviews}} p-r-10"></div>
  148.                                     </div>
  149.                                     <div class="col-lg-12">
  150.                                         <p class="PN-Light PN-blue m-0" style="font-size: 12px;">{{row.text}}</p>
  151.                                     </div>
  152.                                 </div>
  153.                             </div>
  154.                             {% endif %}
  155.                         {% endfor %}
  156.                     {% endif %}
  157.             {% endif %}
  158.         </div>
  159.         {% endif %}
  160.     </div>
  161. </section>
  162. <script>
  163.   
  164. document.addEventListener('DOMContentLoaded', function () {
  165.     function afficheStar(rating, className, starSize) {
  166.         $("."+className).starRating({
  167.             initialRating: rating,
  168.             strokeColor: 'gold',
  169.             useGradient: false,
  170.             strokeWidth: 0,
  171.             starSize: starSize,
  172.             readOnly: true
  173.         });
  174.     }
  175.     for (let i = 0; i < $('#countCentre').data('countcentres'); i++) {
  176.         var lat = $('#infocentre_' + i).data('coordonneegps').split(',')[0]
  177.         var lng = $('#infocentre_' + i).data('coordonneegps').split(',')[1]
  178.     //    initMap(i, lat, lng)
  179.         afficheStar($('#infocentre_' + i).data('rating'), 'stars_' + i, 50)
  180.         for (let x = 0; x < $('#infocentreavis_' + i).text().split('|').length; x++) {
  181.             afficheStar($('#infocentreavis_' + i).text().split('|')[x], 'stars_' + i + '_' + (x + 1), 20)
  182.         }
  183.     }
  184. });
  185. </script>