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.                     <dt>{% trans %}Метро{% endtrans %}</dt>
  99.                     <dd>
  100.                         {% for station in profile.stationsSortedByPrimary %}
  101.                             <a href="{{ path('profile_list.list_by_station', {'city': profile.city.uriIdentity, 'station': station.uriIdentity}) }}">{{ station.name|trans }} {% if loop.first %}*{% endif %}</a>
  102.                             {% if not loop.last %}, {% endif %}
  103.                         {% endfor %}
  104.                     </dd>
  105.                     <dt>{% trans %}Район{% endtrans %}</dt>
  106.                     <dd>
  107.                         {% for station in profile.stationsSortedByPrimary %}
  108.                             {% set stationDistrict = station.district %}
  109.                             {% if stationDistrict %}
  110.                                 {% set districtCounty = stationDistrict.county %}
  111.                                 {% if districtCounty %}
  112.                                     <a href="{{ path('profile_list.list_by_county', {'city': profile.city.uriIdentity, 'county': districtCounty.uriIdentity}) }}">{{ districtCounty.name|trans }}</a>
  113.                                 {% endif %}
  114.                             {% endif %}
  115.                         {% endfor %}
  116.                     </dd>
  117.                     {% if not profile.deleted %}
  118.                         {% if not profile.isModerationRejected %}
  119.                             <dt><strong>{% trans %}Телефон{% endtrans %}</strong></dt>
  120.                             <dd><strong>{{ profile.phoneNumber }}</strong></dd>
  121.                             {% if feature('extended_profile_form')
  122.                                 and profile.messengers
  123.                                 and profile.messengers.hasTelegram
  124.                                 and profile.messengers.telegramUsername is not empty %}
  125.                                 <dt>
  126.                                     <strong>{% trans %}Телеграм{% endtrans %}</strong> {{ profile.messengers.hasTelegram }}
  127.                                 </dt>
  128.                                 <dd><a href="https://t.me/{{ profile.messengers.telegramUsername }}"
  129.                                        target="_blank" rel="nofollow noopener">
  130.                                         @{{ profile.messengers.telegramUsername }}
  131.                                     </a></dd>
  132.                             {% endif %}
  133.                         {% endif %}
  134.                     {% else %}
  135.                         Заглушка телефона
  136.                     {% endif %}
  137.                     {% if feature('extra_category_without_prepayment') %}
  138.                         {% if profile.prepayment %}
  139.                             <dt>Оплата</dt>
  140.                             <dd>
  141.                                 Предоплата {{ profile.prepaymentAmount }}{% if profile.prepaymentComment %}. {{ profile.prepaymentComment }}{% endif %}
  142.                             </dd>
  143.                         {% elseif profile.prepayment is same as(false) %}
  144.                             <dt>Оплата</dt>
  145.                             <dd>Без предоплаты</dd>
  146.                         {% endif %}
  147.                     {% endif %}
  148.                     <dt>{% trans %}Возраст{% endtrans %}</dt>
  149.                     <dd>{{ profile.personParameters.age }}</dd>
  150.                     <dt>{% trans %}Рост{% endtrans %}</dt>
  151.                     <dd>{{ profile.personParameters.height }}</dd>
  152.                     <dt>{% trans %}Размер груди{% endtrans %}</dt>
  153.                     <dd>{{ profile.personParameters.breastSize }}</dd>
  154.                     <dt>{% trans %}Вес{% endtrans %}</dt>
  155.                     <dd>{{ profile.personParameters.weight }}</dd>
  156.                     <dt>{% trans %}Размер одежды{% endtrans %}</dt>
  157.                     <dd>{{ profile.personParameters.clothSize }}</dd>
  158.                     <dt>{% trans %}Телосложение{% endtrans %}</dt>
  159.                     <dd>{{ profile.personParameters.bodyType|body_type|trans }}</dd>
  160.                     <dt>{% trans %}Цвет волос{% endtrans %}</dt>
  161.                     <dd>{{ profile.personParameters.hairColor|hair_color|trans }}</dd>
  162.                     <dt>{% trans %}Интимная стрижка{% endtrans %}</dt>
  163.                     <dd>{{ profile.personParameters.privateHaircut|private_haircut|trans }}</dd>
  164.                     <dt>{% trans %}Национальность{% endtrans %}</dt>
  165.                     <dd>{{ profile.personParameters.nationality|nationality|trans }}</dd>
  166.                     <dt>{% trans %}Дата обновления{% endtrans %}</dt>
  167.                     <dd>{{ profile.updatedAt|date }}</dd>
  168.                 </dl>
  169.                 <h6>{% trans %}О себе{% endtrans %}</h6>
  170.                 <p>{{ profile.description|trans }}</p>
  171.                 <h6>{% trans %}Предпочтения{% endtrans %}</h6>
  172.                 {% for group, servicesGroup in services | filter((servicesGroup, group) => not profile.masseur or group not in masseurExcludeServiceGroups) %}
  173.                     <p><strong>{{ group|service_group|trans({}, 'service_groups') }}</strong></p>
  174.                     <ul>
  175.                         {% for service in servicesGroup %}
  176.                             {% set providedService = profile.providedService(service) %}
  177.                             <li class="{% if providedService %}text-success{% else %}text-danger{% endif %}">
  178.                                 <a href="{{ path('profile_list.list_by_provided_service', {'city': profile.city.uriIdentity, 'service': service.uriIdentity}) }}">{{ service.name|trans }}</a>
  179.                             </li>
  180.                             {% if providedService %}
  181.                                 {% if feature('extended_profile_form') %}
  182.                                     {{ providedService.condition|provided_service_condition|trans({},'service_conditions') }}{% if providedService.condition == 3 %}, цена:{{ providedService.extraCharge }}{% endif %}
  183.                                 {% endif %}
  184.                                 {% if providedService.comment %}
  185.                                     Комментарий: {{ providedService.comment }}
  186.                                 {% endif %}
  187.                             {% endif %}
  188.                         {% endfor %}
  189.                     </ul>
  190.                 {% endfor %}
  191.                 <h6>{% trans %}Отзывы{% endtrans %}</h6>
  192.                 <div id="comments">
  193.                     {% for comment in profile.comments %}
  194.                         {% include 'ProfilePreview/comment.html.twig' %}
  195.                     {% else %}
  196.                         <p>{% trans %}Отзывов нет{% endtrans %}</p>
  197.                     {% endfor %}
  198.                 </div>
  199.                 <div id="commentFormContainer">
  200.                 </div>
  201.                 <div id="recaptcha-container"></div>
  202.                 {% if feature('extended_profile_form') %}
  203.                     <div>
  204.                         {% if profile.expressPricing %}
  205.                             <b>Экспресс:</b>
  206.                             {% if profile.expressPricing.provided %}
  207.                                 Да, стоимость{{ profile.expressPricing.price }}
  208.                             {% else %}
  209.                                 Нет
  210.                             {% endif %}
  211.                         {% endif %}
  212.                     </div>
  213.                 {% endif %}
  214.                 {% if profile.clientTypes %}
  215.                     <div>
  216.                         <b>Услуги для:</b>
  217.                         {% for clientType in profile.clientTypes %}
  218.                             {{ clientType|client_type|trans({}, 'client_types') }}<br>
  219.                         {% endfor %}
  220.                     </div>
  221.                 {% endif %}
  222.                 {% if feature('extended_profile_form') %}
  223.                     <div>
  224.                         {% if profile.messengers %}
  225.                             <b>Мессенджеры</b><br>
  226.                             <b>Telegram</b> {{ profile.messengers.telegram ? 'Да' : 'Нет' }}
  227.                             <b>WhatsApp</b> {{ profile.messengers.whatsApp ? 'Да' : 'Нет' }}
  228.                         {% endif %}
  229.                     </div>
  230.                 {% endif %}
  231.                 {% if feature('extended_profile_form') %}
  232.                     <div>
  233.                         {% if profile.carPricing %}
  234.                             <b>В машине:</b> {{ profile.carPricing.provided ? 'Да' : 'Нет' }}
  235.                         {% endif %}
  236.                     </div>
  237.                 {% endif %}
  238.                 {% if feature('extended_profile_form') %}
  239.                     <div>
  240.                         {% if profile.personParameters.tattoo is not null %}
  241.                             <b>Тату:</b> {{ profile.personParameters.tattoo ? 'Да' : 'Нет' }}
  242.                         {% endif %}
  243.                     </div>
  244.                     <div>
  245.                         {% if profile.personParameters.piercing is not null %}
  246.                             <b>Пирсинг:</b> {{ profile.personParameters.piercing ? 'Да' : 'Нет' }}
  247.                         {% endif %}
  248.                     </div>
  249.                 {% endif %}
  250.                 <div>
  251.                     <b>Отвечаю на:</b>
  252.                     {% for answeringTo in profile.phoneCallRestrictions.answeringTo %}
  253.                         {{ answeringTo|answering_to|trans({}, 'phone_call_restrictions') }}<br>
  254.                     {% endfor %}
  255.                 </div>
  256.             </div>
  257.         </div>
  258.         {% include 'ProfilePreview/nearest_profiles.html.twig' %}
  259.         <div id="recentlyViewedProfiles"></div>
  260.     </div>
  261.     <script type="text/javascript">
  262.         var onloadCallback = function () {
  263.             grecaptcha.render('recaptcha-container', {
  264.                 'sitekey': '{{ ewz_recaptcha_site_key }}'
  265.             });
  266.         };
  267.     </script>
  268.     <script src="https://www.google.com/recaptcha/api.js?onload=onloadCallback&render=explicit" async defer></script>
  269.     <script src="{{ asset('ajax.js', 'js_script') }}"></script>
  270.     <script src="{{ asset('local-storage.js', 'js_script') }}"></script>
  271.     <script src="{{ asset('recommendations.js', 'js_script') }}"></script>
  272.     <script src="{{ asset('bot-helper.js', 'js_script') }}"></script>
  273.     <script src="{{ asset('recently-viewed.js', 'js_script') }}"></script>
  274.     <script type="text/javascript">
  275.         document.addEventListener('DOMContentLoaded', function () {
  276.             ajax({
  277.                 url: '{{ path('profile_ctr.increase_views') }}',
  278.                 data: {
  279.                     profile: {{ profile.id }},
  280.                 },
  281.                 callback: function () {},
  282.                 dataType: 'json',
  283.                 responseType: 'json',
  284.             });
  285.             profileRecommendations.addViewedProfile({{ profile.id }});
  286.             profileBotHelper.addViewedProfile({{ profile.id }});
  287.             //достаем список, пока без учета текущей страницы, для текущего аякс запроса
  288.             const recentlyViewedProfiles = recentlyViewed.getViewedProfiles();
  289.             recentlyViewed.addViewedProfile({{ profile.id }});
  290.             //recently viewed profiles
  291.             ajax({
  292.                 url: '{{ path('recent_profiles.recently_viewed.list') }}',
  293.                 data: {
  294.                     recently_viewed_profiles: recentlyViewedProfiles,
  295.                 },
  296.                 callback: function (response) {
  297.                     if (!response)
  298.                         return;
  299.                     // console.log(response);
  300.                     document.querySelector('#recentlyViewedProfiles').innerHTML = response;
  301.                 },
  302.                 dataType: 'json',
  303.                 responseType: 'text/html',
  304.             });
  305.             ajax({
  306.                 url: '{{ path('profile.comment.comment_form', {profile: profile.id}) }}',
  307.                 callback: function (response) {
  308.                     // console.log(response);
  309.                     if ('' !== response) {
  310.                         document.querySelector('#commentFormContainer').innerHTML = response;
  311.                         setCommentFormListeners();
  312.                     }
  313.                 },
  314.                 dataType: 'json',
  315.                 responseType: 'text/html',
  316.             });
  317.             function setCommentFormListeners() {
  318.                 const formName = 'comment_form';
  319.                 document.querySelector('#send_comment').addEventListener('click', function () {
  320.                     ajax({
  321.                         url: '{{ path('profile.comment.create', {profile: profile.id}) }}',
  322.                         method: '',
  323.                         data: {
  324.                             'g-recaptcha-response': grecaptcha.getResponse(),
  325.                             'entity_id': document.querySelector(`#${formName}_entity_id`).value,
  326.                             'mark': document.querySelector(`input[name="${formName}[mark]"]:checked`).value,
  327.                             'text': document.querySelector(`#${formName}_text`).value,
  328.                         },
  329.                         callback: function (response) {
  330.                             if (response) {
  331.                                 if (response.success) {
  332.                                     //document.querySelector(`#{formName}`).style.display = 'none';
  333.                                     //document.querySelector('#send_comment').style.display = 'none';
  334.                                     document.querySelector(`form[name="${formName}"]`).reset();
  335.                                     grecaptcha.reset();
  336.                                     let template =
  337.                                         '<div>' +
  338.                                         (response.comment.nickname ?
  339.                                             '<span class="author">' +
  340.                                             '<img src="#avatar" alt="shift" width="25">' +
  341.                                             '<span class="name">#nickname</span>' +
  342.                                             '</span>' : '') +
  343.                                         '<span class="date">#createdAt</span>' +
  344.                                         '<span>#text</span>' +
  345.                                         '</div>'
  346.                                     ;
  347.                                     response.comment.createdAt = new Date(response.comment.createdAt * 1000);
  348.                                     for (let k in response.comment) {
  349.                                         template = template.replace('#' + k, response.comment[k]);
  350.                                     }
  351.                                     document.querySelector('#comments').innerHTML += template;
  352.                                     // console.log(template);
  353.                                     // document.querySelector('#comments').innerHTML += response.html;
  354.                                 } else {
  355.                                     alert(response.error);
  356.                                 }
  357.                             }
  358.                         },
  359.                         dataType: 'json',
  360.                         responseType: 'json',
  361.                     });
  362.                 });
  363.             }
  364.             //LIKE/UNLIKE
  365.             document.querySelector('#left_column_metric').addEventListener('click', function (e) {
  366.                 if (false == e.target.classList.contains('add-remove-favourite'))
  367.                     return;
  368.                 addRemoveFavourite(e.target.dataset['action'] == 'add');
  369.             });
  370.             let addRemoveFavourite = function (add) {
  371.                 let btn = document.querySelector('.add-remove-favourite[data-action="' + (add ? 'add' : 'remove') + '"]');
  372.                 let reverseBtn = document.querySelector('.add-remove-favourite[data-action="' + (!add ? 'add' : 'remove') + '"]');
  373.                 btn.style.display = 'none';
  374.                 ajax({
  375.                     url: add ? '{{ path('account.favourites.add', {profile: profile.id}) }}' : '{{ path('account.favourites.remove', {profile: profile.id}) }}',
  376.                     callback: function (response) {
  377.                         if (response) {
  378.                             if (response.success) {
  379.                                 reverseBtn.style.display = 'block';
  380.                             } else {
  381.                                 btn.style.display = 'block';
  382.                                 alert(response.error);
  383.                             }
  384.                         }
  385.                     },
  386.                     dataType: 'json',
  387.                     responseType: 'json',
  388.                 });
  389.             };
  390.             //LIKE/UNLIKE end
  391.         });
  392.     </script>
  393. {% endblock %}