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() }}">
  15.     {% block imageDiv %}
  16.     {% if noLazyLoad is defined %}
  17.     <div class="images {% if offer.getShopMedias()|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.getShopMedias()|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.getShopMedias()|slice(0, 8) %}
  29.                 <img class="image d-none" src="{{ getImageURL(media, 500, 324) }}"
  30.                      alt="{{ media.getDescription() }}" border="0"/>
  31.             {% endfor %}
  32.             {% if offer.getShopMedias()|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.getShopMedias()|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.getRenewedOn().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.         <div class="discount-label">{{ offer.isWithoutCodes() ? 'пока без скидки' : offer.getDiscountLabelText() }}</div>
  94.         <div class="top">
  95.             {% set rating = offer.getRating() %}
  96.             {% set ratingPercentage = rating * 100 / 5 %}
  97.             {% set ratingCount = getOfferCommentsCount(offer.getID()) %}
  98.             <div class="d-flex align-items-center">
  99.                 {% if ratingCount > 0 or rating > 0 %}
  100.                     <div class="star-ratings-css">
  101.                         {% if rating > 0 %}
  102.                             <div class="star-ratings-css-top" style="width: {{ ratingPercentage }}%">
  103.                                 <span>★</span>
  104.                             </div>
  105.                         {% else %}
  106.                             <div class="star-ratings-css-bottom">
  107.                                 <span>★</span>
  108.                             </div>
  109.                         {% endif %}
  110.                     </div>
  111.                     <div class="rating-value" style="margin-right: 2px;">{{ rating|round(2, 'ceil') }}</div>
  112.                     <div class="rating-value" data-toggle="tooltip" data-placement="top"
  113.                          data-original-title="Количество комментариев к данной акции">
  114.                         ({{ getOfferCommentsCount(offer.getID()) }})
  115.                     </div>
  116.                 {% endif %}
  117.             </div>
  118.             {% if offer.getGeoLocations().count() > 0 %}
  119.                 <div class="geo-location-block">
  120.                     <div class="distance" data-toggle="distance-tooltip" data-placement="top"
  121.                          data-original-title="Расстояние от Вас до объекта">
  122.                         <i class="slivki-icon slivki-icon-direction"></i>
  123.                         <img class='ajaxLoader' src='/images/ajax-loader-16x16.gif' alt='Загрузка...'/>
  124.                         <span></span>
  125.                     </div>
  126.                     {% include 'Slivki/offers/geo_location_data.html.twig' with {'offer': offer} only %}
  127.                 </div>
  128.             {% endif %}
  129.         </div>
  130.         <div class="teaser-same-height">
  131.             <div class="title">
  132.                 <a href="{{ offerURL }}" target="_blank" class="details-link "
  133.                    style="color: {{ offer.getTitleFontColor() }};">{{ offer.getTitle()|raw }}</a>
  134.             </div>
  135.         </div>
  136.         <a class="details-link marketActionLink" href="{{ offerURL }}" target="_blank">
  137.             <div class="address" data-toggle="tooltip" data-placement="top"
  138.                  data-original-title="Ориентир">{{ offer.getAddress() }}</div>
  139.         </a>
  140.         <div class="bottom d-flex font-size-0680">
  141.             {% set daysLeft = offer.getActiveTill().diff(date()).days %}
  142.             {% if not offer.isWithoutCodes() %}
  143.                 <a href="{{ offerURL }}" target="_blank" class="bottom-item" data-toggle="tooltip" data-placement="top"
  144.                    data-original-title='Взято кодов за {{ daysFromStrart }} {{ ['день', 'дня', 'дней']|plural(daysFromStrart) }}'>
  145.                     <i class="slivki-icon slivki-icon-users"></i>
  146.                     <span>{{ getOfferMonthlyPurchaseCount(offer.getID()) }}</span>
  147.                 </a>
  148.             {% endif %}
  149.             <div class="bottom-item" data-toggle="tooltip" data-placement="top"
  150.                  data-original-title='Просмотров за {{ daysFromStrart }} {{ ['день', 'дня', 'дней']|plural(daysFromStrart) }}'>
  151.                 <i class="slivki-icon slivki-icon-eye"></i>
  152.                 <span>{{ getOfferVisitCount(offer) }}</span>
  153.             </div>
  154.             {% if not offer.isInFreeCodesCategory() and not offer.isWithoutCodes() %}
  155.                 <div class="bottom-item" data-toggle="tooltip" data-placement="top"
  156.                      data-original-title='Кол-во продаж к кол-ву просмотров. <br> Конверсия за {{ daysFromStrart }} {{ ['день', 'дня', 'дней']|plural(daysFromStrart) }}'>
  157.                     <img src="/images/stats-alt-2.svg" style="margin: 0 .2em;"/>
  158.                     <span>{{ getOfferConversion(offer.getID()) }}%</span>
  159.                 </div>
  160.             {% endif %}
  161.             {% if offer.getActiveSince() <= date() and offer.getActiveTill() >= date() and not offer.isWithoutCodes() %}
  162.                 <div class="bottom-item" data-toggle="tooltip" data-placement="top"
  163.                      data-original-title='Дней до окончания действия акции'>
  164.                     <i class="slivki-icon slivki-icon-clock"></i>
  165.                     <span class="daystr">{{ daysLeft == 0 ? 0.5 : daysLeft }} {{ daysLeft > 0 ? ['день', 'дня', 'дней']|plural(daysLeft) : 'дня' }}</span>
  166.                 </div>
  167.             {% endif %}
  168.         </div>
  169.         <div class="w-100 d-flex">
  170.             {% if offer.isOneOfOnlineOrderAllowedOnSite() and not offer.isTireOnlineOrderAllowedOnSite() %}
  171.                 <a href="{{ offer.getID() in constant('Slivki\\Entity\\Offer::FREESTYLE_OFFER_IDS') ? getLinkGiftCertificateOnlineOrderByOnlyCode(offer) : getLinkOnlineOrder(offer) }}"
  172.                    class="top-code-online-order">Онлайн-заказ</a>
  173.             {% elseif offer.isTireOnlineOrderAllowedOnSite() %}
  174.                 <a href="/online-zapis/{{ offer.getID() }}" class="top-code-online-order">Онлайн-запись</a>
  175.             {% endif %}
  176.             {% if offer.isInFreeCodesCategory() %}
  177.                 <div class="top-code" data-toggle="tooltip" data-placement="top"
  178.                      data-original-title='Код скидки предоставляется сайтом бесплатно'>Код 0 руб.
  179.                 </div>
  180.             {% endif %}
  181.             {% if offer.getDeliveryTimeTeaser() %}
  182.                 <div class="time-delivery d-flex justify-content-center align-items-center">
  183.                     <img width="22" height="17" class="mr-1" src="/images/icon_avto.svg"/>
  184.                     <span class="color-white">{{ offer.getDeliveryTimeTeaser() }} мин</span>
  185.                 </div>
  186.             {% endif %}
  187.         </div>
  188.         {% if offer.getOnlineOrderSettings() is not null and offer.getOnlineOrderSettings().getDeliveryWorkingTime() is not null %}
  189.             {% set workingDeliveryTime = (offer.getOnlineOrderSettings().getDeliveryWorkingTime())|json_decode()["now"|date("w")] %}
  190.             {% set startTime = workingDeliveryTime.startTime|date('H:i') %}
  191.             {% set endTime = workingDeliveryTime.endTime|date('H:i') %}
  192.             {% set dayOff = workingDeliveryTime.dayOff %}
  193.             {% set nowTime = "now"|date("H:i") %}
  194.             {% if nowTime >= startTime and nowTime <= endTime and not dayOff %}
  195.                 <p class="teaser-working-time-delivery open-delivery d-none">Доставка до {{ workingDeliveryTime.endTime }}</p>
  196.             {% elseif nowTime < startTime and startTime != endTime and not dayOff %}
  197.                 <p class="teaser-working-time-delivery closed-delivery d-none">Закрыто. Доставка с {{ workingDeliveryTime.startTime }}</p>
  198.             {% elseif startTime == endTime and not dayOff %}
  199.                 <p class="teaser-working-time-delivery open-delivery d-none">Доставка круглосуточно</p>
  200.             {% elseif dayOff %}
  201.                 <p class="teaser-working-time-delivery closed-delivery d-none">Предзаказ</p>
  202.             {% endif %}
  203.         {% endif %}
  204.     </div>