{% set body_classes = ['list-of-cities'] %}
{% set suffix = currentPage == 1 ? '' : '_with_page' %}
{% set title = ('city_list' ~ suffix ~ '.title')|trans({'%page%': currentPage}) %}
{% set description = ('city_list' ~ suffix ~ '.description')|trans({'%page%': currentPage}) %}
{% set keywords = ('city_list' ~ suffix ~ '.keywords')|trans({'%page%': currentPage}) %}
{% extends 'base.html.twig' %}
{% block stylesheets %}
{{ parent() }}
{{ encore_entry_link_tags('city_list') }}
{{ encore_entry_link_tags('search_autocomplete') }}
{% endblock stylesheets %}
{% block content %}
<main>
<div class="container">
<div class="list-of-cities-container">
<div class="search-form-wrapper animate-on-scroll-bottom">
<div class="title">
<h3>{{ 'cities.list_title'|trans|raw }}</h3>
</div>
{{ form_start(form, {'attr': {
'data-controller': 'search',
'data-search-url-value': path('search_cities_with_profiles'),
'data-action': 'submit->search#onSubmit',
}}) }}
<div class="field-wrapper">
{{ form_widget(form.search, {'attr': {
'data-action': 'input->search#onAutocomplete click->search#onClick',
'data-search-target': 'input',
}}) }}
<div class="autocomplete-results" {{ stimulus_target('search', 'results') }}></div>
</div>
<div class="buttons-container">
{{ form_widget(form.submit) }}
</div>
{{ form_end(form) }}
</div>
<div class="list-wrapper">
{% for city in cities %}
<a href="{{ path('city_companies_list', {'id': city.id, 'slug': city.slug}) }}" class="city">
{{ city.name }}
</a>
{% endfor %}
</div>
{% if pagination|length > 1 %}
<div class="toolbar-bottom-container">
<nav class="pagination-container">
{% if currentPage > 1 %}
<a href="{{ path('city_list', { page: currentPage - 1 }) }}" class="p-i-previous"></a>
{% else %}
<span class="p-i-previous p-i-disabled"></span>
{% endif %}
<span class="pagination-pages">
{% for p in pagination %}
{% if p == currentPage %}
<span class="pagination-item p-i p-i-disabled">{{ p }}</span>
{% elseif p == '...' %}
<span class="pagination-item p-i">…</span>
{% else %}
<a href="{{ path('city_list', { page: p }) }}" class="pagination-item p-i">
{{ p }}
</a>
{% endif %}
{% endfor %}
</span>
{% if currentPage < pagination|last %}
<a href="{{ path('city_list', { page: currentPage + 1 }) }}" class="p-i-next"></a>
{% else %}
<span class="p-i-next p-i-disabled"></span>
{% endif %}
</nav>
</div>
{% endif %}
</div>
</div>
</main>
{% endblock content %}