templates/Map/page.html.twig line 1

Open in your IDE?
  1. {% extends '__design/v2023/grid-map.html.twig' %}
  2. {% block preconnect %}
  3.     {{ parent() }}
  4.     <link rel="preconnect" href="https://yastatic.net">
  5.     <link rel="preconnect" href="https://api-maps.yandex.ru">
  6. {% endblock %}
  7. {# {% block stylesheet_postload %}{{ encore_entry_link_tags("styles/public-map-page") }}{{ parent() }} #}
  8.     {# <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">{% endblock %} #}
  9. {% block wrapper_class %} wrapper--map{% endblock %}
  10. {% block mainContainer %}
  11.     {# {{- knp_menu_render('breadcrumbs', {'template': '__design/v2023/_menu/breadcrumbs.html.twig' }) -}} #}
  12.     <h1 class="d-none">{{ seo_heading() ? seo_heading() : 'Интим карта' }}</h1>
  13.     <div class="map-page content">
  14.         <div class="map-heading container">
  15.             <button class="map-back btn btn-transparent" type="button" onclick="history.back()">
  16.                 <svg class="btn-icon" width="24" height="24" viewBox="0 0 24 24"><path fill="#2C2C2C" d="m17.83 20.13-1.77 1.77-9.9-9.9 9.9-9.9 1.77 1.77L9.7 12l8.13 8.13Z"/></svg>
  17.                 <span class="btn-text">Назад</span>
  18.             </button>
  19.             <button class="map-btn btn btn-grey" type="button" data-a11y-dialog-show="filter-dialog">
  20.                 <svg class="btn-icon" width="20" height="20" viewBox="0 0 20 20"><path d="M7.5 4.165a.833.833 0 1 0 0 1.666.833.833 0 0 0 0-1.666Zm-2.358 0a2.5 2.5 0 0 1 4.717 0h5.975a.833.833 0 1 1 0 1.666H9.859a2.5 2.5 0 0 1-4.717 0h-.975a.833.833 0 1 1 0-1.666h.975Zm7.359 5a.833.833 0 1 0 0 1.666.833.833 0 0 0 0-1.666Zm-2.359 0a2.501 2.501 0 0 1 4.717 0h.975a.833.833 0 1 1 0 1.667h-.975a2.502 2.502 0 0 1-4.717 0H4.167a.833.833 0 1 1 0-1.667h5.975Zm-2.641 5a.833.833 0 1 0 0 1.666.833.833 0 0 0 0-1.666Zm-2.359 0a2.5 2.5 0 0 1 4.717 0h5.975a.833.833 0 1 1 0 1.667H9.859a2.501 2.501 0 0 1-4.717 0h-.975a.833.833 0 1 1 0-1.667h.975Z"/></svg>
  21.                 <span class="btn-text">Фильтры</span>
  22.             </button>
  23.         </div>
  24.         <div class="map-wrap skeleton skeleton--map loading" id="map-wrap"></div>
  25.     </div>
  26. {% endblock %}
  27. {%- block javascripts -%}
  28.     {{ parent() }}
  29.     {% if city is defined and city.mapCoordinate.latitude %}
  30.         {% set lat = city.mapCoordinate.latitude %}
  31.         {% set lon = city.mapCoordinate.longitude %}
  32.     {% else %}
  33.         {% set lat = '55.753215' %}
  34.         {% set lon = '37.622504' %}
  35.     {% endif %}
  36.     <script src="{{ asset('bundles/fosjsrouting/js/router.min.js') }}" defer></script>
  37.     <script src="{{ path('fos_js_routing_js', { callback: 'fos.Router.setData' }) }}" defer></script>
  38.     <script src="https://api-maps.yandex.ru/2.1/?lang=ru_RU&onload=initMap&ns=ym" defer></script>
  39.     <script>
  40.         window.mapConfig = {
  41.             id:"map-wrap",
  42.             multiple_cities:"{{ multipleCities }}",
  43.             routes_url: "{{ multipleCities == 0 ? '/js/fos_js_routes.json' : '/js/fos_js_routes_city_prefixed.json' }}",
  44.             city_uri_identity:"{{ cityUriIdentity }}",
  45.             city_latitude:"{{ lat }}",
  46.             city_longitude:"{{ lon }}",
  47.             locale:"{{ app.request.locale }}",
  48.             path:"{{ path('map.filter', {city:cityUriIdentity}) }}",
  49.             detail: "{{ path('map.detail', {city:cityUriIdentity}) }}",
  50.             {# icon_profile:"{{ asset('assets/images/map/profile.svg') }}",
  51.             icon_profile_active:"{{ asset('assets/images/map/profile-active.svg') }}",
  52.             icon_profile_hover:"{{ asset('assets/images/map/profile-hover.svg') }}",
  53.             icon_saloon:"{{ asset('assets/images/map/saloon.svg') }}",
  54.             icon_saloon_active:"{{ asset('assets/images/map/saloon-active.svg') }}",
  55.             icon_saloon_hover:"{{ asset('assets/images/map/saloon-hover.svg') }}",
  56.             icon_masseur:"{{ asset('assets/images/map/masseur.svg') }}",
  57.             icon_masseur_active:"{{ asset('assets/images/map/masseur-active.svg') }}",
  58.             icon_masseur_hover:"{{ asset('assets/images/map/masseur-hover.svg') }}",
  59.             icon_cluster_small:"{{ asset('assets/images/map/cluster-small.svg') }}",
  60.             icon_cluster_medium:"{{ asset('assets/images/map/cluster-medium.svg') }}",
  61.             icon_cluster_big:"{{ asset('assets/images/map/cluster-big.svg') }}", #}
  62.             {# map_marker_cluster: '{{ absolute_url(asset('assets/images/map/mapMarker_g__cluster.svg')) }}',
  63.             map_marker_cluster_hover: '{{ absolute_url(asset('assets/images/map/mapMarker_g__cluster_hover.svg')) }}',
  64.             map_marker_build: '{{ absolute_url(asset('assets/images/map/mapMarker_b__build.svg')) }}',
  65.             map_marker_opened: '{{ absolute_url(asset('assets/images/map/mapMarker_b__hover_opened.svg')) }}',
  66.             map_marker_ready: '{{ absolute_url(asset('assets/images/map/mapMarker_g__ready.svg')) }}',
  67.             map_marker_ready_hover: '{{ absolute_url(asset('assets/images/map/mapMarker_g__ready_hover.svg')) }}',
  68.             map_marker_transparent: '{{ absolute_url(asset("assets/images/map/transparent_1px.png")) }}',
  69.             default_img: "{{ asset('build/frontend/images/v2025/not-found/estate-no-avatar-x1.jpg') }}", #}
  70.             avatar_path : "{{ responsive_asset('replace_path', 'profile_media_avatar', "200x280", "jpg") }}",
  71.             photo_path : "{{ responsive_asset('replace_path', 'profile_media', "200x280", "jpg") }}",
  72.             thumb_path : "{{ responsive_asset('replace_path', 'saloon_media_thumb', "200x280", "jpg") }}",
  73.             process_profile_shows_url  : "{{ path('map.increment_profile_shows', multipleCities ? {city:cityUriIdentity} : {}) }}"
  74.         };
  75.         window.map_filters = {
  76.             map_center: [{{ lat }}, {{ lon }}]
  77.         };
  78.         window.isMapInitialized = false;
  79.         window.isYMapLoaded = false;
  80.         function initMap() {
  81.             window.ymaps = ym;
  82.             {# window.ymap = new ym.Map(document.getElementById('map-wrap'), {
  83.                 center: ["{{ lat }}", "{{ lon }}"],
  84.                 zoom: 12,
  85.                 behaviors: ["drag", "dblClickZoom", "rightMouseButtonMagnifier", "multiTouch", "scrollZoom"],
  86.                 controls: ['zoomControl', 'typeSelector',  'fullscreenControl']
  87.             }); #}
  88.             window.isMapInitialized = true;
  89.             window.isYMapLoaded = true;
  90.         }
  91.         window.profileShowed = function ({id}) {
  92.             if (!id) return;
  93.             fetch('{{ path('profile_ctr.increase_shows') }}', {
  94.                 method: "POST",
  95.                 body: JSON.stringify({ profiles: [id], source: 'map' }),
  96.             });
  97.         }
  98.         window.stations = {
  99.             {%- for station in stations() -%}{{- station.id -}}:{name:`{{- station.name -}}`},{%- endfor -%}
  100.         };
  101.         document.addEventListener('DOMContentLoaded', function () {
  102.             function loadForm() {
  103.                 fetch('{{ path('map.form', {city: cityUriIdentity}) }}', {
  104.                     mode: "cors",
  105.                     importance: "low",
  106.                     method: "POST",
  107.                     headers: {
  108.                         "Content-Type": "application/x-www-form-urlencoded",
  109.                         "X-Requested-With": "XMLHttpRequest"
  110.                     },
  111.                 }).then(response => {
  112.                     if (response.status < 300) {
  113.                         return response.text();
  114.                     } else {
  115.                         console.warn("🤔");
  116.                         return null;
  117.                     }
  118.                 }).then(response => {
  119.                     document.getElementById('dialog-form').innerHTML = response;
  120.                     document.dispatchEvent(new Event('form-html-load'));
  121.                     filterLoader()
  122.                 });
  123.             }
  124.             loadForm();
  125.             function filterLoader() {
  126.                 const stringifyData = `{"city_id":"${document.getElementById('filter_map_form_city_id').value}","_token":"${document.getElementById('filter_map_form__token').value}","scale":10}`;
  127.                 fetch("{{ path('map.filter', {city:cityUriIdentity}) }}", {
  128.                     method: "POST",
  129.                     headers: {
  130.                         'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
  131.                         'X-Requested-With': 'XMLHttpRequest',
  132.                     },
  133.                     body: new URLSearchParams({ form: stringifyData, scale: 12 }).toString(),
  134.                 })
  135.                 .then(response => response.json())
  136.                 .then(data => {
  137.                     //console.log('map-data-loaded')
  138.                     const mapLoadedInterval = setInterval(()=>{
  139.                         if (window.isYMapLoaded) {
  140.                             document.dispatchEvent(new CustomEvent('map:data:loaded', { detail: { data, stringifyData, mapConfig: window.mapConfig } }));
  141.                             clearInterval(mapLoadedInterval)
  142.                         }
  143.                     }, 200)
  144.                 })
  145.                 .catch(error => console.error(error));
  146.             }
  147.         })
  148.     </script>
  149.     {{ encore_entry_script_tags('scripts/v2026/map-page', null, 'basicConfig') }}
  150. {% endblock %}
  151. {% block modal %}
  152.     {{- parent() -}}
  153.     {{- include('__design/v2023/components/modal/filter.html.twig') -}}
  154. {% endblock %}