templates/SaloonList/list.saloons.html.twig line 1

Open in your IDE?
  1. {%- macro _get_min(price1, price2, currency) -%}
  2.     {%- set price1 = price1 is defined and price1 > 0 ? price1 : 999999999 -%}
  3.     {%- set price2 = price2 is defined and price2 > 0 ? price2 : 999999999 -%}
  4.     {%- set currency = currency == 'USD' ? '$' : (currency == 'RUB' ? '₽' : '')  -%}
  5.     {%- if price1 == 999999999 and price2 == 999999999 -%}
  6.         -
  7.     {%- elseif price1 == 999999999 -%}
  8.         {{price2|number_format(0, '.', ' ')}} {{ currency }}
  9.     {%- elseif price2 == 999999999 -%}
  10.         {{price1|number_format(0, '.', ' ')}} {{ currency }}
  11.     {%- else -%}
  12.         {{ min([price1,price2])|number_format(0, '.', ' ') }} {{ currency }}
  13.     {%- endif -%}
  14. {%- endmacro -%}
  15. {%- macro _gen_alt(profile) -%}
  16.     {%- set morpID = profile.id -%}
  17.     {%- set firstStation = '' -%}
  18.     {%- if profile.stations|length > 0 -%}
  19.         {%- set firstStation = profile.stations|first -%}
  20.     {%- endif -%}
  21.     {%- set staticData = " " ~ profile.name ~ (firstStation ? ', ' ~ firstStation.name|trans : '' ) ~ ", " ~ profile.id -%}
  22.     {{- "Анкета " ~ "салона|вип салона|интим салона|салона досуга|мужского салона|салона для мужчин"|seo_morphing(morpID) ~ staticData -}}
  23. {%- endmacro -%}
  24. {%- for saloon in saloons -%}
  25.     {%- set lazyLoad = loop.index == 1 -%}
  26.     {%- set isProfileInDefaultCity = saloon.city.uriIdentity == default_city().uriIdentity -%}
  27.     {%- set isProfileWithSubway = saloon.stations|length > 0 -%}
  28.     <li class="card saloon-card d-flex white-round" data-profile-id="{{ saloon.id }}">
  29.         <div class="card__avatar saloon-card__avatar card-link">
  30.             <a class="profile-card__avatar-link" href="{{ path('saloon_preview.page', {'city': saloon.city.uriIdentity, 'saloon': saloon.uriIdentity}) }}" target="_blank">
  31.                 {%- set photo = saloon.thumbnail -%}
  32.                 {% if photo %}
  33.                     {%- if photo.path -%}
  34.                         <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">
  35.                     {%- else -%}
  36.                         <img class="card__avatar-image saloon-card__avatar-image"  src="{{ asset('assets/images/empty-photo.svg') }}" style="object-fit:contain;padding:10px;" />
  37.                     {%- endif -%}
  38.                 {%- else -%}
  39.                     <img class="card__avatar-image saloon-card__avatar-image"  src="{{ asset('assets/images/empty-photo.svg') }}" style="object-fit:contain;padding:10px;" />
  40.                 {% endif %}
  41.             </a>
  42.         </div>
  43.         <div class="saloon-card__bio mt-2 mb-2">
  44.             <div class="card__bio-name saloon-card__bio-name mb-1">
  45.                 <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 }}">
  46.                     <span class="profile-card__bio-text mr-1">{{ saloon.name|trans }}</span>
  47.                 </a>
  48.             </div>
  49.             <div class="profile-card__metro d-flex-c">
  50.                 {# Profile in default city and with subway station #}
  51.                 {%- if isProfileInDefaultCity and isProfileWithSubway -%}
  52.                     {# If its station listing #}
  53.                     {%- if 'profile_list.list_by_station' in app.request.get('_route') -%}
  54.                         {%- set station = app.request.attributes.get('station') -%}
  55.                     {%- else -%}
  56.                         {%- set station = saloon.stations|first -%}
  57.                     {%- endif -%}
  58.                     {%- include 'components/metro/icon_generate.partial.twig' with {data: station.id|station_lines} -%}
  59.                     <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 }}">
  60.                         {{- station.name -}}
  61.                     </a>
  62.                 {%- else -%}
  63.                     {# Profile in default city and without subway station #}
  64.                     {%- if isProfileInDefaultCity -%}
  65.                         <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 }}">
  66.                             <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>
  67.                             <span>{{ saloon.city.name|trans }}</span>
  68.                         </a>
  69.                     {%- else -%}
  70.                         {# На городах МО вырезать город с тумбы анкеты на листингах #}
  71.                         {# <div class="is-flex level">
  72.                             <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>
  73.                             <span>{{ profile.city.name|trans }}</span>
  74.                         </div> #}
  75.                     {%- endif -%}
  76.                 {%- endif -%}
  77.             </div>
  78.         </div>
  79.         {%- set currencyProfile -%}{{ saloon.city.countryCode|country_currency }}{%- endset -%}
  80.         {%- set minPriceHour -%}{{ _self._get_min(saloon.apartmentsPricing.oneHourPrice,saloon.takeOutPricing.oneHourPrice,currencyProfile) }}{%- endset -%}
  81.         {%- set minPriceTwo -%}{{ _self._get_min(saloon.apartmentsPricing.twoHoursPrice,saloon.takeOutPricing.twoHoursPrice,currencyProfile) }}{%- endset -%}
  82.         {%- set minPriceNight -%}{{ _self._get_min(saloon.apartmentsPricing.nightPrice,saloon.takeOutPricing.nightPrice,currencyProfile) }}{%- endset -%}
  83.         {# {%- set hasOutPrice -%}{{- _self._check_out_price(saloon.takeOutPricing.oneHourPrice,saloon.takeOutPricing.twoHoursPrice,saloon.takeOutPricing.nightPrice) -}}{%- endset -%} #}
  84.         <div class="card-time saloon-card-time">
  85.             <div class="card-time-item d-flex clr-pre-white-bg">
  86.                 <span class="card-time-title">Час</span>
  87.                 <span class="card-time-value fw-700 ml-auto clr-main-text">{{ minPriceHour != '-' ? minPriceHour : '-' }}</span>
  88.             </div>
  89.             <div class="card-time-item d-flex clr-pre-white-bg">
  90.                 <span class="card-time-title">2 часа</span>
  91.                 <span class="card-time-value fw-700 ml-auto clr-main-text">{{ minPriceTwo != '-' ? minPriceTwo : '-' }}</span>
  92.             </div>
  93.             <div class="card-time-item d-flex clr-pre-white-bg">
  94.                 <span class="card-time-title">Ночь</span>
  95.                 <span class="card-time-value fw-700 ml-auto clr-main-text">{{ minPriceNight != '-' ? minPriceNight : '-' }}</span>
  96.             </div>
  97.             {# <div class="card-time-item d-flex">
  98.                 <span class="card-time-title">Выезд</span>
  99.                 <span class="card-time-value fw-700 ml-auto clr-main-text">{{ hasOutPrice == '1' ? 'Есть' : '-' }}</span>
  100.             </div> #}
  101.         </div>
  102.         {# {% if saloon.isActive or not saloon.hidden %}
  103.             <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')">
  104.                 <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>
  105.                 <span class="btn-text">Показать телефон</span>
  106.             </button>
  107.             <!--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">
  108.                 <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>
  109.                 <span class="btn-text">{{- saloon.phoneNumber -}}</span>
  110.             </a><!--/noindex-->
  111.         {%- endif -%} #}
  112.     </li>
  113. {%- endfor -%}