{%- set route = app.request.attributes.get('_route') -%}
{%- set city = app.request.attributes.get('city') ?? null -%}
{%- set locale = app.request.locale ?? 'ru' -%}
{%- set isMainCity = city == default_city() -%}
{%- if item.children|length > 1 -%}
{# Перегоняем в индексированный массив #}
{% set children = [] %}
{% for breadcrumb_item in item.children %}
{% set children = children|merge([breadcrumb_item]) %}
{% endfor %}
{% if route == 'profile_preview.page' %}
{% set profile = options.profile ?? null %}
{% set station = profile.stations|length ? profile.stations[0] : null %}
{% set main = [{
label: 'Проститутки ' ~ city.name|geo_name('genitive'),
uri: path('profile_list.list_by_city', {city: city.uriIdentity})
}]%}
{# {Элитные|Дешевые|Дорогие} #}
{# Пороговые цены зависят от категории города (city.categoryId, 1-5) #}
{% set priceTiers = {
1: {'cheapMax': 5000, 'highMin': 10000, 'eliteMin': 25000},
2: {'cheapMax': 4000, 'highMin': 10000, 'eliteMin': 20000},
3: {'cheapMax': 3000, 'highMin': 7000, 'eliteMin': 15000},
4: {'cheapMax': 2500, 'highMin': 5000, 'eliteMin': 12500},
5: {'cheapMax': 2000, 'highMin': 5000, 'eliteMin': 10000}
} %}
{% set cityCategoryId = city.categoryId|default(5) %}
{% set tier = priceTiers[cityCategoryId]|default(priceTiers[5]) %}
{% set profilePrice = max(profile.apartmentsPricing.oneHourPrice|default(0), profile.takeOutPricing.oneHourPrice|default(0)) %}
{% set isEliteProfile = profilePrice >= tier.eliteMin %}
{% set isProfileCheapest = profilePrice > 0 and profilePrice <= tier.cheapMax %}
{% set isProfileHighCost = profilePrice >= tier.highMin and profilePrice < tier.eliteMin %}
{% if isEliteProfile %}
{# === Определяем, является ли профиль элитным === #}
{% set outputLink = path('profile_list.list_price_elite', {'city': city.uriIdentity}) %}
{% set main = main|merge([{
label: 'Элитные проститутки',
uri: outputLink
}]) %}
{% elseif isProfileCheapest %}
{# === Определяем, является ли профиль дешёвым === #}
{% set outputLink = path('profile_list.list_price_low', {'city': city.uriIdentity}) %}
{% set main = main|merge([{
label: 'Дешевые проститутки',
uri: outputLink
}]) %}
{% elseif isProfileHighCost %}
{# === Определяем, является ли профиль Дорогим === #}
{% set outputLink = path('profile_list.list_price_high', {'city': city.uriIdentity}) %}
{% set main = main|merge([{
label: 'Дорогие проститутки',
uri: outputLink
}]) %}
{% endif %}
{# {Молодые|Взрослые} #}
{% set ageYoung = profile.personParameters.age < 26 %}
{% set ageOld = profile.personParameters.age > 35 %}
{% set outputAge = ageYoung ? 'Молодые' :
ageOld ? 'Старые' : 'Взрослые' %}
{% set outputAgeLink = ageYoung ? path('profile_list.list_age_young', {'city': city.uriIdentity}) :
ageOld ? path('profile_list.list_grandmothers', {'city': city.uriIdentity}) :
path('profile_list.list_age_older_than', {'city': city.uriIdentity}) %}
{% set main = main|merge([{
label: outputAge ~ ' проститутки',
uri: outputAgeLink
}]) %}
{# Проверенное фото #}
{% if profile.approved %}
{% set main = main|merge([{
label: 'Проверенное фото',
uri: path('profile_list.list_approved', {'city': city.uriIdentity})
}]) %}
{% endif %}
{% set children = main|merge([children|last]) %}
<ul class="breadcrumbs" vocab="http://schema.org/" typeof="BreadcrumbList">
{% for breadcrumb_item in children %}
<li class="{% if loop.last %}last-crumb{% endif %}" property="itemListElement" typeof="ListItem">
{% if not loop.last %}
<a href="{{ breadcrumb_item.uri }}" property="item" typeof="WebPage"><span property="name">{{ breadcrumb_item.label }}</span></a>
{% else %}
<span property="name">{{ breadcrumb_item.label }}{{ profile.personParameters.age ? ', ' ~ profile.personParameters.age|plural('год') : '' }} ID {{ profile.id }}</span>
{% endif %}
<meta property="position" content="{{ loop.index }}">
</li>
{% endfor %}
</ul>
{% else %}
{%- set isProfileList = ('profile_list.' in route) and ('_pagination' in route) -%}
<ul class="breadcrumbs" vocab="http://schema.org/" typeof="BreadcrumbList">
{# Делаем првый элемент "Главная", второй - город #}
{#{% set main = city == default_city() ? [{label: city.name, uri: path('profile_list.list_by_city', {city: city.uriIdentity})}] : [{label: 'Главная', uri: path('homepage')}, {label: city.name, uri: path('profile_list.list_by_city', {city: city.uriIdentity})}] %}#}
{% set main = isMainCity ? [{label: 'Главная', uri: path('profile_list.list_by_city', {city: city.uriIdentity})}] : [{label: 'Главная', uri: path('homepage')}, {label: city.name, uri: path('profile_list.list_by_city', {city: city.uriIdentity})}] %}
{% if 'profile_list.list_by_station' in route %}
{% set main = main|merge([{label: 'Метро' , uri: path('station_list.page', {city: city.uriIdentity})}]) %}
{% endif %}
{# Только для листинга С ПАГИНАЦИЕЙ #}
{%- if isProfileList -%}
{% set routeParams = app.request.attributes.get('_route_params')|merge({'page': null}) %}
{% set children = main|merge([{label: children|last.name, uri: path(route|replace({'._pagination': ''}), routeParams)}]) %}
{% set children = children|merge([{label: 'Страница ' ~ app.request.get('page')}]) %}
{%- else -%}
{% set children = main|merge([children|last]) %}
{% endif %}
{% for breadcrumb_item in children %}
<li class="{% if loop.last %}last-crumb{% endif %}" property="itemListElement" typeof="ListItem">
{% if not loop.last and breadcrumb_item.uri is defined %}
<a href="{{ breadcrumb_item.uri }}" property="item" typeof="WebPage"><span property="name">{{ breadcrumb_item.label }}</span></a>
{% else %}
<span {{ breadcrumb_item.classname is defined ? 'class=' ~ breadcrumb_item.classname : '' }} property="name">{{ breadcrumb_item.label }}</span>
{% endif %}
<meta property="position" content="{{ loop.index }}">
</li>
{% endfor %}
</ul>
{% endif %}
{% else %}
{% if (route == 'profile_list.list_by_city' or route == 'profile_list.list_by_city._pagination')
and city != default_city() %}
{#{% set main = city == default_city() ? [{label: city.name, uri: path('profile_list.list_by_city', {city: city.uriIdentity})}] : [{label: 'Главная', uri: path('homepage')}, {label: city.name, uri: path('profile_list.list_by_city', {city: city.uriIdentity})}] %}#}
{% set main = isMainCity ? [{label: 'Главная', uri: path('profile_list.list_by_city', {city: city.uriIdentity})}] : [{label: 'Главная', uri: path('homepage')}, {label: city.name, uri: path('profile_list.list_by_city', {city: city.uriIdentity})}] %}
{% set children = main %}
<ul class="breadcrumbs" vocab="http://schema.org/" typeof="BreadcrumbList">
<li property="itemListElement" typeof="ListItem">
<a href="{{ (children|first).uri }}" class="std-hover-link" property="item" typeof="WebPage"><span property="name">{{ (children|first).label }}</span></a>
<meta property="position" content="0">
</li>
<li property="itemListElement" typeof="ListItem">
<span property="name">{{ (children|last).label }}</span>
<meta property="position" content="1">
</li>
</ul>
{% endif %}
{% endif %}