<div class="site-block points">
<div class="container">
<div class="site-heading">{{ title|default|raw }}</div>
</div>
<div class="container">
<div class="points__text content">
{{ description|default|raw }}
</div>
<div class="points__filter">
<div class="points__filter-city">
<div class="form__field">
<div class="form__select">
<button type="button" class="form__select-button">Все города</button>
<svg>
<use xlink:href="/images/sprite..svg#arrow-bottom"></use>
</svg>
<ul class="form__select-dropdown">
<li>
<input type="radio" id="l0" name="city" value="" data-type="">
<label for="l0">Все города</label>
</li>
{% for city in cities %}
<li>
<input type="radio" id="l{{ loop.index }}" name="city" value="{{ city }}" data-type="{{ city }}">
<label for="l{{ loop.index }}">{{ city }}</label>
</li>
{% endfor %}
</ul>
</div>
<script>
let url = new URL(window.location.href)
let selectedCity = url.searchParams.get('city')
document.querySelectorAll('[name="city"]').forEach(el => {
if(selectedCity && selectedCity === el.value){
el.checked = true
let selectEl = el.closest('.form__select')
selectEl.classList.add('selected')
selectEl.querySelector('button').innerText = selectedCity
}
el.addEventListener('change', e => {
let value = e.target.value
if(el.id === 'l0') window.location.href = window.location.pathname
else window.location.href = `${window.location.pathname}?city=${value}`
})
})
</script>
</div>
</div>
<div class="points__filter-buttons">
<div class="item selected" data-tab="list">
<svg>
<use xlink:href="/images/sprite..svg#list" />
</svg>
<span>Списком</span>
</div>
<div class="item" data-tab="map">
<svg>
<use xlink:href="/images/sprite..svg#map" />
</svg>
<span>На карте</span>
</div>
</div>
</div>
<div class="points__tabs">
<div class="site-tabs__area">
<div class="site-tabs__item selected" data-tab="list">
<div class="points__list">
<div class="points__list-row points__list-headings">
<div class="cell">Город</div>
<div class="cell">Адрес</div>
<div class="cell">Режим работы</div>
<div class="cell">Контакты</div>
</div>
{% for point in points %}
<div class="points__list-row item" data-coordinates="{{ point.coordinates|join(',') }}">
<div class="cell">{{point.city}}</div>
<div class="cell">{{point.address}}</div>
<div class="cell">{{point.worktime}}</div>
<div class="cell">
{{ point.contacts }}
</div>
</div>
{% endfor %}
</div>
</div>
<div class="site-tabs__item" data-tab="map">
<div class="points__map">
<div id="map"></div>
</div>
</div>
</div>
</div>
</div>
</div>