templates/Slivki/offers/teaser.html.twig line 1

Open in your IDE?
  1. {% set teaserAnchorClass = '' %}
  2. {% if not offer.isHideNoveltyLabel() and offer.getActiveSince().diff(date()).days <= 5 %}
  3.     {% set teaserAnchorClass = 'newProduct' %}
  4. {% endif %}
  5. {% set offerURL = urlWithDomain is defined ? urlWithDomain : getURL("Slivki:Default:details", offer.getID(), true) %}
  6. {% set teaserStatDays = 30 %}
  7. {% set daysFromStrart = date(offer.getActiveSince|date).diff(date('now')).days %}
  8. {% set daysFromStrart = daysFromStrart < teaserStatDays ? daysFromStrart : teaserStatDays %}
  9. {% set daysFromStrart = daysFromStrart == 0 ? 1 : daysFromStrart %}
  10.     {% if isMailing is defined and isMailing %}
  11.         <input type="checkbox" class="marketActionCheckBox"/>
  12.         <input type="checkbox" style="float: left;" name="mainTeaser" class="marketActionRadio"/>
  13.     {% endif %}
  14. <div class="stock-group-item" id='action{{ offer.getID() }}' data-id="{{ offer.getID() }}" data-pixel={{ offer.getID() == constant('Slivki\\Entity\\Offer::BETERA_OFFER_ID') ? 'https://amc.yandex.ru/show?cmn_id=26372&plt_id=194140&crv_id=464043&evt_t=render&ad_type=banner&rnd=%system.random%' }}>
  15.     {% block imageDiv %}
  16.     {% if noLazyLoad is defined %}
  17.     <div class="images {% if offer.getDetailMedias()|length > 0 %}tiaser-carousel{% endif %}"
  18.          style="display: block; background-image: url('{{ getImageURL(offer.getTeaserMedia(), 250, 162) }}')"
  19.          onclick="window.open('{{ offerURL }}' + location.search);">
  20.         {% else %}
  21.         <div class="images lazy {% if offer.getDetailMedias()|length > 0 %}tiaser-carousel{% endif %}"
  22.              data-original="{{ getImageURL(offer.getTeaserMedia(), 500, 324) }}"
  23.              onclick="window.open('{{ offerURL }}' + location.search);">
  24.             {% endif %}
  25.             {% endblock %}
  26.             <img class="image" src="{{ getImageURL(offer.getTeaserMedia(), 500, 324) }}"
  27.                  alt=""/>
  28.             {% for media in offer.getDetailMedias()|slice(1, 8) %}
  29.                 <img class="image d-none" src="{{ getImageURL(media, 500, 324) }}"
  30.                      alt="{{ media.getDescription() }}" border="0"/>
  31.             {% endfor %}
  32.             {% if offer.getDetailMedias()|length > 8 %}
  33.                 <div class="brazzers-more d-none">
  34.                     <div class="brazzers-more__wrapper">
  35.                         <div class="brazzers-more__icon"></div>
  36.                         <div class="brazzers-more__text">Еще {{ offer.getDetailMedias()|length - 3 }} фото</div>
  37.                     </div>
  38.                 </div>
  39.             {% endif %}
  40.             {% if galleryVideos.getVideos() is defined and galleryVideos.getVideos()|length > 0 %}
  41.                 <div class="story-teaser-img">
  42.                     <img src="/images/play-offer-story.svg" alt="Истории"/>
  43.                 </div>
  44.             {% endif %}
  45.             {% if not offer.isHideNoveltyLabel() and offer.getActiveSince().diff(date()).days <= constant('Slivki\\Services\\Category\\NewOfferCategoryService::NEW_OFFER_PERIOD_DAYS') %}
  46.                 <div class="new-offer-watermark">
  47.                     Новая
  48.                 </div>
  49.             {% endif %}
  50.             {% if offer.getOnlineOrderSettings() is not null and offer.getOnlineOrderSettings().getDeliveryWorkingTime() is not null %}
  51.             {% set workingDeliveryTime = (offer.getOnlineOrderSettings().getDeliveryWorkingTime())|json_decode()["now"|date("w")] %}
  52.             {% set startTime = workingDeliveryTime.startTime|date('H:i') %}
  53.             {% set endTime = workingDeliveryTime.endTime|date('H:i') %}
  54.             {% set dayOff = workingDeliveryTime.dayOff %}
  55.             {% set nowTime = "now"|date("H:i") %}
  56.             {% if startTime == endTime and not dayOff %}ы
  57.                 <a href="{{ offerURL }}" class="open-delivery-info d-none" target="_blank">ДОСТАВКА КРУГЛОСУТОЧНО</a>
  58.                 {% endif %}
  59.             {% endif %}
  60.             <a href="{{ offerURL }}" target="_blank" class="details-link {{ teaserAnchorClass }}">
  61.                 {% if offer.getCaptionName()|trim %}
  62.                     <div class="info-line" style="background-color: {{ offer.getCaptionColor() }};">
  63.                         <div>{{ offer.getCaptionName() }}</div>
  64.                     </div>
  65.                 {% endif %}
  66.                 {% if offer.getRegionalCaptionName()|trim %}
  67.                     <div class="info-line regional"
  68.                          style="background-color: {{ offer.getRegionalCaptionColor() }}; display: none;">
  69.                         <div>{{ offer.getRegionalCaptionName() }}</div>
  70.                     </div>
  71.                 {% endif %}
  72.             </a>
  73.             {% if offer.getHint() and offer.getHint()|trim != '' %}
  74.                 <div class="teaser-hint">
  75.                     <div class="teaser-hint-inner">{{ offer.getHint()|raw }}</div>
  76.                 </div>
  77.             {% endif %}
  78.             {% if showManicurePrice is defined and showManicurePrice and offer.getPrice() %}
  79.                 <div class="info-line manicure-price">
  80.                     <div>Маникюр под ключ {{ offer.getPrice()|number_format(2, ',', '') }} руб</div>
  81.                 </div>
  82.             {% endif %}
  83.         </div>
  84.         {% set supplierLogo = getTeaserWatermark(offer.getID()) %}
  85.         {% if supplierLogo|length > 0 %}
  86.             {% set supplierLogoWidth = supplierLogo.width ? supplierLogo.width : 65 %}
  87.             <div class="teaser--supplier-logo">
  88.                 <img style="{{ supplierLogo.width ? 'width:' ~ supplierLogo.width ~ 'px;' }}{{ supplierLogo.height ? 'height:' ~ supplierLogo.height ~ 'px;' }}"
  89.                      src="{{ getImageURL(supplierLogo.watermark, 2 * supplierLogoWidth, 0) }}" alt=""/>
  90.             </div>
  91.         {% endif %}
  92.         {% block favorite %}{% endblock %}
  93.         {% if not offer.isWithoutCodes() %}
  94.             <div class="discount-label">{{ offer.getDiscountLabelText() }}</div>
  95.         {% endif %}
  96.         <div class="top">
  97.             {% set rating = offer.getRating() %}
  98.             {% set ratingPercentage = rating * 100 / 5 %}
  99.             {% set ratingCount = getOfferCommentsCount(offer.getID()) %}
  100.             <div class="d-flex align-items-center">
  101.                 {% if ratingCount > 0 or rating > 0 %}
  102.                     <div class="star-ratings-css">
  103.                         {% if rating > 0 %}
  104.                             <div class="star-ratings-css-top" style="width: {{ ratingPercentage }}%">
  105.                                 <span>★</span>
  106.                             </div>
  107.                         {% else %}
  108.                             <div class="star-ratings-css-bottom">
  109.                                 <span>★</span>
  110.                             </div>
  111.                         {% endif %}
  112.                     </div>
  113.                     <div class="rating-value" style="margin-right: 2px;">{{ rating|round(2, 'ceil') }}</div>
  114.                     <div class="rating-value" data-toggle="tooltip" data-placement="top"
  115.                          data-original-title="Количество комментариев к данной акции">
  116.                         ({{ getOfferCommentsCount(offer.getID()) }})
  117.                     </div>
  118.                 {% endif %}
  119.             </div>
  120.             {% if offer.getGeoLocations().count() > 0 %}
  121.                 <div class="geo-location-block">
  122.                     <div class="distance" data-toggle="distance-tooltip" data-placement="top"
  123.                          data-original-title="Расстояние от Вас до объекта">
  124.                         <i class="slivki-icon slivki-icon-direction"></i>
  125.                         <img class='ajaxLoader' src='/images/ajax-loader-16x16.gif' alt='Загрузка...'/>
  126.                         <span></span>
  127.                     </div>
  128.                     {% include 'Slivki/offers/geo_location_data.html.twig' with {'offer': offer} only %}
  129.                 </div>
  130.             {% endif %}
  131.         </div>
  132.         <div class="teaser-same-height">
  133.             <div class="title">
  134.                 <a href="{{ offerURL }}" target="_blank" class="details-link "
  135.                    style="color: {{ offer.getTitleFontColor() }};">{{ offer.getTitle()|raw }}</a>
  136.             </div>
  137.         </div>
  138.         <a class="details-link marketActionLink" href="{{ offerURL }}" target="_blank">
  139.             <div class="address" data-toggle="tooltip" data-placement="top"
  140.                  data-original-title="Ориентир">{{ offer.getAddress() }}</div>
  141.         </a>
  142.         <div class="bottom d-flex font-size-0680">
  143.             {% set daysLeft = offer.getActiveTill().diff(date()).days %}
  144.             {% if not offer.isWithoutCodes() %}
  145.                 <a href="{{ offerURL }}" target="_blank" class="bottom-item" data-toggle="tooltip" data-placement="top"
  146.                    data-original-title='Взято кодов за {{ daysFromStrart }} {{ ['день', 'дня', 'дней']|plural(daysFromStrart) }}'>
  147.                     <i class="slivki-icon slivki-icon-users"></i>
  148.                     <span>{{ getOfferMonthlyPurchaseCount(offer.getID()) }}</span>
  149.                 </a>
  150.             {% endif %}
  151.             <div class="bottom-item" data-toggle="tooltip" data-placement="top"
  152.                  data-original-title='Просмотров за {{ daysFromStrart }} {{ ['день', 'дня', 'дней']|plural(daysFromStrart) }}'>
  153.                 <i class="slivki-icon slivki-icon-eye"></i>
  154.                 <span>{{ getOfferVisitCount(offer) }}</span>
  155.             </div>
  156.             {% if not offer.isInFreeCodesCategory() and not offer.isWithoutCodes() %}
  157.                 <div class="bottom-item" data-toggle="tooltip" data-placement="top" data-html="true" rel="tooltip"
  158.                      data-original-title='Кол-во продаж к кол-ву просмотров. <br> Конверсия за {{ daysFromStrart }} {{ ['день', 'дня', 'дней']|plural(daysFromStrart) }}'>
  159.                     <img src="/images/stats-alt-2.svg" style="margin: 0 .2em;"/>
  160.                     <span>{{ getOfferConversion(offer.getID()) }}%</span>
  161.                 </div>
  162.             {% endif %}
  163.             {% if offer.getActiveSince() <= date() and offer.getActiveTill() >= date() and not offer.isWithoutCodes() %}
  164.                 <div class="bottom-item" data-toggle="tooltip" data-placement="top"
  165.                      data-original-title='Дней до окончания действия акции'>
  166.                     <i class="slivki-icon slivki-icon-clock"></i>
  167.                     <span class="daystr">{{ daysLeft == 0 ? 0.5 : daysLeft }} {{ daysLeft > 0 ? ['день', 'дня', 'дней']|plural(daysLeft) : 'дня' }}</span>
  168.                 </div>
  169.             {% endif %}
  170.         </div>
  171.         <div class="w-100 d-flex" style="flex-wrap: wrap;">
  172.             {% if offer.isFoodOnlineOrderAllowedOnSite() %}
  173.                 <a href="{{ offer.getID() in constant('Slivki\\Entity\\Offer::FREESTYLE_OFFER_IDS') ? getLinkGiftCertificateOnlineOrderByOnlyCode(offer) : getLinkOnlineOrder(offer) }}"
  174.                    class="top-code-online-order utm-added">Онлайн-заказ</a>
  175.             {% endif %}
  176.             {% if offer.isGiftCertificateOnlineOrderAllowedOnSite() %}
  177.                 <a href="/gift-certificate/select/{{ offer.getID() }}{{ offer.getID() in constant('Slivki\\Entity\\Offer::FREESTYLE_OFFER_IDS')  ? '/code' : '' }}"
  178.                    class="top-code-online-order utm-added">Онлайн-покупка</a>
  179.             {% endif %}
  180.             {% if offer.isTireOnlineOrderAllowedOnSite() %}
  181.                 <a href="{{ offer.getOnlineRegistrationLink() }}" class="top-code-online-order utm-added">Онлайн-запись</a>
  182.             {% endif %}
  183.             {% if offer.isInFreeCodesCategory() %}
  184.                 <div class="top-code" data-toggle="tooltip" data-placement="top"
  185.                      data-original-title='Код скидки предоставляется сайтом бесплатно'>Код 0 руб.
  186.                 </div>
  187.             {% endif %}
  188.             {% if offer.isFoodOnlineOrderAllowedOnSite() and
  189.                 offer.getOnlineOrderSettings() is not null and
  190.                 (offer.getOnlineOrderSettings().allowedPaymentMethods['delivery'] is defined and
  191.                 offer.getOnlineOrderSettings().allowedPaymentMethods['delivery'][4] is defined and
  192.                 offer.getOnlineOrderSettings().allowedPaymentMethods['delivery'][4] == 1 and
  193.                 isServerFeatureEnabled(constant('Slivki\\Enum\\SwitcherFeatures::SLIVKI_PAY'))) or
  194.                 offer.isFoodOnlineOrderAllowedOnSite() and offer.isGiftCertificateOnlineOrderAllowedOnSite() and
  195.                 (offer.getOnlineOrderSettings().allowedPaymentMethods['pickup'] is defined and
  196.                 offer.getOnlineOrderSettings().allowedPaymentMethods['pickup'][4] is defined and
  197.                 offer.getOnlineOrderSettings().allowedPaymentMethods['pickup'][4] == 1 and
  198.                 isServerFeatureEnabled(constant('Slivki\\Enum\\SwitcherFeatures::SLIVKI_PAY'))) or
  199.                 offer.isGiftCertificateOnlineOrderAllowedOnSite() and isServerFeatureEnabled(constant('Slivki\\Enum\\SwitcherFeatures::SLIVKI_PAY_FOR_CERTIFICATE'))
  200.             %}
  201.                 <a class="js-slivki-pay-button top-code-online-order utm-added">SlivkiPay</a>
  202.             {% endif %}
  203.             {% if offer.getDeliveryTimeTeaser() %}
  204.                 <div class="time-delivery d-flex justify-content-center align-items-center">
  205.                     <img width="22" height="17" class="mr-1" src="/images/icon_avto.svg"/>
  206.                     <span class="color-white">{{ offer.getDeliveryTimeTeaser() }} {{ offer.getDeliveryTimeTeaser() != 'Предзаказ' ? ' мин'}}</span>
  207.                 </div>
  208.             {% endif %}
  209.         </div>
  210.         {% if offer.getOnlineOrderSettings() is not null and offer.getOnlineOrderSettings().getDeliveryWorkingTime() is not null %}
  211.             {% set workingDeliveryTime = (offer.getOnlineOrderSettings().getDeliveryWorkingTime())|json_decode()["now"|date("w")] %}
  212.             {% set startTime = workingDeliveryTime.startTime|date('H:i') %}
  213.             {% set endTime = workingDeliveryTime.endTime|date('H:i') %}
  214.             {% set dayOff = workingDeliveryTime.dayOff %}
  215.             {% set nowTime = "now"|date("H:i") %}
  216.             {% if nowTime >= startTime and nowTime <= endTime and not dayOff %}
  217.                 <p class="teaser-working-time-delivery open-delivery d-none">Доставка до {{ workingDeliveryTime.endTime }}</p>
  218.             {% elseif nowTime < startTime and startTime != endTime and not dayOff %}
  219.                 <p class="teaser-working-time-delivery closed-delivery d-none">Закрыто. Доставка с {{ workingDeliveryTime.startTime }}</p>
  220.             {% elseif startTime == endTime and not dayOff %}
  221.                 <p class="teaser-working-time-delivery open-delivery d-none">Доставка круглосуточно</p>
  222.             {% elseif dayOff %}
  223.                 <p class="teaser-working-time-delivery closed-delivery d-none">Предзаказ</p>
  224.             {% endif %}
  225.         {% endif %}
  226.     </div>