{% extends '@SyliusShop/layout-large.html.twig' %}
{% block banner %}
{{ render(url('odiseo_sylius_banner_plugin_shop_partial_banner', {'template': '@SyliusShop/Banner/_banner-nos-boutiques.html.twig'})) }}
{% endblock %}
{%- block title -%}
{% if page.title is not empty %}
{{ page.title }}
{% else %}
{{ parent() }}
{% endif %}
{%- endblock -%}
{% block head %}
{{ parent() }}
{% block stylesheets %}
{{ parent() }}
<link href='https://api.mapbox.com/mapbox-gl-js/v2.3.1/mapbox-gl.css' rel='stylesheet' />
{% endblock %}
{% block metatags %}
{{ parent() }}
<meta name="keywords" content="{{ 'sylius.stores.meta_keywords'|trans|e('html_attr') }}"/>
<meta name="description" content="{{ 'sylius.stores.discover_our_stores'|trans|e('html_attr') }}"/>
{% endblock %}
{% endblock %}
{% block content %}
<div class="store-list">
<div class="container">
{% include 'common/_breadcrumb.html.twig' %}
<div class="store-list__intro">{{ 'sylius.stores.discover_our_stores'|trans }}</div>
</div>
<div class="store-list__columns">
<div class="store-list__map-block" data-aos="fade-right">
<div id='map'></div>
</div>
<div class="store-list__list" data-aos="fade-left">
<h1 class="store-list__title">{{ 'sylius.stores.title_discover_our_stores'|trans|raw }}</h1>
<div class="store-list__legend">
<span>{{ 'sylius.stores.mons_store'|trans }}</span>
<span>{{ 'sylius.stores.reseller'|trans }}</span>
</div>
<div class="store-list__items">
{% for store in stores %}
<div class="store-list__item">
<a href="{{ path('app_shop_store_show', {code: store.code}) }}" title="{{ store.nameWhenLinked|e('html_attr') }}"><h2 class="store-list__item-title {% if store.isReseller %}reseller{% endif %}"><span class="store-list__badge {% if store.isReseller %}reseller{% endif %}">{{ loop.index }}</span>{{ store.name }}</h2></a>
<div class="store-list__infos-section">
{% if store.address != "" and store.address is not null %}
<div class="store-list__icon-block">
<i class="fas fa-map-marker-alt"></i>
<div>{{ store.address }}</div>
</div>
{% endif %}
{% if store.email != "" and store.email is not null %}
<div class="store-list__icon-block">
<i class="fas fa-envelope"></i>
<div><a href="mailto:{{ store.email }}" title="{{ 'sylius.stores.write_to_the_store'|trans|e('html_attr') }}">{{ store.email }}</a></div>
</div>
{% endif %}
{% if store.phone != "" and store.phone is not null %}
<div class="store-list__icon-block">
<i class="fas fa-phone"></i>
<div>{{ 'sylius.stores.phone'|trans }} <a href="tel:{{ store.phone }}" target="_blank" title="{{ 'sylius.stores.call_the_store'|trans|e('html_attr') }}">{{ store.phone }}</a></div>
</div>
{% endif %}
{% if store.fax != "" and store.fax is not null %}
<div class="store-list__icon-block">
<i class="fas fa-fax"></i>
<div>{{ 'sylius.stores.fax'|trans }} {{ store.fax }}</div>
</div>
{% endif %}
{% if store.openingTimes != "" and store.openingTimes is not null %}
<div class="store-list__icon-block store-list__icon-block--opening">
<i class="fas fa-clock"></i>
<div>
<strong>{{ 'sylius.stores.opening_times'|trans }}</strong>
<br>
{{ store.openingTimes|raw }}
</div>
</div>
{% endif %}
</div>
</div>
{% endfor %}
</div>
</div>
</div>
<div class="citation" data-aos="fade-up">
<div class="container">
<p>{{ 'sylius.stores.discover_our_events'|trans|raw }}</p>
<a href="/{{ app.request.locale|slice(0, 2) }}/blog/articles" class="button button--secondary" title="{{ 'sylius.stores.discover_our_news'|trans|e('html_attr') }}">{{ 'sylius.stores.discover_our_news'|trans|raw }}</a>
</div>
</div>
</div>
{% endblock %}
{% block javascripts %}
{{ parent() }}
<script src='https://api.mapbox.com/mapbox-gl-js/v2.3.1/mapbox-gl.js'></script>
<script type="text/javascript">
// Display the map
mapboxgl.accessToken = '{{ mapbox_key }}';
var map = new mapboxgl.Map({
container: 'map',
style: 'mapbox://styles/mapbox/light-v10',
center: [10, 47.8],
zoom: 3
});
var geojson = {
'type': 'FeatureCollection',
'features': [
{% for store in stores %}
{% if loop.index0 > 0 %}
,
{% endif %}
{
'type': 'Feature',
'geometry': {
'type': 'Point',
'coordinates': [{% if store.gpsLng != "" and store.gpsLng is not null %}{{ store.gpsLng }}{% else %}0{% endif %}, {% if store.gpsLat != "" and store.gpsLat is not null %}{{ store.gpsLat }}{% else %}0{% endif %}]
},
'properties': {
'reseller': {% if store.isReseller %}true{% else %}false{% endif %},
'title': '{{ store.name|e('js') }}',
'description': `
<div class="store-list__infos-section">
<div class="store-list__icon-block">
<i class="fas fa-map-marker-alt"></i>
<div>{{ store.address }}</div>
</div>
{% if store.email != "" and store.email is not null %}
<div class="store-list__icon-block">
<i class="fas fa-envelope"></i>
<div><a href="mailto:{{ store.email }}" target="_blank" title="{{ 'sylius.stores.write_to_the_store'|trans|e('html_attr') }}">{{ store.email }}</a></div>
</div>
{% endif %}
{% if store.phone != "" and store.phone is not null %}
<div class="store-list__icon-block">
<i class="fas fa-phone"></i>
<div>{{ 'sylius.stores.phone'|trans|e('html_attr') }} <a href="tel:{{ store.phone }}" target="_blank" title="{{ 'sylius.stores.call_the_store'|trans|e('html_attr') }}">{{ store.phone }}</div>
</div>
{% endif %}
{% if store.fax != "" and store.fax is not null %}
<div class="store-list__icon-block">
<i class="fas fa-fax"></i>
<div>{{ 'sylius.stores.fax'|trans|e('html_attr') }} {{ store.fax }}</div>
</div>
{% endif %}
</div>
`
}
}
{% endfor %}
]
};
// add markers to map
geojson.features.forEach(function (marker) {
// create a HTML element for each feature
var el = document.createElement('div');
el.className = marker.properties.reseller ? 'marker reseller' : 'marker';
// make a marker for each feature and add it to the map
new mapboxgl.Marker(el)
.setLngLat(marker.geometry.coordinates)
.setPopup(
new mapboxgl.Popup({ offset: 25 }) // add popups
.setHTML(
'<h3>' +
marker.properties.title +
'</h3><p>' +
marker.properties.description +
'</p>'
)
)
.addTo(map);
});
var nav = new mapboxgl.NavigationControl();
map.addControl(nav, 'top-left');
</script>
{% endblock %}