templates/SaloonPreview/page.html.twig line 1

Open in your IDE?
  1. {% extends 'SaloonPreview/grid.html.twig' %}
  2. {% block navbar %}
  3.     {{ parent() }}
  4.     {% set excludeRecommendationProfileIds = [] %}
  5.     {% include 'Recommendations/_profile_recommendations.html.twig' %}
  6. {% endblock %}
  7. {% block mainContainer %}
  8.     <h5 alt="{{ saloon.seo ? saloon.seo.phone : '' }}">{{ saloon.name|trans }} {{ rating }}&#9733;
  9.         {% if saloon.active %}
  10.             <small><a href="tel:{{ saloon.phoneNumber }}">{{ saloon.phoneNumber }}</a></small>
  11.         {% endif %}
  12.     </h5>
  13.     <p>{{ saloon.address|trans }}</p>
  14.     <dl>
  15.         <dt>{% trans %}Город{% endtrans %}</dt>
  16.         <dd>{{ saloon.city.name|trans }}</dd>
  17.         <dt>{% trans %}Метро{% endtrans %}</dt>
  18.         <dd>
  19.             {% for station in saloon.stationsSortedByPrimary %}
  20.                 {% if loop.first %}<strong>{{ station.name|trans }} *</strong>
  21.                 {% else %}{{ station.name|trans }}{% endif %}<br/>
  22.             {% endfor %}
  23.         </dd>
  24.         <dt>{% trans %}Район{% endtrans %}</dt>
  25.         <dd>
  26.             {% for station in saloon.stationsSortedByPrimary %}
  27.                 {% set stationDistrict = station.district %}
  28.                 {% if stationDistrict %}
  29.                     {% set districtCounty = stationDistrict.county %}
  30.                     {% if districtCounty %}
  31.                         {{ districtCounty.name|trans }}
  32.                     {% endif %}
  33.                     {{ stationDistrict.name|trans }}<br/>
  34.                 {% endif %}
  35.             {% endfor %}
  36.         </dd>
  37.         {% if saloon.active
  38.             and feature('extended_profile_form')
  39.             and saloon.messengers
  40.             and saloon.messengers.hasTelegram
  41.             and saloon.messengers.telegramUsername is not empty %}
  42.             <dt><strong>{% trans %}Телеграм{% endtrans %}</strong></dt>
  43.             <dd><a href="https://t.me/{{ saloon.messengers.telegramUsername }}"
  44.                    target="_blank" rel="nofollow noopener">
  45.                     @{{ saloon.messengers.telegramUsername }}
  46.                 </a></dd>
  47.         {% endif %}
  48.         {% if saloon.active
  49.             and feature('extra_category_with_max')
  50.             and saloon.messengers
  51.             and saloon.messengers.hasMax
  52.             and saloon.messengers.maxUrl is not empty %}
  53.             <dt><strong>MAX</strong></dt>
  54.             <dd><a href="{{ saloon.messengers.maxUrl }}"
  55.                    target="_blank" rel="nofollow noopener">MAX</a></dd>
  56.         {% endif %}
  57.     </dl>
  58.     <p>{{ saloon.description|trans }}</p>
  59.     {% if feature('extended_profile_form') %}
  60.         <h6>{% trans %}Предпочтения{% endtrans %}</h6>
  61.         {% for group, servicesGroup in services %}
  62.             <p><strong>{{ group|service_group|trans({}, 'service_groups') }}</strong></p>
  63.             <ul>
  64.                 {% for service in servicesGroup %}
  65.                     {% set providedService = saloon.providedService(service) %}
  66.                     <li class="{% if providedService %}text-success{% else %}text-danger{% endif %}">
  67.                         <a href="{{ path('profile_list.list_by_provided_service', {'city': saloon.city.uriIdentity, 'service': service.uriIdentity}) }}">{{ service.name|trans }}</a>
  68.                     </li>
  69.                     {% if providedService %}
  70.                         {{ providedService.condition|provided_service_condition|trans({},'service_conditions') }}{% if providedService.condition == 3 %}, цена:{{ providedService.extraCharge }}{% endif %}
  71.                     {% endif %}
  72.                 {% endfor %}
  73.             </ul>
  74.         {% endfor %}
  75.     {% endif %}
  76.     {% if feature('extended_profile_form') %}
  77.         <div>
  78.             {% if saloon.expressPricing %}
  79.                 <b>Экспресс:</b>
  80.                 {% if saloon.expressPricing.provided %}
  81.                     Да, стоимость{{ saloon.expressPricing.price }}
  82.                 {% else %}
  83.                     Нет
  84.                 {% endif %}
  85.             {% endif %}
  86.         </div>
  87.         <div>
  88.             {% if saloon.clientTypes %}
  89.                 <b>Услуги для:</b>
  90.                 {% for clientType in saloon.clientTypes %}
  91.                     {{ clientType|client_type|trans({}, 'client_types') }}<br>
  92.                 {% endfor %}
  93.             {% endif %}
  94.         </div>
  95.         <div>
  96.             {% if saloon.messengers %}
  97.                 <b>Мессенджеры</b><br>
  98.                 <b>Telegram</b> {{ saloon.messengers.telegram ? 'Да' : 'Нет' }}
  99.                 <b>WhatsApp</b> {{ saloon.messengers.whatsApp ? 'Да' : 'Нет' }}
  100.                 {% if feature('extra_category_with_max') %}
  101.                     <b>MAX</b> {{ saloon.messengers.max ? 'Да' : 'Нет' }}
  102.                 {% endif %}
  103.             {% endif %}
  104.         </div>
  105.     {% endif %}
  106.     <div>
  107.         <b>Отвечаю на:</b>
  108.         {% for answeringTo in saloon.phoneCallRestrictions.answeringTo %}
  109.             {{ answeringTo|answering_to|trans({}, 'phone_call_restrictions') }}<br>
  110.         {% endfor %}
  111.     </div>
  112.     {% if not saloon.deleted %}
  113.         <img src="{{ saloon.thumbnail ? asset(saloon.thumbnail.path, 'saloon_media_thumb') : '' }}" width="100"
  114.              alt="{{ saloon.seo ? saloon.seo.phone : '' }}"/>
  115.         {% for photo in saloon.photos %}
  116.             <img src="{{ asset(photo.path, 'saloon_media') }}"/>
  117.         {% endfor %}
  118.         {% if feature('extended_profile_form') %}
  119.             {% for video in saloon.videos %}
  120.                 <video width="320" height="240" controls
  121.                        poster="{{ responsive_asset(video.previewPath, 'saloon_media_video', "fullsize", "jpg") }}">
  122.                     <source src="{{ asset(video.path, 'saloon_media_video') }}">
  123.                 </video>
  124.             {% endfor %}
  125.         {% endif %}
  126.     {% else %}
  127.         Фото-заглушка
  128.     {% endif %}
  129.     {% include 'SaloonPreview/_profiles.html.twig' with {
  130.         saloon: saloon,
  131.         profiles: saloon_profiles,
  132.         total_count: saloon_profiles_total_count,
  133.         per_page: saloon_profiles_per_page,
  134.         rotation_offset: saloon_profiles_rotation_offset,
  135.     } %}
  136.     <h6>{% trans %}Отзывы{% endtrans %}</h6>
  137.     <div id="comments">
  138.         {% for comment in saloon.comments %}
  139.             {% include 'SaloonPreview/comment.html.twig' %}
  140.         {% else %}
  141.             <p>{% trans %}Отзывов нет{% endtrans %}</p>
  142.         {% endfor %}
  143.     </div>
  144.     <div id="commentFormContainer">
  145.     </div>
  146.     <div id="recaptcha-container"></div>
  147.     <script type="text/javascript">
  148.         var onloadCallback = function () {
  149.             grecaptcha.render('recaptcha-container', {
  150.                 'sitekey': '{{ ewz_recaptcha_site_key }}'
  151.             });
  152.         };
  153.     </script>
  154.     <script src="https://www.google.com/recaptcha/api.js?onload=onloadCallback&render=explicit" async defer></script>
  155.     <script src="{{ asset('ajax.js', 'js_script') }}"></script>
  156.     <script type="text/javascript">
  157.         document.addEventListener('DOMContentLoaded', function () {
  158.             ajax({
  159.                 url: '{{ path('saloon.comment.comment_form', {saloon: saloon.id}) }}',
  160.                 callback: function (response) {
  161.                     // console.log(response);
  162.                     if ('' !== response) {
  163.                         document.querySelector('#commentFormContainer').innerHTML = response;
  164.                         setCommentFormListeners();
  165.                     }
  166.                 },
  167.                 dataType: 'json',
  168.                 responseType: 'text/html',
  169.             });
  170.             function setCommentFormListeners() {
  171.                 const formName = 'comment_form';
  172.                 {# console.log(document.querySelector('input[name="{{ comment_form.mark.vars.full_name }}"]:checked').value); #}
  173.                 document.querySelector('#send_comment').addEventListener('click', function () {
  174.                     ajax({
  175.                         url: '{{ path('saloon.comment.create', {saloon: saloon.id}) }}',
  176.                         method: '',
  177.                         data: {
  178.                             'g-recaptcha-response': grecaptcha.getResponse(),
  179.                             'entity_id': document.querySelector(`#${formName}_entity_id`).value,
  180.                             'mark': document.querySelector(`input[name="${formName}[mark]"]:checked`).value,
  181.                             'text': document.querySelector(`#${formName}_text`).value,
  182.                         },
  183.                         callback: function (response) {
  184.                             if (response) {
  185.                                 if (response.success) {
  186.                                     //document.querySelector(`#{formName}`).style.display = 'none';
  187.                                     //document.querySelector('#send_comment').style.display = 'none';
  188.                                     document.querySelector(`form[name="${formName}"]`).reset();
  189.                                     grecaptcha.reset();
  190.                                     let template =
  191.                                         '<div>' +
  192.                                         (response.comment.nickname ?
  193.                                             '<span class="author">' +
  194.                                             '<img src="#avatar" alt="shift" width="25">' +
  195.                                             '<span class="name">#nickname</span>' +
  196.                                             '</span>' : '') +
  197.                                         '<span class="date">#createdAt</span>' +
  198.                                         '<span>#text</span>' +
  199.                                         '</div>'
  200.                                     ;
  201.                                     response.comment.createdAt = new Date(response.comment.createdAt * 1000);
  202.                                     for (let k in response.comment) {
  203.                                         template = template.replace('#' + k, response.comment[k]);
  204.                                     }
  205.                                     document.querySelector('#comments').innerHTML += template;
  206.                                     // console.log(template);
  207.                                     // document.querySelector('#comments').innerHTML += response.html;
  208.                                 } else {
  209.                                     alert(response.error);
  210.                                 }
  211.                             }
  212.                         },
  213.                         dataType: 'json',
  214.                         responseType: 'json',
  215.                     });
  216.                 });
  217.             }
  218.         });
  219.     </script>
  220. {% endblock %}