{%- macro _get_min(price1, price2, currency) -%}
{%- set price1 = price1 is defined and price1 > 0 ? price1 : 999999999 -%}
{%- set price2 = price2 is defined and price2 > 0 ? price2 : 999999999 -%}
{%- set currency = currency == 'USD' ? '$' : (currency == 'RUB' ? '₽' : '') -%}
{%- if price1 == 999999999 and price2 == 999999999 -%}
-
{%- elseif price1 == 999999999 -%}
{{price2|number_format(0, '.', ' ')}} {{ currency }}
{%- elseif price2 == 999999999 -%}
{{price1|number_format(0, '.', ' ')}} {{ currency }}
{%- else -%}
{{ min([price1,price2])|number_format(0, '.', ' ') }} {{ currency }}
{%- endif -%}
{%- endmacro -%}
{%- macro _gen_alt(profile) -%}
{%- set morpID = profile.id -%}
{%- set firstStation = '' -%}
{%- if profile.stations|length > 0 -%}
{%- set firstStation = profile.stations|first -%}
{%- endif -%}
{%- set staticData = " " ~ profile.name ~ (firstStation ? ', ' ~ firstStation.name|trans : '' ) ~ ", " ~ profile.id -%}
{{- "Анкета " ~ "салона|вип салона|интим салона|салона досуга|мужского салона|салона для мужчин"|seo_morphing(morpID) ~ staticData -}}
{%- endmacro -%}
{%- for saloon in saloons -%}
{%- set lazyLoad = loop.index == 1 -%}
{%- set isProfileInDefaultCity = saloon.city.uriIdentity == default_city().uriIdentity -%}
{%- set isProfileWithSubway = saloon.stations|length > 0 -%}
<li class="card saloon-card d-flex white-round" data-profile-id="{{ saloon.id }}">
<div class="card__avatar saloon-card__avatar card-link">
<a class="profile-card__avatar-link" href="{{ path('saloon_preview.page', {'city': saloon.city.uriIdentity, 'saloon': saloon.uriIdentity}) }}" target="_blank">
{%- set photo = saloon.thumbnail -%}
{% if photo %}
{%- if photo.path -%}
<img class="card__avatar-image saloon-card__avatar-image" src="{{ responsive_asset(photo.path, 'saloon_media_thumb', "310x434", "jpg") }}" alt="{{- _self._gen_alt(saloon) -}}"{% if not lazyLoad %} loading="lazy"{% endif %} width="310" height="434">
{%- else -%}
<img class="card__avatar-image saloon-card__avatar-image" src="{{ asset('assets/images/empty-photo.svg') }}" style="object-fit:contain;padding:10px;" />
{%- endif -%}
{%- else -%}
<img class="card__avatar-image saloon-card__avatar-image" src="{{ asset('assets/images/empty-photo.svg') }}" style="object-fit:contain;padding:10px;" />
{% endif %}
</a>
</div>
<div class="saloon-card__bio mt-2 mb-2">
<div class="card__bio-name saloon-card__bio-name mb-1">
<a class="profile-card__bio-link fw-600 link" href="{{ path('saloon_preview.page', {'city': saloon.city.uriIdentity, 'saloon': saloon.uriIdentity}) }}" target="_blank" title="{{ saloon.name|trans }}">
<span class="profile-card__bio-text mr-1">{{ saloon.name|trans }}</span>
</a>
</div>
<div class="profile-card__metro d-flex-c">
{# Profile in default city and with subway station #}
{%- if isProfileInDefaultCity and isProfileWithSubway -%}
{# If its station listing #}
{%- if 'profile_list.list_by_station' in app.request.get('_route') -%}
{%- set station = app.request.attributes.get('station') -%}
{%- else -%}
{%- set station = saloon.stations|first -%}
{%- endif -%}
{%- include 'components/metro/icon_generate.partial.twig' with {data: station.id|station_lines} -%}
<a class="card__metro-link metro-link" href="{{ path('profile_list.list_by_station', {'city': saloon.city.uriIdentity, 'station': station.uriIdentity}) }}" target="_blank" title="{{ station.name }}">
{{- station.name -}}
</a>
{%- else -%}
{# Profile in default city and without subway station #}
{%- if isProfileInDefaultCity -%}
<a class="card__metro-link metro-link" href="{{ path('profile_list.list_by_city', {'city': saloon.city.uriIdentity}) }}" target="_blank" title="{{ saloon.city.name|trans }}">
<svg class="mr-1" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none"><path fill="#FF3F40" d="M.22 8.08c.25.24.49.32.97.32l5.25.02c.05 0 .09 0 .1.03.03.02.04.06.04.1l.02 5.26c0 .48.08.72.32.97.33.33.79.27 1.13-.06.18-.18.32-.48.45-.75l5.3-11.45c.29-.58.25-1-.03-1.3-.28-.27-.71-.3-1.3-.03L1.05 6.5c-.28.14-.58.28-.76.46-.33.34-.39.8-.06 1.13"/></svg>
<span>{{ saloon.city.name|trans }}</span>
</a>
{%- else -%}
{# На городах МО вырезать город с тумбы анкеты на листингах #}
{# <div class="is-flex level">
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M8 0C6.06694 0 4.5 1.76281 4.5 3.9375C4.5 5.69562 6.7875 8.9 7.66389 10.0631C7.84139 10.2987 8.15889 10.2987 8.33611 10.0631C9.2125 8.9 11.5 5.69562 11.5 3.9375C11.5 1.76281 9.93306 0 8 0ZM0.558889 6.74844C0.393938 6.82266 0.252536 6.95078 0.152919 7.11626C0.0533024 7.28175 3.95058e-05 7.47701 0 7.67688L0 15.4994C0 15.8531 0.3175 16.095 0.609444 15.9637L4 13.9997V7.71625C3.75444 7.21688 3.14389 6.465 3 6L0.558889 6.74844ZM8 12.2397C7.60917 12.2397 7.23944 12.0466 6.98583 11.7097C6.43972 10.9847 5.85889 10.1591 5.33333 9.31219V13.9997L10.6667 15.9997V9.3125C10.1411 10.1591 9.56056 10.985 9.01417 11.71C8.76056 12.0466 8.39083 12.2397 8 12.2397ZM15.3906 5.03625L12 7.71625V15.9637L15.4411 14.2516C15.6061 14.1774 15.7475 14.0493 15.8471 13.8838C15.9468 13.7183 16 13.523 16 13.3231V5.50063C16 5.14688 15.6825 4.905 15.3906 5.03625Z" fill="#FF3F40"/></svg>
<span>{{ profile.city.name|trans }}</span>
</div> #}
{%- endif -%}
{%- endif -%}
</div>
</div>
{%- set currencyProfile -%}{{ saloon.city.countryCode|country_currency }}{%- endset -%}
{%- set minPriceHour -%}{{ _self._get_min(saloon.apartmentsPricing.oneHourPrice,saloon.takeOutPricing.oneHourPrice,currencyProfile) }}{%- endset -%}
{%- set minPriceTwo -%}{{ _self._get_min(saloon.apartmentsPricing.twoHoursPrice,saloon.takeOutPricing.twoHoursPrice,currencyProfile) }}{%- endset -%}
{%- set minPriceNight -%}{{ _self._get_min(saloon.apartmentsPricing.nightPrice,saloon.takeOutPricing.nightPrice,currencyProfile) }}{%- endset -%}
{# {%- set hasOutPrice -%}{{- _self._check_out_price(saloon.takeOutPricing.oneHourPrice,saloon.takeOutPricing.twoHoursPrice,saloon.takeOutPricing.nightPrice) -}}{%- endset -%} #}
<div class="card-time saloon-card-time">
<div class="card-time-item d-flex clr-pre-white-bg">
<span class="card-time-title">Час</span>
<span class="card-time-value fw-700 ml-auto clr-main-text">{{ minPriceHour != '-' ? minPriceHour : '-' }}</span>
</div>
<div class="card-time-item d-flex clr-pre-white-bg">
<span class="card-time-title">2 часа</span>
<span class="card-time-value fw-700 ml-auto clr-main-text">{{ minPriceTwo != '-' ? minPriceTwo : '-' }}</span>
</div>
<div class="card-time-item d-flex clr-pre-white-bg">
<span class="card-time-title">Ночь</span>
<span class="card-time-value fw-700 ml-auto clr-main-text">{{ minPriceNight != '-' ? minPriceNight : '-' }}</span>
</div>
{# <div class="card-time-item d-flex">
<span class="card-time-title">Выезд</span>
<span class="card-time-value fw-700 ml-auto clr-main-text">{{ hasOutPrice == '1' ? 'Есть' : '-' }}</span>
</div> #}
</div>
{# {% if saloon.isActive or not saloon.hidden %}
<button class="card__phone saloon-card__phone btn btn-main-border btn-fluid fw-600 mt-auto" type="button" onclick="this.classList.add('d-none');this.nextElementSibling.classList.remove('d-none')">
<svg class="btn-icon" viewbox="0 0 21 20" fill="none"><path d="M6.583 2.5H3.666a.836.836 0 0 0-.833.834C2.833 11.159 9.175 17.5 17 17.5a.836.836 0 0 0 .833-.833v-2.908a.836.836 0 0 0-.833-.834 9.503 9.503 0 0 1-2.975-.475.7.7 0 0 0-.259-.041.854.854 0 0 0-.591.241l-1.834 1.834A12.625 12.625 0 0 1 5.85 8.992l1.833-1.833a.836.836 0 0 0 .208-.85 9.467 9.467 0 0 1-.475-2.975.836.836 0 0 0-.833-.834Z"/></svg>
<span class="btn-text">Показать телефон</span>
</button>
<!--noindex--><a href="tel:{{ saloon.phoneNumber|replace({' ':'', '-':''}) }}" rel="nofollow" class="card__phone saloon-card__phone btn btn-main-border btn-fluid fw-600 mt-auto is-active d-none">
<svg class="btn-icon" viewbox="0 0 21 20" fill="none"><path d="M6.583 2.5H3.666a.836.836 0 0 0-.833.834C2.833 11.159 9.175 17.5 17 17.5a.836.836 0 0 0 .833-.833v-2.908a.836.836 0 0 0-.833-.834 9.503 9.503 0 0 1-2.975-.475.7.7 0 0 0-.259-.041.854.854 0 0 0-.591.241l-1.834 1.834A12.625 12.625 0 0 1 5.85 8.992l1.833-1.833a.836.836 0 0 0 .208-.85 9.467 9.467 0 0 1-.475-2.975.836.836 0 0 0-.833-.834Z"/></svg>
<span class="btn-text">{{- saloon.phoneNumber -}}</span>
</a><!--/noindex-->
{%- endif -%} #}
</li>
{%- endfor -%}