{% set isEnabledCTAslide = isEnabledFeature('web.slider.lead.cta') and not isMobile %}
{% set isEnabledListingVideo = listing.videoUrl is not empty %}
{% set sliderCounterContainer = "<label class='count-text' id='sliderCounter'></label>" %}
{% set listingOwner = listing.user %}
{% set isListingOwnerLogoDefined = listingOwner is defined and listingOwner.logo %}
{% set hasListingOwnerLogo = isEnabledFeature('web.listing.customer.logo.on.photo') and isListingOwnerLogoDefined %}
{% set iconSize = 24 %}
{% if isListingSliderDisabledTest %}
{% if hasListingOwnerLogo %}
{% set photoPath = generatePhotoWithLogo(listing.mainPhoto.file, listingOwner.logo)|thumbnail('slider-photo-watermarked-logo-large') %}
{% set photoPathWebp = generatePhotoWithLogo(listing.mainPhoto.file, listingOwner.logo)|thumbnail('slider-photo-watermarked-logo-large-webp') %}
{% else %}
{% set photoPath = custom_vich_uploader_asset(listing.mainPhoto.file, 'file')|thumbnail('slider-photo-watermarked-large') %}
{% set photoPathWebp = custom_vich_uploader_asset(listing.mainPhoto.file, 'file')|thumbnail('slider-photo-watermarked-large-webp') %}
{% endif %}
<div class="embed-responsive embed-responsive-4by3">
<div class="embed-responsive-item">
<picture>
<source srcset="{{ photoPathWebp }}" type="image/webp">
<source srcset="{{ photoPath }}" type="image/jpg">
<img itemprop="photo"
fetchpriority="high"
class="img-responsive w-100 h-100"
width="100" height="100"
/>
</picture>
</div>
</div>
{% else %}
<div id="ListingImageSlider">
<div class="listing-photo-slider listing-photo-slider__cloning-container embed-responsive embed-responsive-4by3">
<div class="owl-buttons listing-photo-slider__owl-buttons">
<button class="owl-prev owl-carousel-prev owl-buttons__circled">
<i class="fa fa-chevron-left"></i>
</button>
<button class="owl-next owl-carousel-next owl-buttons__circled">
<i class="fa fa-chevron-right"></i>
</button>
<div class="zoom-buttons-container">
<button class="zoom-buttons-container__button" id="zoom-in" onclick="imageSlider.zoomin()">
<img src="{{ asset('images/zoomin.svg') }}" width="{{ iconSize }}" height="{{ iconSize }}">
</button>
<button class="zoom-buttons-container__button" id="zoom-out" onclick="imageSlider.zoomout()">
<img src="{{ asset('images/zoomout.svg') }}" width="{{ iconSize }}" height="{{ iconSize }}">
</button>
</div>
</div>
<div class="embed-responsive-item listing-photo-slider__container" id="sliderWrapper">
<div class="owl-carousel owl-image-carousel owl-theme">
{% for photo in listing.photosForSlider %}
{% set isDisabledLazyLoadImgIndex = loop.index == 1 %}
<div class="item" data-dot="{{ sliderCounterContainer }}">
{% if hasListingOwnerLogo %}
{% set photoPath = generatePhotoWithLogo(photo.file, listingOwner.logo)|thumbnail('slider-photo-watermarked-logo-large') %}
{% set photoPathWebp = generatePhotoWithLogo(photo.file, listingOwner.logo)|thumbnail('slider-photo-watermarked-logo-large-webp') %}
{% else %}
{% set photoPath = custom_vich_uploader_asset(photo.file, 'file')|thumbnail('slider-photo-watermarked-large') %}
{% set photoPathWebp = custom_vich_uploader_asset(photo.file, 'file')|thumbnail('slider-photo-watermarked-large-webp') %}
{% endif %}
{% if isDisabledLazyLoadImgIndex %}
<picture>
<source srcset="{{ photoPathWebp }}" type="image/webp">
<source srcset="{{ photoPath }}" type="image/jpg">
<img itemprop="photo"
fetchpriority="high"
class="img-responsive"
alt="{{ photo.caption }}"
onclick="imageSlider.openListingSlider()"
ng-click="setIsMobileSliderOpen('true')"
/>
</picture>
{% else %}
<picture>
<source data-srcset="{{ photoPathWebp }}" type="image/webp">
<source data-srcset="{{ photoPath }}" type="image/jpg">
<img itemprop="photo"
src="/images/placeholder.svg"
class="img-responsive lazyload"
alt="{{ photo.caption }}"
fetchpriority="low"
onclick="imageSlider.openListingSlider()"
ng-click="setIsMobileSliderOpen('true')"
/>
</picture>
{% endif %}
</div>
{% if loop.last %}
{% if isEnabledListingVideo %}
<div class="item item-video" data-dot="{{ sliderCounterContainer }}">
{% set youtubeId = getYoutubeVideoCode(listing.videoUrl|raw) %}
<a class="owl-video" href="https://www.youtube.com/embed/{{youtubeId}}"></a>
</div>
{% endif %}
{% if isEnabledCTAslide %}
<div class="item" data-dot="{{ sliderCounterContainer }}">
<picture>
<source data-srcset="{{ photoPathWebp }}" type="image/webp">
<source data-srcset="{{ photoPath }}" type="image/jpg">
<img itemprop="photo"
src="/images/placeholder.svg"
class="img-responsive lazyload"
alt="{{ photo.caption }}"
fetchpriority="low"
/>
</picture>
</div>
{% endif %}
{% endif %}
{% endfor %}
</div>
{% if isEnabledCTAslide %}
<div class="cta-buttons" id="sliderCTA">
{% include '@AqarmapListingBundle/Listing/ctaSliderView.html.twig' %}
</div>
{% endif %}
</div>
</div>
</div>
<div class="mobileSlider">
<div id="listingSliderModal" class="modal listing-slider-modal" role="dialog">
<div class="modal-header modal-lg border-0 position-absolute w-100">
<div>
<button onclick="imageSlider.closeListingSlider()" type="button" class="close-modal" ng-click="setIsMobileSliderOpen('false')">
<img src="{{ asset('images/close.svg') }}" width="{{ iconSize }}" height="{{ iconSize }}">
</button>
</div>
</div>
<div class="modal-body p-0">
<div class="modal-slider-container d-flex align-items-center">
<div id="fullScreenImageSlider" class="listing-photo-slider__full-screen-container">
</div>
</div>
</div>
</div>
</div>
{% endif %}