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