{% sw_extends '@Storefront/storefront/base.html.twig' %}
{% block base_content %}
{% block layout_shop4free %}
{% set desktopShop4freePurchaseModal = "desktop-share-modal-" %}
{% set desktopShop4freePurchaseModalContent %}
{% sw_include '@Storefront/storefront/page/shop4free/shop4free-purchase-modal.html.twig' %}
{% endset %}
<div id="swm-shop4free">
<section class="shop4free_banner_wrapper shop4free_banner_wrapper-mobile swm-m-auto position-relative desktop:d-none-important" style="margin-top: 24px">
{# <!--Container-->
<div
class="d-flex justify-center items-center flex-col" style="gap: 15.25px;">
<!--Pic-->
<div class="shop4free_banner_pictures d-flex items-center justify-center position-relative">
<img src="/bundles/shopwithmeui/assets/imgs/shop4freeBanner/left.png" class="shop4free_banner_pictures_side"/>
<img class="shop4free_banner_pictures_center position-absolute" src="/bundles/shopwithmeui/assets/imgs/shop4freeBanner/center.png"/>
<img src="/bundles/shopwithmeui/assets/imgs/shop4freeBanner/right.png" class="shop4free_banner_pictures_side"/>
</div>
<!--Text-->
<div class="d-flex flex-col gap-1rem items-center">
<span class="shop4free_banner_text_title typo-head-2 d-flex text-center">{{'app.shop4freePage.title'|trans|raw}}</span>
<p class="shop4free_banner_text_des typo-head-5 text-center">{{'app.shop4freePage.subTitle'|trans}}</p>
</div>
</div>
<img class="shop4free_banner_vector position-absolute" src="/bundles/shopwithmeui/assets/imgs/shop4freeBanner/Vector.svg"/>
<img class="shop4free_banner_vector_mobile position-absolute" src="/bundles/shopwithmeui/assets/imgs/shop4freeBanner/Vector_mobile.svg"/> #}
<div class="shop4free_banner_wrapper-mobile-head typo-head-4-b text-center" style="margin-bottom: 32px">
SHOP4FREE
</div>
<div class="shop4free_banner_wrapper-mobile-media width-full" style="padding: 16px">
<img class="shop4free_banner_wrapper-mobile-media-img width-full height-full" src="{{ asset('bundles/shopwithmeui/assets/imgs/shop4freeBanner/banner-shop4free-mobile.jpeg') }}"/>
</div>
</section>
<section class="shop4free_banner_wrapper shop4free_banner_wrapper-desktop swm-m-auto">
<div class="shop4free_banner_wrapper-desktop-head typo-head-2 text-center text-uppercase">
SHOP4FREE
</div>
<div class="shop4free_banner_wrapper-desktop-media width-full">
<img class="shop4free_banner_wrapper-desktop-media-img width-full height-full" src="{{ asset('bundles/shopwithmeui/assets/imgs/shop4freeBanner/banner-shop4free.jpeg') }}"/>
</div>
</section>
<section class="section-2__shop4free">
<div class="section-2__shop4free-content d-flex flex-col swm-mb-8">
{% for product in products %}
{% set isTop3Credit = product.customFields.productCreditPrice >= 999999 %}
{% set widthProgress = 0 %}
{% set balance = 0 %}
{% if not isTop3Credit %}
{% if (customer / product.customFields.productCreditPrice * 100) > 100 %}
{% set widthProgress = 100 %}
{% else %}
{% set widthProgress = ( customer / product.customFields.productCreditPrice * 100) %}
{% endif %}
{% endif %}
{% set balance = customer %}
<div class="section-2__shop4free-content-product d-flex items-center" style="background-image: url({{ asset('bundles/shopwithmeui/assets/imgs/shop4free/img-bg1.png') }})">
<div class="section-2__shop4free-content-product-info">
<div class="section-2__shop4free-content-product-info-description d-flex flex-col">
<div class="section-2__shop4free-content-product-info-description-name typo-head-2">
{{product.translated.name}}
</div>
<div class="section-2__shop4free-content-product-info-description-describe typo-sub-text-3-pr">
{{product.description|raw}}
</div>
</div>
<div class="section-2__shop4free-content-product-info-description-buy d-flex items-center justify-content-between">
{# Credit #}
<div class="d-flex flex-col justify-between section-2__shop4free-content-product-info-left-content">
<div class="d-flex gap-1rem">
{# {% sw_include '@Storefront/storefront/page/product-detail/buy-widget-form.html.twig' with {
isHeaderButton: false,
classTextButton: 'section-2__shop4free-content-product-info-left-content-earnmore-text'
} %} #}
{% set checkEnoughCredit = (context.customer && (balance < product.customFields.productCreditPrice)) %}
<button class="section-2__shop4free-content-product-info-description-btn button-square button-primary d-flex items-center shop4free-purchase-btn"
title="Shop4free now"
aria-label="Shop4free now"
data-product-id= "{{ product.id }}"
data-product-name= "{{ product.translated.name }}"
data-product-credit= "{{ product.customFields.productCreditPrice }}"
desktop-modal-target='#{{context.customer ? desktopShop4freePurchaseModal : ''}}'
data-balance= "{{ balance }}"
{% if checkEnoughCredit %} disabled {% endif %}
>
<div class="section-2__shop4free-content-product-info-description-title d-flex items-center justify-between">
<div class="d-flex flex-col items-start gap-8px">
<span class="{{classTextButton}} button-title typo-sub-text-2 section-2__shop4free-content-product-info-description-title-text">{{'app.shop4freeNowButton'|trans}}</span>
</div>
<svg width="18" height="18" viewBox="0 0 18 18" fill="none"
xmlns="http://www.w3.org/2000/svg">
<path
d="M9 17C11.1217 17 13.1566 16.1571 14.6569 14.6569C16.1571 13.1566 17 11.1217 17 9C17 6.87827 16.1571 4.84344 14.6569 3.34315C13.1566 1.84285 11.1217 1 9 1"
stroke="currentColor" stroke-width="1.5" stroke-linecap="round" />
<path d="M1 9H11M11 9L8 6M11 9L8 12" stroke="currentColor" stroke-width="1.5"
stroke-linecap="round" stroke-linejoin="round" />
</svg>
</div>
</button>
</div>
<div class="section-2__shop4free-content-product-img_mobile">
{% if product.cover.media.mimeType starts with 'video' %}
<video loading="lazy" class="section-2__shop4free-content-product-img-container" autoplay playsinline muted>
<source src="{{ product.cover.media.url }}" type="{{ product.cover.media.mimeType }}" />
</video>
{% else %}
<img src-lazy="{{ product.cover.media.url }}" alt="{{product.name}}" class="section-2__shop4free-content-product-img-container"/>
{% endif %}
</div>
<div class="section-2__shop4free-content-product-info-credit d-flex flex-col">
{% if isTop3Credit %}
<div class="section-2__shop4free-content-product-info-credit-number">
{{'app.shop4freePage.top3'|trans}} ({{'app.shop4freePage.mercedesMonth'|trans}} {{ "now"|date("Y") }})
</div>
{% else %}
<div class="section-2__shop4free-content-product-info-credit-number">
{{product.customFields.productCreditPrice}}
{{'app.credits'|trans}}
</div>
{% endif %}
<div class="section-2__shop4free-content-product-info-credit-line"></div>
<div class="section-2__shop4free-content-product-info-credit-progress text-center d-flex flex-col">
<div class="section-2__shop4free-content-product-info-credit-progress-head typo-sub-text-3-pr">
{{'app.yourProgress'|trans}}
</div>
<div class="section-2__shop4free-content-product-info-credit-progress-ratio">
<div class="section-2__shop4free-content-product-info-credit-progress-ratio-active" style="width: {{widthProgress}}%"></div>
</div>
<div class="section-2__shop4free-content-product-info-credit-progress-balance typo-sub-text-3-pr">
{{'app.currentBalance'|trans}}:
<span class="customer-credit-balance">{{balance}}</span>
{{'app.credits'|trans}}
</div>
</div>
<a href="{{ seoUrl('frontend.credit.lucky-wheel') }}" class="section-2__shop4free-content-product-info-credit-btn swm-btn swm-btn-earn-credit">
<div class="section-2__shop4free-content-product-info-credit-btn-content-title d-flex items-center justify-center">
<div class="d-flex flex-col items-start gap-8px">
<span class="shop4free-earnmore-btn button-title typo-sub-text-4">{{'app.shop4freePage.earnMoreCredits'|trans}}</span>
</div>
<img src="{{ asset('bundles/shopwithmeui/assets/icons/earnmore_icon.svg') }}" alt="Earn More Credits Icon"/>
</div>
</a>
</div>
</div>
<div class="section-2__shop4free-content-product-img">
{% if product.cover.media.mimeType starts with 'video' %}
<video loading="lazy" class="section-2__shop4free-content-product-img-container" autoplay playsinline muted>
<source src="{{ product.cover.media.url }}" type="{{ product.cover.media.mimeType }}" />
</video>
{% else %}
<img src-lazy="{{ product.cover.media.url }}" alt="{{product.name}}" class="section-2__shop4free-content-product-img-container"/>
{% endif %}
</div>
</div>
</div>
</div>
{% endfor %}
</div>
</section>
{% sw_include '@Storefront/storefront/component/aistream/desktop-common-modal.html.twig' with {
id: desktopShop4freePurchaseModal,
height: '100%',
className: 'lazy-load-modal full-screen appear-center',
style: 'position: fixed !important; background-color: #00000066;',
content: desktopShop4freePurchaseModalContent|raw,
showTopNut: false,
} %}
</div>
{% endblock %}
<script>
const translationsShop4free = {
thisProduct: "{{ 'app.shop4freePage.thisProduct'|trans|sw_sanitize }}",
successMessage: "{{ 'app.shop4freePage.successMessage'|trans|sw_sanitize }}",
errorMessage: "{{ 'app.shop4freePage.errorMessage'|trans|sw_sanitize }}",
};
const redirectShop4free = {
shop4free: "{{ seoUrl('frontend.shop4free') }}",
login: "{{ seoUrl('frontend.econsor.app.storefront.login') }}",
}
</script>
{% endblock %}