templates/ProfilePreview/page.html.twig line 1

Open in your IDE?
  1. {% extends 'ProfilePreview/grid.html.twig' %}
  2. {% block title %}{{ seo_title() }}{% endblock %}
  3. {% block metaDescription %}
  4.     <meta name="description" content="{{ seo_description() }}">
  5. {% endblock %}
  6. {% block navbar %}
  7.     {{ parent() }}
  8.     {% set excludeRecommendationProfileIds = [profile.id] %}
  9.     {% include 'Recommendations/_profile_recommendations.html.twig' %}
  10. {% endblock %}
  11. {% block mainContainer %}
  12.     <div class="row" alt="{{ profile.seo ? profile.seo.phone : '' }}">
  13.         <div class="col-3">
  14.             <div id="left_column_metric">
  15.                 {% if not app.user or is_user_customer(app.user) %}
  16.                     <div><a class="add-remove-favourite" data-action="remove" href="javascript:void(0);"
  17.                             style="display: {{ is_profile_in_favourites(profile) ? 'block' : 'none' }}">UNLIKE</a></div>
  18.                     <div><a class="add-remove-favourite" data-action="add"
  19.                             style="display: {{ not is_profile_in_favourites(profile) ? 'block' : 'none' }}"
  20.                             {% if app.user %}href="javascript:void(0);"
  21.                             {% else %}href="javascript:alert('Чтобы сделать что-то зарегистрируйтесь');"{% endif %}>LIKE</a>
  22.                     </div>
  23.                 {% endif %}
  24.                 <div class="row">
  25.                     {% if profile.isApproved %} <b style="color:green;">APPROVED</b><br/> {% endif %}
  26.                     {% if not profile.deleted %}
  27.                         {% if profile.isModerationRejected %}
  28.                             <img src="{{ asset('static/img/red-circle.png') }}"
  29.                                  alt="{{ profile.seo ? profile.seo.phone : '' }}" width="150">
  30.                         {% else %}
  31.                             {% set photo = profile|avatar %}
  32.                             {% if photo %}
  33.                                 <img src="{{ asset(photo.path, photo.type == 'photo' ? 'profile_media' : 'profile_media_avatar') }}"
  34.                                      alt="{{ profile.seo ? profile.seo.phone : '' }}" width="150">
  35.                             {% endif %}
  36.                         {% endif %}
  37.                     {% else %}
  38.                         Фото-заглушка
  39.                     {% endif %}
  40.                 </div>
  41.                 {% if false == profile.isModerationRejected and profile.photos|length > 0 %}
  42.                     <div class="row">
  43.                         {% if not profile.deleted %}
  44.                             {% for photo in profile.photos %}
  45.                                 <div class="col-4">
  46.                                     <img src="{{ asset(photo.path, 'profile_media') }}" alt="" width="150">
  47.                                 </div>
  48.                             {% endfor %}
  49.                         {% endif %}
  50.                     </div>
  51.                 {% endif %}
  52.                 {% if false == profile.isModerationRejected and profile.selfies|length > 0 %}
  53.                     <div class="row">
  54.                         {% if not profile.deleted %}
  55.                             {% for photo in profile.selfies %}
  56.                                 {% if photo.main == false %}
  57.                                     <div class="col-4">
  58.                                         <img src="{{ asset(photo.path, 'profile_media_selfie') }}" alt="" width="150">
  59.                                     </div>
  60.                                 {% endif %}
  61.                             {% endfor %}
  62.                         {% endif %}
  63.                     </div>
  64.                 {% endif %}
  65.                 {% if false == profile.isModerationRejected and not profile.deleted %}
  66.                     <div class="row">
  67.                         {% for video in profile.confirmedVideos | filter(video => video.previewPath) %}
  68.                             <div class="col-4">
  69.                                 <video width="100%" controls
  70.                                        poster="{{ asset(video.previewPath, 'profile_media', 'fullsize') }}">
  71.                                     <source src="{{ asset(video.path, 'profile_media', 'fullsize') }}" type="video/mp4">
  72.                                     Your browser does not support the video tag.
  73.                                 </video>
  74.                             </div>
  75.                         {% endfor %}
  76.                     </div>
  77.                 {% endif %}
  78.             </div>
  79.         </div>
  80.         <div class="col-9">
  81.             <div id="center_column_metric">
  82.                 <h5>{{ profile.name|trans }} {{ rating }}&#9733;
  83.                     {% if not profile.deleted %}
  84.                         {% if profile.isModerationRejected %}
  85.                             <h3>Анкета отклонена модератором</h3>
  86.                         {% else %}
  87.                             {% if profile.active %}
  88.                                 <small><a href="tel:{{ profile.phoneNumber }}">{{ profile.phoneNumber }}</a></small>
  89.                             {% endif %}
  90.                         {% endif %}
  91.                     {% else %}
  92.                         Заглушка телефона
  93.                     {% endif %}
  94.                 </h5>
  95.                 <dl>
  96.                     <dt>{% trans %}Город{% endtrans %}</dt>
  97.                     <dd>{{ profile.city.name|trans }}</dd>
  98.                     {% if profile_saloon %}
  99.                         <dt>{% trans %}Салон{% endtrans %}</dt>
  100.                         <dd>
  101.                             <a href="{{ path('saloon_preview.page', {'city': profile_saloon.city.uriIdentity, 'saloon': profile_saloon.uriIdentity}) }}">
  102.                                 {{ profile_saloon.name|trans }}
  103.                             </a>
  104.                         </dd>
  105.                     {% endif %}
  106.                     <dt>{% trans %}Метро{% endtrans %}</dt>
  107.                     <dd>
  108.                         {% for station in profile.stationsSortedByPrimary %}
  109.                             <a href="{{ path('profile_list.list_by_station', {'city': profile.city.uriIdentity, 'station': station.uriIdentity}) }}">{{ station.name|trans }} {% if loop.first %}*{% endif %}</a>
  110.                             {% if not loop.last %}, {% endif %}
  111.                         {% endfor %}
  112.                     </dd>
  113.                     <dt>{% trans %}Район{% endtrans %}</dt>
  114.                     <dd>
  115.                         {% for station in profile.stationsSortedByPrimary %}
  116.                             {% set stationDistrict = station.district %}
  117.                             {% if stationDistrict %}
  118.                                 {% set districtCounty = stationDistrict.county %}
  119.                                 {% if districtCounty %}
  120.                                     <a href="{{ path('profile_list.list_by_county', {'city': profile.city.uriIdentity, 'county': districtCounty.uriIdentity}) }}">{{ districtCounty.name|trans }}</a>
  121.                                 {% endif %}
  122.                             {% endif %}
  123.                         {% endfor %}
  124.                     </dd>
  125.                     {% if not profile.deleted %}
  126.                         {% if not profile.isModerationRejected %}
  127.                             <dt><strong>{% trans %}Телефон{% endtrans %}</strong></dt>
  128.                             <dd><strong>{{ profile.phoneNumber }}</strong></dd>
  129.                             {% if feature('extended_profile_form')
  130.                                 and profile.messengers
  131.                                 and profile.messengers.hasTelegram
  132.                                 and profile.messengers.telegramUsername is not empty %}
  133.                                 <dt>
  134.                                     <strong>{% trans %}Телеграм{% endtrans %}</strong> {{ profile.messengers.hasTelegram }}
  135.                                 </dt>
  136.                                 <dd><a href="https://t.me/{{ profile.messengers.telegramUsername }}"
  137.                                        target="_blank" rel="nofollow noopener">
  138.                                         @{{ profile.messengers.telegramUsername }}
  139.                                     </a></dd>
  140.                             {% endif %}
  141.                             {% if feature('extra_category_with_max')
  142.                                 and profile.messengers
  143.                                 and profile.messengers.hasMax
  144.                                 and profile.messengers.maxUrl is not empty %}
  145.                                 <dt>
  146.                                     <strong>MAX</strong>
  147.                                 </dt>
  148.                                 <dd><a href="{{ profile.messengers.maxUrl }}"
  149.                                        target="_blank" rel="nofollow noopener">MAX</a></dd>
  150.                             {% endif %}
  151.                         {% endif %}
  152.                     {% else %}
  153.                         Заглушка телефона
  154.                     {% endif %}
  155.                     {% if feature('extra_category_without_prepayment') %}
  156.                         {% if profile.prepayment %}
  157.                             <dt>Оплата</dt>
  158.                             <dd>
  159.                                 Предоплата {{ profile.prepaymentAmount }}{% if profile.prepaymentComment %}. {{ profile.prepaymentComment }}{% endif %}
  160.                             </dd>
  161.                         {% elseif profile.prepayment is same as(false) %}
  162.                             <dt>Оплата</dt>
  163.                             <dd>Без предоплаты</dd>
  164.                         {% endif %}
  165.                     {% endif %}
  166.                     <dt>{% trans %}Возраст{% endtrans %}</dt>
  167.                     <dd>{{ profile.personParameters.age }}</dd>
  168.                     <dt>{% trans %}Рост{% endtrans %}</dt>
  169.                     <dd>{{ profile.personParameters.height }}</dd>
  170.                     <dt>{% trans %}Размер груди{% endtrans %}</dt>
  171.                     <dd>{{ profile.personParameters.breastSize }}</dd>
  172.                     <dt>{% trans %}Вес{% endtrans %}</dt>
  173.                     <dd>{{ profile.personParameters.weight }}</dd>
  174.                     <dt>{% trans %}Размер одежды{% endtrans %}</dt>
  175.                     <dd>{{ profile.personParameters.clothSize }}</dd>
  176.                     <dt>{% trans %}Телосложение{% endtrans %}</dt>
  177.                     <dd>{{ profile.personParameters.bodyType|body_type|trans }}</dd>
  178.                     <dt>{% trans %}Цвет волос{% endtrans %}</dt>
  179.                     <dd>{{ profile.personParameters.hairColor|hair_color|trans }}</dd>
  180.                     <dt>{% trans %}Интимная стрижка{% endtrans %}</dt>
  181.                     <dd>{{ profile.personParameters.privateHaircut|private_haircut|trans }}</dd>
  182.                     <dt>{% trans %}Национальность{% endtrans %}</dt>
  183.                     <dd>{{ profile.personParameters.nationality|nationality|trans }}</dd>
  184.                     <dt>{% trans %}Дата обновления{% endtrans %}</dt>
  185.                     <dd>{{ profile.updatedAt|date }}</dd>
  186.                 </dl>
  187.                 <h6>{% trans %}О себе{% endtrans %}</h6>
  188.                 <p>{{ profile.description|trans }}</p>
  189.                 {% include 'ProfilePreview/_saloon.html.twig' with { saloon: profile_saloon } %}
  190.                 <h6>{% trans %}Предпочтения{% endtrans %}</h6>
  191.                 {% for group, servicesGroup in services | filter((servicesGroup, group) => not profile.masseur or group not in masseurExcludeServiceGroups) %}
  192.                     <p><strong>{{ group|service_group|trans({}, 'service_groups') }}</strong></p>
  193.                     <ul>
  194.                         {% for service in servicesGroup %}
  195.                             {% set providedService = profile.providedService(service) %}
  196.                             <li class="{% if providedService %}text-success{% else %}text-danger{% endif %}">
  197.                                 <a href="{{ path('profile_list.list_by_provided_service', {'city': profile.city.uriIdentity, 'service': service.uriIdentity}) }}">{{ service.name|trans }}</a>
  198.                             </li>
  199.                             {% if providedService %}
  200.                                 {% if feature('extended_profile_form') %}
  201.                                     {{ providedService.condition|provided_service_condition|trans({},'service_conditions') }}{% if providedService.condition == 3 %}, цена:{{ providedService.extraCharge }}{% endif %}
  202.                                 {% endif %}
  203.                                 {% if providedService.comment %}
  204.                                     Комментарий: {{ providedService.comment }}
  205.                                 {% endif %}
  206.                             {% endif %}
  207.                         {% endfor %}
  208.                     </ul>
  209.                 {% endfor %}
  210.                 <h6>{% trans %}Отзывы{% endtrans %}</h6>
  211.                 <div id="comments">
  212.                     {% for comment in profile.comments %}
  213.                         {% include 'ProfilePreview/comment.html.twig' %}
  214.                     {% else %}
  215.                         <p>{% trans %}Отзывов нет{% endtrans %}</p>
  216.                     {% endfor %}
  217.                 </div>
  218.                 <div id="commentFormContainer">
  219.                 </div>
  220.                 <div id="recaptcha-container"></div>
  221.                 {% if feature('extended_profile_form') %}
  222.                     <div>
  223.                         {% if profile.expressPricing %}
  224.                             <b>Экспресс:</b>
  225.                             {% if profile.expressPricing.provided %}
  226.                                 Да, стоимость{{ profile.expressPricing.price }}
  227.                             {% else %}
  228.                                 Нет
  229.                             {% endif %}
  230.                         {% endif %}
  231.                     </div>
  232.                 {% endif %}
  233.                 {% if profile.clientTypes %}
  234.                     <div>
  235.                         <b>Услуги для:</b>
  236.                         {% for clientType in profile.clientTypes %}
  237.                             {{ clientType|client_type|trans({}, 'client_types') }}<br>
  238.                         {% endfor %}
  239.                     </div>
  240.                 {% endif %}
  241.                 {% if feature('extended_profile_form') %}
  242.                     <div>
  243.                         {% if profile.messengers %}
  244.                             <b>Мессенджеры</b><br>
  245.                             <b>Telegram</b> {{ profile.messengers.telegram ? 'Да' : 'Нет' }}
  246.                             <b>WhatsApp</b> {{ profile.messengers.whatsApp ? 'Да' : 'Нет' }}
  247.                             {% if feature('extra_category_with_max') %}
  248.                                 <b>MAX</b> {{ profile.messengers.max ? 'Да' : 'Нет' }}
  249.                             {% endif %}
  250.                         {% endif %}
  251.                     </div>
  252.                 {% endif %}
  253.                 {% if feature('extended_profile_form') %}
  254.                     <div>
  255.                         {% if profile.carPricing %}
  256.                             <b>В машине:</b> {{ profile.carPricing.provided ? 'Да' : 'Нет' }}
  257.                         {% endif %}
  258.                     </div>
  259.                 {% endif %}
  260.                 {% if feature('extended_profile_form') %}
  261.                     <div>
  262.                         {% if profile.personParameters.tattoo is not null %}
  263.                             <b>Тату:</b> {{ profile.personParameters.tattoo ? 'Да' : 'Нет' }}
  264.                         {% endif %}
  265.                     </div>
  266.                     <div>
  267.                         {% if profile.personParameters.piercing is not null %}
  268.                             <b>Пирсинг:</b> {{ profile.personParameters.piercing ? 'Да' : 'Нет' }}
  269.                         {% endif %}
  270.                     </div>
  271.                 {% endif %}
  272.                 <div>
  273.                     <b>Отвечаю на:</b>
  274.                     {% for answeringTo in profile.phoneCallRestrictions.answeringTo %}
  275.                         {{ answeringTo|answering_to|trans({}, 'phone_call_restrictions') }}<br>
  276.                     {% endfor %}
  277.                 </div>
  278.             </div>
  279.         </div>
  280.         {% include 'ProfilePreview/nearest_profiles.html.twig' %}
  281.         <div id="recentlyViewedProfiles"></div>
  282.     </div>
  283.     <script type="text/javascript">
  284.         var onloadCallback = function () {
  285.             grecaptcha.render('recaptcha-container', {
  286.                 'sitekey': '{{ ewz_recaptcha_site_key }}'
  287.             });
  288.         };
  289.     </script>
  290.     <script src="https://www.google.com/recaptcha/api.js?onload=onloadCallback&render=explicit" async defer></script>
  291.     <script src="{{ asset('ajax.js', 'js_script') }}"></script>
  292.     <script src="{{ asset('local-storage.js', 'js_script') }}"></script>
  293.     <script src="{{ asset('recommendations.js', 'js_script') }}"></script>
  294.     <script src="{{ asset('bot-helper.js', 'js_script') }}"></script>
  295.     <script src="{{ asset('recently-viewed.js', 'js_script') }}"></script>
  296.     <script type="text/javascript">
  297.         document.addEventListener('DOMContentLoaded', function () {
  298.             ajax({
  299.                 url: '{{ path('profile_ctr.increase_views') }}',
  300.                 data: {
  301.                     profile: {{ profile.id }},
  302.                 },
  303.                 callback: function () {},
  304.                 dataType: 'json',
  305.                 responseType: 'json',
  306.             });
  307.             profileRecommendations.addViewedProfile({{ profile.id }});
  308.             profileBotHelper.addViewedProfile({{ profile.id }});
  309.             //достаем список, пока без учета текущей страницы, для текущего аякс запроса
  310.             const recentlyViewedProfiles = recentlyViewed.getViewedProfiles();
  311.             recentlyViewed.addViewedProfile({{ profile.id }});
  312.             //recently viewed profiles
  313.             ajax({
  314.                 url: '{{ path('recent_profiles.recently_viewed.list') }}',
  315.                 data: {
  316.                     recently_viewed_profiles: recentlyViewedProfiles,
  317.                 },
  318.                 callback: function (response) {
  319.                     if (!response)
  320.                         return;
  321.                     // console.log(response);
  322.                     document.querySelector('#recentlyViewedProfiles').innerHTML = response;
  323.                 },
  324.                 dataType: 'json',
  325.                 responseType: 'text/html',
  326.             });
  327.             ajax({
  328.                 url: '{{ path('profile.comment.comment_form', {profile: profile.id}) }}',
  329.                 callback: function (response) {
  330.                     // console.log(response);
  331.                     if ('' !== response) {
  332.                         document.querySelector('#commentFormContainer').innerHTML = response;
  333.                         setCommentFormListeners();
  334.                     }
  335.                 },
  336.                 dataType: 'json',
  337.                 responseType: 'text/html',
  338.             });
  339.             function setCommentFormListeners() {
  340.                 const formName = 'comment_form';
  341.                 document.querySelector('#send_comment').addEventListener('click', function () {
  342.                     ajax({
  343.                         url: '{{ path('profile.comment.create', {profile: profile.id}) }}',
  344.                         method: '',
  345.                         data: {
  346.                             'g-recaptcha-response': grecaptcha.getResponse(),
  347.                             'entity_id': document.querySelector(`#${formName}_entity_id`).value,
  348.                             'mark': document.querySelector(`input[name="${formName}[mark]"]:checked`).value,
  349.                             'text': document.querySelector(`#${formName}_text`).value,
  350.                         },
  351.                         callback: function (response) {
  352.                             if (response) {
  353.                                 if (response.success) {
  354.                                     //document.querySelector(`#{formName}`).style.display = 'none';
  355.                                     //document.querySelector('#send_comment').style.display = 'none';
  356.                                     document.querySelector(`form[name="${formName}"]`).reset();
  357.                                     grecaptcha.reset();
  358.                                     let template =
  359.                                         '<div>' +
  360.                                         (response.comment.nickname ?
  361.                                             '<span class="author">' +
  362.                                             '<img src="#avatar" alt="shift" width="25">' +
  363.                                             '<span class="name">#nickname</span>' +
  364.                                             '</span>' : '') +
  365.                                         '<span class="date">#createdAt</span>' +
  366.                                         '<span>#text</span>' +
  367.                                         '</div>'
  368.                                     ;
  369.                                     response.comment.createdAt = new Date(response.comment.createdAt * 1000);
  370.                                     for (let k in response.comment) {
  371.                                         template = template.replace('#' + k, response.comment[k]);
  372.                                     }
  373.                                     document.querySelector('#comments').innerHTML += template;
  374.                                     // console.log(template);
  375.                                     // document.querySelector('#comments').innerHTML += response.html;
  376.                                 } else {
  377.                                     alert(response.error);
  378.                                 }
  379.                             }
  380.                         },
  381.                         dataType: 'json',
  382.                         responseType: 'json',
  383.                     });
  384.                 });
  385.             }
  386.             //LIKE/UNLIKE
  387.             document.querySelector('#left_column_metric').addEventListener('click', function (e) {
  388.                 if (false == e.target.classList.contains('add-remove-favourite'))
  389.                     return;
  390.                 addRemoveFavourite(e.target.dataset['action'] == 'add');
  391.             });
  392.             let addRemoveFavourite = function (add) {
  393.                 let btn = document.querySelector('.add-remove-favourite[data-action="' + (add ? 'add' : 'remove') + '"]');
  394.                 let reverseBtn = document.querySelector('.add-remove-favourite[data-action="' + (!add ? 'add' : 'remove') + '"]');
  395.                 btn.style.display = 'none';
  396.                 ajax({
  397.                     url: add ? '{{ path('account.favourites.add', {profile: profile.id}) }}' : '{{ path('account.favourites.remove', {profile: profile.id}) }}',
  398.                     callback: function (response) {
  399.                         if (response) {
  400.                             if (response.success) {
  401.                                 reverseBtn.style.display = 'block';
  402.                             } else {
  403.                                 btn.style.display = 'block';
  404.                                 alert(response.error);
  405.                             }
  406.                         }
  407.                     },
  408.                     dataType: 'json',
  409.                     responseType: 'json',
  410.                 });
  411.             };
  412.             //LIKE/UNLIKE end
  413.         });
  414.     </script>
  415. {% endblock %}