templates/mons/stores/index.html.twig line 1

Open in your IDE?
  1. {% extends '@SyliusShop/layout-large.html.twig' %}
  2. {% block banner %}
  3.     {{ render(url('odiseo_sylius_banner_plugin_shop_partial_banner', {'template': '@SyliusShop/Banner/_banner-nos-boutiques.html.twig'})) }}
  4. {% endblock %}
  5. {%- block title -%}
  6.     {% if page.title is not empty %}
  7.         {{ page.title }}
  8.     {% else %}
  9.         {{ parent() }}
  10.     {% endif %}
  11. {%- endblock -%}
  12. {% block head %}
  13.     {{ parent() }}
  14.     {% block stylesheets %}
  15.         {{ parent() }}
  16.         <link href='https://api.mapbox.com/mapbox-gl-js/v2.3.1/mapbox-gl.css' rel='stylesheet' />
  17.     {% endblock %}
  18.     {% block metatags %}
  19.         {{ parent() }}
  20.         <meta name="keywords" content="{{ 'sylius.stores.meta_keywords'|trans|e('html_attr') }}"/>
  21.         <meta name="description" content="{{ 'sylius.stores.discover_our_stores'|trans|e('html_attr') }}"/>
  22.     {% endblock %}
  23. {% endblock %}
  24. {% block content %}
  25.     <div class="store-list">
  26.         <div class="container">
  27.             {% include 'common/_breadcrumb.html.twig' %}
  28.             <div class="store-list__intro">{{ 'sylius.stores.discover_our_stores'|trans }}</div>
  29.         </div>
  30.         <div class="store-list__columns">
  31.             <div class="store-list__map-block" data-aos="fade-right">
  32.                 <div id='map'></div>
  33.             </div>
  34.             <div class="store-list__list" data-aos="fade-left">
  35.                 <h1 class="store-list__title">{{ 'sylius.stores.title_discover_our_stores'|trans|raw }}</h1>
  36.                 <div class="store-list__legend">
  37.                     <span>{{ 'sylius.stores.mons_store'|trans }}</span>
  38.                     <span>{{ 'sylius.stores.reseller'|trans }}</span>
  39.                 </div>
  40.                 <div class="store-list__items">
  41.                     {% for store in stores %}
  42.                         <div class="store-list__item">
  43.                             <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>
  44.                             <div class="store-list__infos-section">
  45.                                 {% if store.address != "" and store.address is not null %}
  46.                                     <div class="store-list__icon-block">
  47.                                         <i class="fas fa-map-marker-alt"></i>
  48.                                         <div>{{ store.address }}</div>
  49.                                     </div>
  50.                                 {% endif %}
  51.                                 {% if store.email != "" and store.email is not null %}
  52.                                     <div class="store-list__icon-block">
  53.                                         <i class="fas fa-envelope"></i>
  54.                                         <div><a href="mailto:{{ store.email }}" title="{{ 'sylius.stores.write_to_the_store'|trans|e('html_attr') }}">{{ store.email }}</a></div>
  55.                                     </div>
  56.                                 {% endif %}
  57.                                 {% if store.phone != "" and store.phone is not null %}
  58.                                     <div class="store-list__icon-block">
  59.                                         <i class="fas fa-phone"></i>
  60.                                         <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>
  61.                                     </div>
  62.                                 {% endif %}
  63.                                 {% if store.fax != "" and store.fax is not null %}
  64.                                     <div class="store-list__icon-block">
  65.                                         <i class="fas fa-fax"></i>
  66.                                         <div>{{ 'sylius.stores.fax'|trans }} {{ store.fax }}</div>
  67.                                     </div>
  68.                                 {% endif %}
  69.                                 {% if store.openingTimes != "" and store.openingTimes is not null %}
  70.                                     <div class="store-list__icon-block store-list__icon-block--opening">
  71.                                         <i class="fas fa-clock"></i>
  72.                                         <div>
  73.                                             <strong>{{ 'sylius.stores.opening_times'|trans }}</strong>
  74.                                             <br>
  75.                                             {{ store.openingTimes|raw }}
  76.                                         </div>
  77.                                     </div>
  78.                                 {% endif %}
  79.                             </div>
  80.                         </div>
  81.                     {% endfor %}
  82.                 </div>
  83.             </div>
  84.         </div>
  85.         <div class="citation" data-aos="fade-up">
  86.             <div class="container">
  87.                 <p>{{ 'sylius.stores.discover_our_events'|trans|raw }}</p>
  88.                 <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>
  89.             </div>
  90.         </div>
  91.     </div>
  92. {% endblock %}
  93. {% block javascripts %}
  94.     {{ parent() }}
  95.     <script src='https://api.mapbox.com/mapbox-gl-js/v2.3.1/mapbox-gl.js'></script>
  96.     <script type="text/javascript">
  97.         // Display the map
  98.         mapboxgl.accessToken = '{{ mapbox_key }}';
  99.         var map = new mapboxgl.Map({
  100.             container: 'map',
  101.             style: 'mapbox://styles/mapbox/light-v10',
  102.             center: [10, 47.8],
  103.             zoom: 3
  104.         });
  105.         var geojson = {
  106.             'type': 'FeatureCollection',
  107.             'features': [
  108.                 {% for store in stores %}
  109.                     {% if loop.index0 > 0 %}
  110.                         ,
  111.                     {% endif %}
  112.                     {
  113.                         'type': 'Feature',
  114.                          'geometry': {
  115.                             'type': 'Point',
  116.                             '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 %}]
  117.                         },
  118.                         'properties': {
  119.                             'reseller': {% if store.isReseller %}true{% else %}false{% endif %},
  120.                             'title': '{{ store.name|e('js') }}',
  121.                             'description': `
  122.                                             <div class="store-list__infos-section">
  123.                                                 <div class="store-list__icon-block">
  124.                                                     <i class="fas fa-map-marker-alt"></i>
  125.                                                     <div>{{ store.address }}</div>
  126.                                                 </div>
  127.                                                 {% if store.email != "" and store.email is not null %}
  128.                                                     <div class="store-list__icon-block">
  129.                                                         <i class="fas fa-envelope"></i>
  130.                                                         <div><a href="mailto:{{ store.email }}" target="_blank" title="{{ 'sylius.stores.write_to_the_store'|trans|e('html_attr') }}">{{ store.email }}</a></div>
  131.                                                     </div>
  132.                                                 {% endif %}
  133.                                                 {% if store.phone != "" and store.phone is not null %}
  134.                                                     <div class="store-list__icon-block">
  135.                                                         <i class="fas fa-phone"></i>
  136.                                                         <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>
  137.                                                     </div>
  138.                                                 {% endif %}
  139.                                                 {% if store.fax != "" and store.fax is not null %}
  140.                                                     <div class="store-list__icon-block">
  141.                                                         <i class="fas fa-fax"></i>
  142.                                                         <div>{{ 'sylius.stores.fax'|trans|e('html_attr') }} {{ store.fax }}</div>
  143.                                                     </div>
  144.                                                 {% endif %}
  145.                                             </div>
  146.                                         `
  147.                         }
  148.                     }
  149.                 {% endfor %}
  150.             ]
  151.         };
  152.         // add markers to map
  153.         geojson.features.forEach(function (marker) {
  154.             // create a HTML element for each feature
  155.             var el = document.createElement('div');
  156.             el.className = marker.properties.reseller ? 'marker reseller' : 'marker';
  157.             // make a marker for each feature and add it to the map
  158.             new mapboxgl.Marker(el)
  159.                 .setLngLat(marker.geometry.coordinates)
  160.                 .setPopup(
  161.                     new mapboxgl.Popup({ offset: 25 }) // add popups
  162.                         .setHTML(
  163.                             '<h3>' +
  164.                             marker.properties.title +
  165.                             '</h3><p>' +
  166.                             marker.properties.description +
  167.                             '</p>'
  168.                         )
  169.                 )
  170.                 .addTo(map);
  171.         });
  172.         var nav = new mapboxgl.NavigationControl();
  173.         map.addControl(nav, 'top-left');
  174.     </script>
  175. {% endblock %}