{% extends 'base.html.twig' %}
{% block title %}{{'menu.promodumoment'|trans}}{% endblock %}
{% block body %}
<style>
.example-wrapper { margin: 1em auto; max-width: 800px; width: 95%; font: 18px/1.5 sans-serif; }
.example-wrapper code { background: #F5F5F5; padding: 2px 6px; }
.styledMap {
padding: 5px 10px;
}
.gm-style-iw {
border: 2px solid #ff7200;
}
.styledMap h1{
color: #ff7200;
font-size: 1.4em;
text-transform: uppercase;
font-family: 'heavitas';
font-weight:normal;
}
.styledMap p{
font-size: 1.2em;
margin:0;
font-family: 'Josefin Sans',sans-serif;
}
</style>
<div class="promo">
<div class="wrapper">
<ul class="breadcrumb">
<li><a href="{{path('home')}}">{{'accueil'|trans}}</a></li>
<li>{{'menu.promodumoment'|trans}}</li>
</ul>
<h1 class="titreDualFont"><div><span>Promo</span> du moment</div></h1>
<p class="chapo">
<b>{{promo.titre}}</b>
</p>
<div class="stand2col">
<div class="promo-visuel">
<img src="/img/promo-moment.png" />
</div>
<div class="promo-description">
<p>{{promo.chapo|nl2br}}</p>
<h3>{{'promo.1'|trans}} :</h3>
{{promo.texte|raw}}
<p class="promo-description-mentions">
{{promo.mentions|nl2br}}
</p>
</div>
</div>
<h2>{{'promo.2'|trans}}</h2>
<div class="map">
<div id="map" style="width:100%;height:100%;"></div>
</div>
</div>
</div>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDdDbL-0mCap-U8hE8UrIktLcvdxYOXWVg&callback=initMap&v=weekly"
async
></script>
{% endblock %}
{% block javascripts %}
<script>
let map;
const image = "{{ app.request.schemeAndHttpHost ~ app.request.baseUrl }}/img/markermap.svg";
function initMap() {
map = new google.maps.Map(document.getElementById("map"), {
mapId: "2262022a4ce1b38",
center: { lat: 48.85596, lng: 2.35452 },
zoom: 14,
});
let infowindow;
{% for resto in restos %}
let marker{{loop.index0}} = new google.maps.Marker({
position: { lat: {{resto.lat}}, lng: {{resto.lng}}},
map,
title: '{{resto.name|escape('js')}}',
icon: image,
});
marker{{loop.index0}}.addListener("click", () => {
if(infowindow) infowindow.close();
let contentInfo = "<div class=\"styledMap\">";
contentInfo+= "<h1>{{resto.name|escape('js')}}</h1>";
contentInfo+= "<p><b>{{resto.address|escape('js')}}</b></p>";
{% if resto.address2 is not empty %}
contentInfo+= "<p><b>{{resto.address2|escape('js')}}</b></p>";
{% endif %}
contentInfo+= "<p><b>{{resto.zipcode|escape('js')}} {{resto.city|escape('js')}}</b></p>";
{% if resto.phone is not null %}
contentInfo+= "<p>Tél. <a href=\"tel:{{resto.phone}}\">{{resto.phone}}</a></p>";
{% endif %}
contentInfo+= "<br/><p>Lundi : ";
{% if resto.mondayOpen is not null and resto.mondayClose is not null %}
contentInfo+= "{{resto.mondayOpen|date('H')}}h{{resto.mondayOpen|date('i')}} - {{resto.mondayClose|date('H')}}h{{resto.mondayClose|date('i')}}</p>";
{% else %}
contentInfo+= " FERMÉ";
{% endif %}
contentInfo+= "<p>Mardi : ";
{% if resto.tuesdayOpen is not null and resto.tuesdayClose is not null %}
contentInfo+= "{{resto.tuesdayOpen|date('H')}}h{{resto.tuesdayOpen|date('i')}} - {{resto.tuesdayClose|date('H')}}h{{resto.tuesdayClose|date('i')}}</p>";
{% else %}
contentInfo+= " FERMÉ";
{% endif %}
contentInfo+= "<p>Mercredi : ";
{% if resto.wednesdayOpen is not null and resto.wednesdayClose is not null %}
contentInfo+= "{{resto.wednesdayOpen|date('H')}}h{{resto.wednesdayOpen|date('i')}} - {{resto.wednesdayClose|date('H')}}h{{resto.wednesdayClose|date('i')}}</p>";
{% else %}
contentInfo+= " FERMÉ";
{% endif %}
contentInfo+= "<p>Jeudi : ";
{% if resto.thursdayOpen is not null and resto.thursdayClose is not null %}
contentInfo+= "{{resto.thursdayOpen|date('H')}}h{{resto.thursdayOpen|date('i')}} - {{resto.thursdayClose|date('H')}}h{{resto.thursdayClose|date('i')}}</p>";
{% else %}
contentInfo+= " FERMÉ";
{% endif %}
contentInfo+= "<p>Vendredi : ";
{% if resto.fridayOpen is not null and resto.fridayClose is not null %}
contentInfo+= "{{resto.fridayOpen|date('H')}}h{{resto.fridayOpen|date('i')}} - {{resto.fridayClose|date('H')}}h{{resto.fridayClose|date('i')}}</p>";
{% else %}
contentInfo+= " FERMÉ";
{% endif %}
contentInfo+= "<p>Samedi : ";
{% if resto.saturdayOpen is not null and resto.saturdayClose is not null %}
contentInfo+= "{{resto.saturdayOpen|date('H')}}h{{resto.saturdayOpen|date('i')}} - {{resto.saturdayClose|date('H')}}h{{resto.saturdayClose|date('i')}}</p>";
{% else %}
contentInfo+= " FERMÉ";
{% endif %}
contentInfo+= "<p>Dimanche : ";
{% if resto.sundayOpen is not null and resto.sundayClose is not null %}
contentInfo+= "{{resto.sundayOpen|date('H')}}h{{resto.sundayOpen|date('i')}} - {{resto.sundayClose|date('H')}}h{{resto.sundayClose|date('i')}}</p>";
{% else %}
contentInfo+= " FERMÉ";
{% endif %}
contentInfo+= "</div>";
infowindow = new google.maps.InfoWindow({
content: contentInfo,
});
infowindow.open({
anchor: marker{{loop.index0}},
map,
shouldFocus: false,
});
});
{% endfor %}
}
</script>
{% endblock %}