templates/ProfileList/list.profiles.html.twig line 1

Open in your IDE?
  1. {# {% set result = [] %} #}
  2. {# {% set isTopProfilesExist = top_profile is defined and null != top_profile and null != profiles %}
  3. {{dump( top_profile in profiles.array|keys )}}
  4. {% if isTopProfilesExist and top_profile in profiles.array|keys %}
  5.     {% set result = [] %}
  6.     {% for key, profile in profiles.array %}
  7.         {% if profile != top_profile %}
  8.             {% set result = result|merge([profile])%}
  9.         {% endif %}
  10.     {% endfor %}
  11.     {% set result = [top_profile]|merge(result) %}
  12. {% endif %}
  13. {{dump( result )}} #}
  14. {% set profiles_array = [] %}
  15. {% if profiles != null %}
  16.     {% if profiles.array is defined %}
  17.         {# Legacy listing provider #}
  18.         {% set profiles_array = profiles.array %}
  19.     {% else %}
  20.         {# New listing microservice. Profiles array already contains top placement #}
  21.         {% set profiles_array = profiles %}
  22.     {% endif %}
  23. {% endif %}
  24. {% set hidePreferredButton = hidePreferredButton is defined ? hidePreferredButton : false %}
  25. {% set likeButton = likeButton is defined ? likeButton : false %}
  26. {% set showPhoneNumberOnBottom = true %}
  27. {% set showAgeFromParentDefined = showAgeProfileAfterName is defined %}
  28. {% set showAgeFromParent = showAgeFromParentDefined ? showAgeProfileAfterName : false %}
  29. {%- set countHasOutPrice = 0 -%}
  30. {%- for profile in profiles_array -%}
  31.     {# Наличие цены на выезд #}
  32.     {%- set isHasOutPricing = 
  33.         profile.takeOutPricing.oneHourPrice is not null or
  34.         profile.takeOutPricing.twoHoursPrice is not null or
  35.         profile.takeOutPricing.nightPrice is not null 
  36.     -%}
  37.     {# Колво цены на выезд #}
  38.     {% set countHasOutPrice = isHasOutPricing ? countHasOutPrice + 1 : countHasOutPrice %}
  39.     {# Нужно ли показывать пункт ВЫЕЗД в карточке профиля #}
  40.     {% set showOutProfileInfo = countHasOutPrice < 17 and isHasOutPricing %}
  41.     {# Нужно ли показывать возраст в правой колонке с информацией #}
  42.     {% set hasGender = profile.isMasseur is defined %}
  43.     {% set showAgeProfileInfo = hasGender ? (profile.isMasseur ? false : true) : true %}
  44.     {# возраст только у первых 16ти анкет #}
  45.     {# {% set showAgeProfileAfterName = showAgeFromParentDefined ? showAgeFromParent : loop.index < 17 %} #}
  46.     {% set showAgeProfileAfterName = false %}
  47.     {% set showPhoneNumberOnBottom = hasGender ? (profile.isMasseur ? false : true) : true %}
  48.     {%- set lazyLoad = loop.index == 1 -%}
  49.     {% include 'ProfileList/profile.html.twig' with {
  50.         profile: profile,
  51.         lazyLoad: lazyLoad,
  52.         isProfileTop: (loop.first and profile is top_placement),
  53.         showOutProfileInfo: showOutProfileInfo,
  54.         showAgeProfileInfo: showAgeProfileInfo,
  55.         showAgeProfileAfterName: showAgeProfileAfterName,
  56.         showPhoneNumberOnBottom: showPhoneNumberOnBottom,
  57.     } %}
  58. {%- endfor -%}