{% set teaserAnchorClass = '' %}
{% if not offer.isHideNoveltyLabel() and offer.getActiveSince().diff(date()).days <= 5 %}
{% set teaserAnchorClass = 'newProduct' %}
{% endif %}
{% set offerURL = urlWithDomain is defined ? urlWithDomain : getURL("Slivki:Default:details", offer.getID(), true) %}
{% set teaserStatDays = 30 %}
{% set daysFromStrart = date(offer.getActiveSince|date).diff(date('now')).days %}
{% set daysFromStrart = daysFromStrart < teaserStatDays ? daysFromStrart : teaserStatDays %}
{% set daysFromStrart = daysFromStrart == 0 ? 1 : daysFromStrart %}
{% if isMailing is defined and isMailing %}
<input type="checkbox" class="marketActionCheckBox"/>
<input type="checkbox" style="float: left;" name="mainTeaser" class="marketActionRadio"/>
{% endif %}
<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%' }}>
{% block imageDiv %}
{% if noLazyLoad is defined %}
<div class="images {% if offer.getDetailMedias()|length > 0 %}tiaser-carousel{% endif %}"
style="display: block; background-image: url('{{ getImageURL(offer.getTeaserMedia(), 250, 162) }}')"
onclick="window.open('{{ offerURL }}' + location.search);">
{% else %}
<div class="images lazy {% if offer.getDetailMedias()|length > 0 %}tiaser-carousel{% endif %}"
data-original="{{ getImageURL(offer.getTeaserMedia(), 500, 324) }}"
onclick="window.open('{{ offerURL }}' + location.search);">
{% endif %}
{% endblock %}
<img class="image" src="{{ getImageURL(offer.getTeaserMedia(), 500, 324) }}"
alt=""/>
{% for media in offer.getDetailMedias()|slice(1, 8) %}
<img class="image d-none" src="{{ getImageURL(media, 500, 324) }}"
alt="{{ media.getDescription() }}" border="0"/>
{% endfor %}
{% if offer.getDetailMedias()|length > 8 %}
<div class="brazzers-more d-none">
<div class="brazzers-more__wrapper">
<div class="brazzers-more__icon"></div>
<div class="brazzers-more__text">Еще {{ offer.getDetailMedias()|length - 3 }} фото</div>
</div>
</div>
{% endif %}
{% if galleryVideos.getVideos() is defined and galleryVideos.getVideos()|length > 0 %}
<div class="story-teaser-img">
<img src="/images/play-offer-story.svg" alt="Истории"/>
</div>
{% endif %}
{% if not offer.isHideNoveltyLabel() and offer.getActiveSince().diff(date()).days <= constant('Slivki\\Services\\Category\\NewOfferCategoryService::NEW_OFFER_PERIOD_DAYS') %}
<div class="new-offer-watermark">
Новая
</div>
{% endif %}
{% if offer.getOnlineOrderSettings() is not null and offer.getOnlineOrderSettings().getDeliveryWorkingTime() is not null %}
{% set workingDeliveryTime = (offer.getOnlineOrderSettings().getDeliveryWorkingTime())|json_decode()["now"|date("w")] %}
{% set startTime = workingDeliveryTime.startTime|date('H:i') %}
{% set endTime = workingDeliveryTime.endTime|date('H:i') %}
{% set dayOff = workingDeliveryTime.dayOff %}
{% set nowTime = "now"|date("H:i") %}
{% if startTime == endTime and not dayOff %}ы
<a href="{{ offerURL }}" class="open-delivery-info d-none" target="_blank">ДОСТАВКА КРУГЛОСУТОЧНО</a>
{% endif %}
{% endif %}
<a href="{{ offerURL }}" target="_blank" class="details-link {{ teaserAnchorClass }}">
{% if offer.getCaptionName()|trim %}
<div class="info-line" style="background-color: {{ offer.getCaptionColor() }};">
<div>{{ offer.getCaptionName() }}</div>
</div>
{% endif %}
{% if offer.getRegionalCaptionName()|trim %}
<div class="info-line regional"
style="background-color: {{ offer.getRegionalCaptionColor() }}; display: none;">
<div>{{ offer.getRegionalCaptionName() }}</div>
</div>
{% endif %}
</a>
{% if offer.getHint() and offer.getHint()|trim != '' %}
<div class="teaser-hint">
<div class="teaser-hint-inner">{{ offer.getHint()|raw }}</div>
</div>
{% endif %}
{% if showManicurePrice is defined and showManicurePrice and offer.getPrice() %}
<div class="info-line manicure-price">
<div>Маникюр под ключ {{ offer.getPrice()|number_format(2, ',', '') }} руб</div>
</div>
{% endif %}
</div>
{% set supplierLogo = getTeaserWatermark(offer.getID()) %}
{% if supplierLogo|length > 0 %}
{% set supplierLogoWidth = supplierLogo.width ? supplierLogo.width : 65 %}
<div class="teaser--supplier-logo">
<img style="{{ supplierLogo.width ? 'width:' ~ supplierLogo.width ~ 'px;' }}{{ supplierLogo.height ? 'height:' ~ supplierLogo.height ~ 'px;' }}"
src="{{ getImageURL(supplierLogo.watermark, 2 * supplierLogoWidth, 0) }}" alt=""/>
</div>
{% endif %}
{% block favorite %}{% endblock %}
{% if not offer.isWithoutCodes() %}
<div class="discount-label">{{ offer.getDiscountLabelText() }}</div>
{% endif %}
<div class="top">
{% set rating = offer.getRating() %}
{% set ratingPercentage = rating * 100 / 5 %}
{% set ratingCount = getOfferCommentsCount(offer.getID()) %}
<div class="d-flex align-items-center">
{% if ratingCount > 0 or rating > 0 %}
<div class="star-ratings-css">
{% if rating > 0 %}
<div class="star-ratings-css-top" style="width: {{ ratingPercentage }}%">
<span>★</span>
</div>
{% else %}
<div class="star-ratings-css-bottom">
<span>★</span>
</div>
{% endif %}
</div>
<div class="rating-value" style="margin-right: 2px;">{{ rating|round(2, 'ceil') }}</div>
<div class="rating-value" data-toggle="tooltip" data-placement="top"
data-original-title="Количество комментариев к данной акции">
({{ getOfferCommentsCount(offer.getID()) }})
</div>
{% endif %}
</div>
{% if offer.getGeoLocations().count() > 0 %}
<div class="geo-location-block">
<div class="distance" data-toggle="distance-tooltip" data-placement="top"
data-original-title="Расстояние от Вас до объекта">
<i class="slivki-icon slivki-icon-direction"></i>
<img class='ajaxLoader' src='/images/ajax-loader-16x16.gif' alt='Загрузка...'/>
<span></span>
</div>
{% include 'Slivki/offers/geo_location_data.html.twig' with {'offer': offer} only %}
</div>
{% endif %}
</div>
<div class="teaser-same-height">
<div class="title">
<a href="{{ offerURL }}" target="_blank" class="details-link "
style="color: {{ offer.getTitleFontColor() }};">{{ offer.getTitle()|raw }}</a>
</div>
</div>
<a class="details-link marketActionLink" href="{{ offerURL }}" target="_blank">
<div class="address" data-toggle="tooltip" data-placement="top"
data-original-title="Ориентир">{{ offer.getAddress() }}</div>
</a>
<div class="bottom d-flex font-size-0680">
{% set daysLeft = offer.getActiveTill().diff(date()).days %}
{% if not offer.isWithoutCodes() %}
<a href="{{ offerURL }}" target="_blank" class="bottom-item" data-toggle="tooltip" data-placement="top"
data-original-title='Взято кодов за {{ daysFromStrart }} {{ ['день', 'дня', 'дней']|plural(daysFromStrart) }}'>
<i class="slivki-icon slivki-icon-users"></i>
<span>{{ getOfferMonthlyPurchaseCount(offer.getID()) }}</span>
</a>
{% endif %}
<div class="bottom-item" data-toggle="tooltip" data-placement="top"
data-original-title='Просмотров за {{ daysFromStrart }} {{ ['день', 'дня', 'дней']|plural(daysFromStrart) }}'>
<i class="slivki-icon slivki-icon-eye"></i>
<span>{{ getOfferVisitCount(offer) }}</span>
</div>
{% if not offer.isInFreeCodesCategory() and not offer.isWithoutCodes() %}
<div class="bottom-item" data-toggle="tooltip" data-placement="top" data-html="true" rel="tooltip"
data-original-title='Кол-во продаж к кол-ву просмотров. <br> Конверсия за {{ daysFromStrart }} {{ ['день', 'дня', 'дней']|plural(daysFromStrart) }}'>
<img src="/images/stats-alt-2.svg" style="margin: 0 .2em;"/>
<span>{{ getOfferConversion(offer.getID()) }}%</span>
</div>
{% endif %}
{% if offer.getActiveSince() <= date() and offer.getActiveTill() >= date() and not offer.isWithoutCodes() %}
<div class="bottom-item" data-toggle="tooltip" data-placement="top"
data-original-title='Дней до окончания действия акции'>
<i class="slivki-icon slivki-icon-clock"></i>
<span class="daystr">{{ daysLeft == 0 ? 0.5 : daysLeft }} {{ daysLeft > 0 ? ['день', 'дня', 'дней']|plural(daysLeft) : 'дня' }}</span>
</div>
{% endif %}
</div>
<div class="w-100 d-flex" style="flex-wrap: wrap;">
{% if offer.isFoodOnlineOrderAllowedOnSite() %}
<a href="{{ offer.getID() in constant('Slivki\\Entity\\Offer::FREESTYLE_OFFER_IDS') ? getLinkGiftCertificateOnlineOrderByOnlyCode(offer) : getLinkOnlineOrder(offer) }}"
class="top-code-online-order utm-added">Онлайн-заказ</a>
{% endif %}
{% if offer.isGiftCertificateOnlineOrderAllowedOnSite() %}
<a href="/gift-certificate/select/{{ offer.getID() }}{{ offer.getID() in constant('Slivki\\Entity\\Offer::FREESTYLE_OFFER_IDS') ? '/code' : '' }}"
class="top-code-online-order utm-added">Онлайн-покупка</a>
{% endif %}
{% if offer.isTireOnlineOrderAllowedOnSite() %}
<a href="{{ offer.getOnlineRegistrationLink() }}" class="top-code-online-order utm-added">Онлайн-запись</a>
{% endif %}
{% if offer.isInFreeCodesCategory() %}
<div class="top-code" data-toggle="tooltip" data-placement="top"
data-original-title='Код скидки предоставляется сайтом бесплатно'>Код 0 руб.
</div>
{% endif %}
{% if offer.isFoodOnlineOrderAllowedOnSite() and
offer.getOnlineOrderSettings() is not null and
(offer.getOnlineOrderSettings().allowedPaymentMethods['delivery'] is defined and
offer.getOnlineOrderSettings().allowedPaymentMethods['delivery'][4] is defined and
offer.getOnlineOrderSettings().allowedPaymentMethods['delivery'][4] == 1 and
isServerFeatureEnabled(constant('Slivki\\Enum\\SwitcherFeatures::SLIVKI_PAY'))) or
offer.isFoodOnlineOrderAllowedOnSite() and offer.isGiftCertificateOnlineOrderAllowedOnSite() and
(offer.getOnlineOrderSettings().allowedPaymentMethods['pickup'] is defined and
offer.getOnlineOrderSettings().allowedPaymentMethods['pickup'][4] is defined and
offer.getOnlineOrderSettings().allowedPaymentMethods['pickup'][4] == 1 and
isServerFeatureEnabled(constant('Slivki\\Enum\\SwitcherFeatures::SLIVKI_PAY'))) or
offer.isGiftCertificateOnlineOrderAllowedOnSite() and isServerFeatureEnabled(constant('Slivki\\Enum\\SwitcherFeatures::SLIVKI_PAY_FOR_CERTIFICATE'))
%}
<a class="js-slivki-pay-button top-code-online-order utm-added">SlivkiPay</a>
{% endif %}
{% if offer.getDeliveryTimeTeaser() %}
<div class="time-delivery d-flex justify-content-center align-items-center">
<img width="22" height="17" class="mr-1" src="/images/icon_avto.svg"/>
<span class="color-white">{{ offer.getDeliveryTimeTeaser() }} {{ offer.getDeliveryTimeTeaser() != 'Предзаказ' ? ' мин'}}</span>
</div>
{% endif %}
</div>
{% if offer.getOnlineOrderSettings() is not null and offer.getOnlineOrderSettings().getDeliveryWorkingTime() is not null %}
{% set workingDeliveryTime = (offer.getOnlineOrderSettings().getDeliveryWorkingTime())|json_decode()["now"|date("w")] %}
{% set startTime = workingDeliveryTime.startTime|date('H:i') %}
{% set endTime = workingDeliveryTime.endTime|date('H:i') %}
{% set dayOff = workingDeliveryTime.dayOff %}
{% set nowTime = "now"|date("H:i") %}
{% if nowTime >= startTime and nowTime <= endTime and not dayOff %}
<p class="teaser-working-time-delivery open-delivery d-none">Доставка до {{ workingDeliveryTime.endTime }}</p>
{% elseif nowTime < startTime and startTime != endTime and not dayOff %}
<p class="teaser-working-time-delivery closed-delivery d-none">Закрыто. Доставка с {{ workingDeliveryTime.startTime }}</p>
{% elseif startTime == endTime and not dayOff %}
<p class="teaser-working-time-delivery open-delivery d-none">Доставка круглосуточно</p>
{% elseif dayOff %}
<p class="teaser-working-time-delivery closed-delivery d-none">Предзаказ</p>
{% endif %}
{% endif %}
</div>