templates/front_otacos/promo.html.twig line 1

Open in your IDE?
  1. {% extends 'base.html.twig' %}
  2. {% block title %}{{'menu.promodumoment'|trans}}{% endblock %}
  3. {% block body %}
  4. <style>
  5.     .example-wrapper { margin: 1em auto; max-width: 800px; width: 95%; font: 18px/1.5 sans-serif; }
  6.     .example-wrapper code { background: #F5F5F5; padding: 2px 6px; }
  7.     .styledMap {
  8.         padding: 5px 10px;
  9.     }
  10.     .gm-style-iw  {
  11.         border: 2px solid #ff7200;
  12.     }
  13.     .styledMap h1{
  14.         color: #ff7200;
  15.         font-size: 1.4em;
  16.         text-transform: uppercase;
  17.         font-family: 'heavitas';
  18.         font-weight:normal;
  19.     }
  20.     .styledMap p{
  21.         font-size: 1.2em;
  22.         margin:0;
  23.         font-family: 'Josefin Sans',sans-serif;
  24.     }
  25. </style>
  26.     <div class="promo">
  27.         <div class="wrapper">
  28.             <ul class="breadcrumb">
  29.                 <li><a href="{{path('home')}}">{{'accueil'|trans}}</a></li>
  30.                 <li>{{'menu.promodumoment'|trans}}</li>
  31.             </ul>
  32.             <h1 class="titreDualFont"><div><span>Promo</span> du moment</div></h1>
  33.             <p class="chapo">
  34.                 <b>{{promo.titre}}</b>
  35.             </p>
  36.             <div class="stand2col">
  37.                 <div class="promo-visuel">
  38.                     <img src="/img/promo-moment.png" />
  39.                 </div>
  40.                 <div class="promo-description">
  41.                     <p>{{promo.chapo|nl2br}}</p>
  42.                     <h3>{{'promo.1'|trans}} :</h3>
  43.                     {{promo.texte|raw}}
  44.                     <p class="promo-description-mentions">
  45.                         {{promo.mentions|nl2br}}
  46.                     </p>
  47.                 </div>
  48.             </div>
  49.             <h2>{{'promo.2'|trans}}</h2>
  50.             <div class="map">
  51.                 <div id="map" style="width:100%;height:100%;"></div>
  52.             </div>
  53.         </div>
  54.         
  55.     </div>
  56.     <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDdDbL-0mCap-U8hE8UrIktLcvdxYOXWVg&callback=initMap&v=weekly"
  57.       async
  58.     ></script>
  59. {% endblock %}
  60. {% block javascripts %}
  61.     <script>
  62.         let map;
  63.         const image = "{{ app.request.schemeAndHttpHost ~ app.request.baseUrl }}/img/markermap.svg";
  64.         function initMap() {
  65.             map = new google.maps.Map(document.getElementById("map"), {
  66.                 mapId: "2262022a4ce1b38",
  67.                 center: { lat: 48.85596, lng: 2.35452 },
  68.                 zoom: 14,
  69.             });
  70.             let infowindow;
  71.             {% for resto in restos %}
  72.                 let marker{{loop.index0}} = new google.maps.Marker({
  73.                     position: { lat: {{resto.lat}}, lng: {{resto.lng}}},
  74.                     map,
  75.                     title: '{{resto.name|escape('js')}}',
  76.                     icon: image,
  77.                 });
  78.                 marker{{loop.index0}}.addListener("click", () => {
  79.                     if(infowindow) infowindow.close();
  80.                     let contentInfo = "<div class=\"styledMap\">";
  81.                     contentInfo+= "<h1>{{resto.name|escape('js')}}</h1>";
  82.                     contentInfo+= "<p><b>{{resto.address|escape('js')}}</b></p>";
  83.                     {% if resto.address2 is not empty %}
  84.                     contentInfo+= "<p><b>{{resto.address2|escape('js')}}</b></p>";
  85.                     {% endif %}
  86.                     contentInfo+= "<p><b>{{resto.zipcode|escape('js')}} {{resto.city|escape('js')}}</b></p>";
  87.                     
  88.                     {% if resto.phone is not null %}
  89.                     contentInfo+= "<p>Tél. <a href=\"tel:{{resto.phone}}\">{{resto.phone}}</a></p>";
  90.                     {% endif %}
  91.                     
  92.                     contentInfo+= "<br/><p>Lundi : ";
  93.                     {% if resto.mondayOpen is not null and resto.mondayClose is not null %}
  94.                         contentInfo+= "{{resto.mondayOpen|date('H')}}h{{resto.mondayOpen|date('i')}} - {{resto.mondayClose|date('H')}}h{{resto.mondayClose|date('i')}}</p>"; 
  95.                     {% else %}
  96.                         contentInfo+= " FERMÉ";
  97.                     {% endif %}
  98.                     
  99.                     contentInfo+= "<p>Mardi : ";
  100.                     {% if resto.tuesdayOpen is not null and resto.tuesdayClose is not null %}
  101.                         contentInfo+= "{{resto.tuesdayOpen|date('H')}}h{{resto.tuesdayOpen|date('i')}} - {{resto.tuesdayClose|date('H')}}h{{resto.tuesdayClose|date('i')}}</p>"; 
  102.                     {% else %}
  103.                         contentInfo+= " FERMÉ";
  104.                     {% endif %}
  105.                     contentInfo+= "<p>Mercredi : ";
  106.                     {% if resto.wednesdayOpen is not null and resto.wednesdayClose is not null %}
  107.                         contentInfo+= "{{resto.wednesdayOpen|date('H')}}h{{resto.wednesdayOpen|date('i')}} - {{resto.wednesdayClose|date('H')}}h{{resto.wednesdayClose|date('i')}}</p>"; 
  108.                     {% else %}
  109.                         contentInfo+= " FERMÉ";
  110.                     {% endif %}
  111.                     contentInfo+= "<p>Jeudi : ";
  112.                     {% if resto.thursdayOpen is not null and resto.thursdayClose is not null %}
  113.                         contentInfo+= "{{resto.thursdayOpen|date('H')}}h{{resto.thursdayOpen|date('i')}} - {{resto.thursdayClose|date('H')}}h{{resto.thursdayClose|date('i')}}</p>"; 
  114.                     {% else %}
  115.                         contentInfo+= " FERMÉ";
  116.                     {% endif %}
  117.                     contentInfo+= "<p>Vendredi : ";
  118.                     {% if resto.fridayOpen is not null and resto.fridayClose is not null %}
  119.                         contentInfo+= "{{resto.fridayOpen|date('H')}}h{{resto.fridayOpen|date('i')}} - {{resto.fridayClose|date('H')}}h{{resto.fridayClose|date('i')}}</p>"; 
  120.                     {% else %}
  121.                         contentInfo+= " FERMÉ";
  122.                     {% endif %}
  123.                     contentInfo+= "<p>Samedi : ";
  124.                     {% if resto.saturdayOpen is not null and resto.saturdayClose is not null %}
  125.                         contentInfo+= "{{resto.saturdayOpen|date('H')}}h{{resto.saturdayOpen|date('i')}} - {{resto.saturdayClose|date('H')}}h{{resto.saturdayClose|date('i')}}</p>"; 
  126.                     {% else %}
  127.                         contentInfo+= " FERMÉ";
  128.                     {% endif %}
  129.                     contentInfo+= "<p>Dimanche : ";
  130.                     {% if resto.sundayOpen is not null and resto.sundayClose is not null %}
  131.                         contentInfo+= "{{resto.sundayOpen|date('H')}}h{{resto.sundayOpen|date('i')}} - {{resto.sundayClose|date('H')}}h{{resto.sundayClose|date('i')}}</p>"; 
  132.                     {% else %}
  133.                         contentInfo+= " FERMÉ";
  134.                     {% endif %}
  135.                     contentInfo+= "</div>";
  136.                     infowindow = new google.maps.InfoWindow({
  137.                         content: contentInfo,
  138.                     });
  139.                     infowindow.open({
  140.                     anchor: marker{{loop.index0}},
  141.                     map,
  142.                     shouldFocus: false,
  143.                     });
  144.                 });
  145.             {% endfor %}
  146.             
  147.         }
  148.     </script>
  149. {% endblock %}