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

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.             {% if rating > 0 %}
  101.                 <div class="d-flex align-items-center">
  102.                         <div class="star-ratings-css">
  103.                             <div class="star-ratings-css-top" style="width: {{ ratingPercentage }}%">
  104.                                 <span>★</span>
  105.                             </div>
  106.                         </div>
  107.                         <div class="rating-value" style="margin-right: 2px;">{{ rating|round(2, 'ceil') }}</div>
  108.                     {% if ratingCount > 0 %}
  109.                         <div class="rating-value" data-toggle="tooltip" data-placement="top"
  110.                              data-original-title="Количество комментариев к данной акции">
  111.                             ({{ getOfferCommentsCount(offer.getID()) }})
  112.                         </div>
  113.                     {% endif %}
  114.                 </div>
  115.             {% endif %}
  116.             {% if offer.getGeoLocations().count() > 0 %}
  117.                 <div class="geo-location-block">
  118.                     <div class="distance" data-toggle="distance-tooltip" data-placement="top"
  119.                          data-original-title="Расстояние от Вас до объекта">
  120.                         <i class="slivki-icon slivki-icon-direction"></i>
  121.                         <img class='ajaxLoader' src='/images/ajax-loader-16x16.gif' alt='Загрузка...'/>
  122.                         <span></span>
  123.                     </div>
  124.                     {% include 'Slivki/offers/geo_location_data.html.twig' with {'offer': offer} only %}
  125.                 </div>
  126.             {% endif %}
  127.         </div>
  128.         <div class="teaser-same-height">
  129.             <div class="title">
  130.                 <a href="{{ offerURL }}" target="_blank" class="details-link "
  131.                    style="color: {{ offer.getTitleFontColor() }};">{{ offer.getTitle()|raw }}</a>
  132.             </div>
  133.         </div>
  134.         <a class="details-link marketActionLink" href="{{ offerURL }}" target="_blank">
  135.             <div class="address" data-toggle="tooltip" data-placement="top"
  136.                  data-original-title="Ориентир">{{ offer.getAddress() }}</div>
  137.         </a>
  138.         <div class="bottom d-flex font-size-0680">
  139.             {% set daysLeft = offer.getActiveTill().diff(date()).days %}
  140.             {% if not offer.isWithoutCodes() %}
  141.                 <a href="{{ offerURL }}" target="_blank" class="bottom-item" data-toggle="tooltip" data-placement="top"
  142.                    data-original-title='Взято кодов за {{ daysFromStrart }} {{ ['день', 'дня', 'дней']|plural(daysFromStrart) }}'>
  143.                     <i class="slivki-icon slivki-icon-users"></i>
  144.                     <span>{{ getOfferMonthlyPurchaseCount(offer.getID()) }}</span>
  145.                 </a>
  146.             {% endif %}
  147.             <div class="bottom-item" data-toggle="tooltip" data-placement="top"
  148.                  data-original-title='Просмотров за {{ daysFromStrart }} {{ ['день', 'дня', 'дней']|plural(daysFromStrart) }}'>
  149.                 <i class="slivki-icon slivki-icon-eye"></i>
  150.                 <span>{{ getOfferVisitCount(offer) }}</span>
  151.             </div>
  152.             {% if not offer.isInFreeCodesCategory() and not offer.isWithoutCodes() and getOfferConversion(offer.getID() > 0 %}
  153.                 <div class="bottom-item" data-toggle="tooltip" data-placement="top" data-html="true" rel="tooltip"
  154.                      data-original-title='Актуальность за {{ daysFromStrart }} {{ ['день', 'дня', 'дней']|plural(daysFromStrart) }}'>
  155.                     <img src="/images/stats-alt-2.svg" style="margin: 0 .2em;"/>
  156.                     <span>{{ getOfferConversion(offer.getID()) }}%</span>
  157.                 </div>
  158.             {% endif %}
  159.             {% if offer.getActiveSince() <= date() and offer.getActiveTill() >= date() and not offer.isWithoutCodes() %}
  160.                 <div class="bottom-item" data-toggle="tooltip" data-placement="top"
  161.                      data-original-title='Дней до окончания действия акции'>
  162.                     <i class="slivki-icon slivki-icon-clock"></i>
  163.                     <span class="daystr">{{ daysLeft == 0 ? 0.5 : daysLeft }} {{ daysLeft > 0 ? ['день', 'дня', 'дней']|plural(daysLeft) : 'дня' }}</span>
  164.                 </div>
  165.             {% endif %}
  166.         </div>
  167.         <div class="w-100 d-flex" style="flex-wrap: wrap;">
  168.             {% if offer.isFoodOnlineOrderAllowedOnSite() %}
  169.                 <a href="{{ offer.getID() in constant('Slivki\\Entity\\Offer::FREESTYLE_OFFER_IDS') ? getLinkGiftCertificateOnlineOrderByOnlyCode(offer) : getLinkOnlineOrder(offer) }}"
  170.                    class="top-code-online-order utm-added">Онлайн-заказ</a>
  171.             {% endif %}
  172.             {% if offer.isGiftCertificateOnlineOrderAllowedOnSite() %}
  173.                 <a href="/gift-certificate/select/{{ offer.getID() }}{{ offer.getID() in constant('Slivki\\Entity\\Offer::FREESTYLE_OFFER_IDS')  ? '/code' : '' }}"
  174.                    class="top-code-online-order utm-added">Онлайн-покупка</a>
  175.             {% endif %}
  176.             {% if offer.isTireOnlineOrderAllowedOnSite() %}
  177.                 <a href="{{ offer.getOnlineRegistrationLink() }}" class="top-code-online-order utm-added">Онлайн-запись</a>
  178.             {% endif %}
  179.             {% if offer.isInFreeCodesCategory() %}
  180.                 <div class="top-code" data-toggle="tooltip" data-placement="top"
  181.                      data-original-title='Код скидки предоставляется сайтом бесплатно'>Код 0 руб.
  182.                 </div>
  183.             {% endif %}
  184.             {% if offer.isFoodOnlineOrderAllowedOnSite() and
  185.                 offer.getOnlineOrderSettings() is not null and
  186.                 (offer.getOnlineOrderSettings().allowedPaymentMethods['delivery'] is defined and
  187.                 offer.getOnlineOrderSettings().allowedPaymentMethods['delivery'][4] is defined and
  188.                 offer.getOnlineOrderSettings().allowedPaymentMethods['delivery'][4] == 1 and
  189.                 isServerFeatureEnabled(constant('Slivki\\Enum\\SwitcherFeatures::SLIVKI_PAY')))
  190.                 or
  191.                 offer.isFoodOnlineOrderAllowedOnSite()  and
  192.                 (offer.getOnlineOrderSettings().allowedPaymentMethods['pickup'] is defined and
  193.                 offer.getOnlineOrderSettings().allowedPaymentMethods['pickup'][4] is defined and
  194.                 offer.getOnlineOrderSettings().allowedPaymentMethods['pickup'][4] == 1 and
  195.                 isServerFeatureEnabled(constant('Slivki\\Enum\\SwitcherFeatures::SLIVKI_PAY')))
  196.                 or
  197.                 offer is defined and
  198.                 offer is not null and
  199.                 offer.getAllowedPaymentMethodsForCertificate() is defined and
  200.                 offer.getAllowedPaymentMethodsForCertificate() is not null and
  201.                 4 in offer.getAllowedPaymentMethodsForCertificate()|keys and
  202.                 offer.getAllowedPaymentMethodsForCertificate()[4] == 1 and
  203.                 offer.isGiftCertificateOnlineOrderAllowedOnSite() and
  204.                 isServerFeatureEnabled(constant('Slivki\\Enum\\SwitcherFeatures::SLIVKI_PAY_FOR_CERTIFICATE'))
  205.             %}
  206.                 <a class="js-slivki-pay-button top-code-online-order utm-added">SlivkiPay + 5%</a>
  207.             {% endif %}
  208.             {% if offer.getDeliveryTimeTeaser() %}
  209.                 <div class="time-delivery d-flex justify-content-center align-items-center">
  210.                     <img width="22" height="17" class="mr-1" src="/images/icon_avto.svg"/>
  211.                     <span class="color-white">{{ offer.getDeliveryTimeTeaser() }} {{ offer.getDeliveryTimeTeaser() != 'Предзаказ' ? ' мин'}}</span>
  212.                 </div>
  213.             {% endif %}
  214.         </div>
  215.         {% if offer.getOnlineOrderSettings() is not null and offer.getOnlineOrderSettings().getDeliveryWorkingTime() is not null %}
  216.             {% set workingDeliveryTime = (offer.getOnlineOrderSettings().getDeliveryWorkingTime())|json_decode()["now"|date("w")] %}
  217.             {% set startTime = workingDeliveryTime.startTime|date('H:i') %}
  218.             {% set endTime = workingDeliveryTime.endTime|date('H:i') %}
  219.             {% set dayOff = workingDeliveryTime.dayOff %}
  220.             {% set nowTime = "now"|date("H:i") %}
  221.             {% if nowTime >= startTime and nowTime <= endTime and not dayOff %}
  222.                 <p class="teaser-working-time-delivery open-delivery d-none">Доставка до {{ workingDeliveryTime.endTime }}</p>
  223.             {% elseif nowTime < startTime and startTime != endTime and not dayOff %}
  224.                 <p class="teaser-working-time-delivery closed-delivery d-none">Закрыто. Доставка с {{ workingDeliveryTime.startTime }}</p>
  225.             {% elseif startTime == endTime and not dayOff %}
  226.                 <p class="teaser-working-time-delivery open-delivery d-none">Доставка круглосуточно</p>
  227.             {% elseif dayOff %}
  228.                 <p class="teaser-working-time-delivery closed-delivery d-none">Предзаказ</p>
  229.             {% endif %}
  230.         {% endif %}
  231.     </div>