{% extends 'grid.html.twig' %}
{% block title %}
{{ seo_title() }}
{% endblock %}
{% block metaDescription %}
<meta name="description" content="{{ seo_description() }}">
{% endblock %}
{% block stylesheet %}
{{ parent() }}
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
{% endblock %}
{% block name_page %}map{% endblock %}
{% block bodyClasses %}map-page{% endblock %}
{% block mainContainer %}
{% if city is defined and city.mapCoordinate.latitude %}
{% set coordss = 1 %}
{% set lat = city.mapCoordinate.latitude %}
{% set lon = city.mapCoordinate.longitude %}
{% else %}
{% set coordss = 0 %}
{% set lat = '55.75' %}
{% set lon = '37.61' %}
{% endif %}
<h1 class="border-line">{% if seo_heading() is empty %}%Интим карта{% else %}{{ seo_heading() }}{% endif %}</h1>
<p class="text-desc mb-lg-4">
На карте обозначено местоположение зарегистрированных анкет.<br>
Кликнув на маркер Вы узнаете краткую информацию о девушке.
</p>
<div class="map">
<div class="filter-line d-flex justify-content-center justify-content-md-between mb-2 mb-md-3 mb-lg-4">
<button class="btn btn-secondary btn-collapse-filter" type="button" id="filter-expand">
<svg class="icon mr-1">
<use xlink:href="#icon-dropdown"></use>
</svg>
Расширенный поиск
</button>
<div class="d-flex align-items-center collapse-reset ml-2">
<span class="d-none" id="count-parameters">Выбрано <em>0</em> параметров</span>
<button class="btn btn-secondary btn-collapse-reset ml-md-2" id="reset-form-2" data-reset="true">Сброс</button>
</div>
</div>
<div class="collapse" id="collapseFilter">
</div>
<div class="map-wrap loading" id="map-wrap" style="width: 100%; height: 700px;">
</div>
</div>
{# {{ include('components/big_footer.html.twig', { 'type': 'main' }) }} #}
{{ include('components/seo.partial.twig', {type: 'top'}) }}
{{ include('components/seo.partial.twig', {type: 'bottom'}) }}
{% endblock %}
{% block javascripts %}
{{ parent() }}
{% if city is defined and city.mapCoordinate.latitude %}
{% set lat = city.mapCoordinate.latitude %}
{% set lon = city.mapCoordinate.longitude %}
{% else %}
{% set lat = '55.753215' %}
{% set lon = '37.622504' %}
{% endif %}
<script src="{{ asset('bundles/fosjsrouting/js/router.min.js') }}" defer></script>
<script src="{{ path('fos_js_routing_js', { callback: 'fos.Router.setData' }) }}" defer></script>
<script src="https://api-maps.yandex.ru/2.1/?lang=ru_RU&onload=initMap&ns=ym" defer></script>
<script>
const mapConfig = {
id:"map-wrap",
multiple_cities:"{{ multipleCities }}",
routes_url: "{{ multipleCities == 0 ? '/js/fos_js_routes.json' : '/js/fos_js_routes_city_prefixed.json' }}",
city_uri_identity:"{{ cityUriIdentity }}",
city_latitude:"{{ lat }}",
city_longitude:"{{ lon }}",
locale:"{{ app.request.locale }}",
path:"{{ path('map.filter', {city:cityUriIdentity}) }}",
icon_profile:"{{ asset('assets/images/map/profile.svg') }}",
icon_profile_active:"{{ asset('assets/images/map/profile-active.svg') }}",
icon_profile_hover:"{{ asset('assets/images/map/profile-hover.svg') }}",
icon_saloon:"{{ asset('assets/images/map/saloon.svg') }}",
icon_saloon_active:"{{ asset('assets/images/map/saloon-active.svg') }}",
icon_saloon_hover:"{{ asset('assets/images/map/saloon-hover.svg') }}",
icon_masseur:"{{ asset('assets/images/map/masseur.svg') }}",
icon_masseur_active:"{{ asset('assets/images/map/masseur-active.svg') }}",
icon_masseur_hover:"{{ asset('assets/images/map/masseur-hover.svg') }}",
icon_cluster_small:"{{ asset('assets/images/map/cluster-small.svg') }}",
icon_cluster_medium:"{{ asset('assets/images/map/cluster-medium.svg') }}",
icon_cluster_big:"{{ asset('assets/images/map/cluster-big.svg') }}",
avatar_path : "{{ responsive_asset('replace_path', 'profile_media_avatar', "200x280", "jpg") }}",
photo_path : "{{ responsive_asset('replace_path', 'profile_media', "200x280", "jpg") }}",
thumb_path : "{{ responsive_asset('replace_path', 'saloon_media_thumb', "200x280", "jpg") }}",
process_profile_shows_url : "{{ path('map.increment_profile_shows', multipleCities ? {city:cityUriIdentity} : {}) }}"
};
var isMapInitialized = false;
var yaMapLoaded = false;
function initMap() {
//console.log('initMap');
window.ymap = new ym.Map(document.getElementById('map-wrap'), {
center: ["{{ lat }}", "{{ lon }}"],
zoom: 8,
controls: ['zoomControl', 'typeSelector', 'fullscreenControl']
});
yaMapLoaded = true;
//if (!isMapInitialized) {
// console.log('new mapPage initMap');
// isMapInitialized = true;
// new MapPage(mapConfig);
//}
}
window.profileShowed = function ({id}) {
if (!id) return;
fetch('{{ path('profile_ctr.increase_shows') }}', {
method: "POST",
body: JSON.stringify({ profiles: [id], source: 'map' }),
});
}
window.stations = {
{%- for station in stations() -%}{{- station.id -}}:{icon:`{%- include 'components/metro/icon_generate.partial.twig' with {data: station|station_lines} -%}`,name:`{{- station.name -}}`},{%- endfor -%}
};
document.addEventListener('DOMContentLoaded', function () {
function loadForm() {
fetch('{{ path('map.form', {city: cityUriIdentity}) }}', {
mode: "cors",
importance: "low",
method: "POST",
headers: {
"Content-Type": "application/x-www-form-urlencoded",
"X-Requested-With": "XMLHttpRequest"
},
}).then(response => {
if (response.status < 300) {
return response.text();
} else {
console.warn("🤔");
return null;
}
}).then(response => {
document.getElementById('collapseFilter').innerHTML = response;
filterLoader()
});
}
loadForm();
function filterLoader() {
const stringifyData = `{"city_id":"${document.getElementById('filter_map_form_city_id').value}","_token":"${document.getElementById('filter_map_form__token').value}"}`;
fetch("{{ path('map.filter', {city:cityUriIdentity}) }}", {
method: "POST",
headers: {
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'X-Requested-With': 'XMLHttpRequest',
},
body: new URLSearchParams({ form: stringifyData }).toString(),
})
.then(response => response.json())
.then(data => {
//console.log('map-data-loaded')
const mapLoadedInterval = setInterval(()=>{
if (yaMapLoaded) {
new MapPage(mapConfig);
document.dispatchEvent(new CustomEvent('map:data:loaded', { detail: { data, stringifyData } }));
clearInterval(mapLoadedInterval)
}
}, 200)
})
.catch(error => console.error(error));
//if (!isMapInitialized) {
// console.log('new mapPage filterLoader');
// isMapInitialized = true;
// new MapPage(mapConfig);
//}
}
})
</script>
{% endblock %}