custom/plugins/ShopWithMeUI/src/Resources/views/storefront/page/shop4free/index.html.twig line 1

Open in your IDE?
  1. {% sw_extends '@Storefront/storefront/base.html.twig' %}
  2. {% block base_content %}
  3.     {% block layout_shop4free %}
  4.         {% set desktopShop4freePurchaseModal = "desktop-share-modal-" %}
  5.         {% set desktopShop4freePurchaseModalContent %}
  6.             {% sw_include '@Storefront/storefront/page/shop4free/shop4free-purchase-modal.html.twig' %}
  7.         {% endset %}
  8.         <div id="swm-shop4free">
  9.             <section class="shop4free_banner_wrapper shop4free_banner_wrapper-mobile swm-m-auto position-relative desktop:d-none-important" style="margin-top: 24px">
  10.                 {# <!--Container-->
  11.                 <div
  12.                     class="d-flex justify-center items-center flex-col" style="gap: 15.25px;">
  13.                     <!--Pic-->
  14.                     <div class="shop4free_banner_pictures d-flex items-center justify-center position-relative">
  15.                         <img src="/bundles/shopwithmeui/assets/imgs/shop4freeBanner/left.png" class="shop4free_banner_pictures_side"/>
  16.                         <img class="shop4free_banner_pictures_center position-absolute" src="/bundles/shopwithmeui/assets/imgs/shop4freeBanner/center.png"/>
  17.                         <img src="/bundles/shopwithmeui/assets/imgs/shop4freeBanner/right.png" class="shop4free_banner_pictures_side"/>
  18.                     </div>
  19.                     <!--Text-->
  20.                     <div class="d-flex flex-col gap-1rem items-center">
  21.                         <span class="shop4free_banner_text_title typo-head-2 d-flex text-center">{{'app.shop4freePage.title'|trans|raw}}</span>
  22.                         <p class="shop4free_banner_text_des typo-head-5 text-center">{{'app.shop4freePage.subTitle'|trans}}</p>
  23.                     </div>
  24.                 </div>
  25.                 <img class="shop4free_banner_vector position-absolute" src="/bundles/shopwithmeui/assets/imgs/shop4freeBanner/Vector.svg"/>
  26.                 <img class="shop4free_banner_vector_mobile position-absolute" src="/bundles/shopwithmeui/assets/imgs/shop4freeBanner/Vector_mobile.svg"/> #}
  27.                 <div class="shop4free_banner_wrapper-mobile-head typo-head-4-b text-center" style="margin-bottom: 32px">
  28.                     SHOP4FREE
  29.                 </div>
  30.                 <div class="shop4free_banner_wrapper-mobile-media width-full" style="padding: 16px">
  31.                     <img class="shop4free_banner_wrapper-mobile-media-img width-full height-full" src="{{ asset('bundles/shopwithmeui/assets/imgs/shop4freeBanner/banner-shop4free-mobile.jpeg') }}"/>
  32.                 </div>
  33.                 
  34.             </section>
  35.             <section class="shop4free_banner_wrapper shop4free_banner_wrapper-desktop swm-m-auto">
  36.                 <div class="shop4free_banner_wrapper-desktop-head typo-head-2 text-center text-uppercase">
  37.                     SHOP4FREE
  38.                 </div>
  39.                 <div class="shop4free_banner_wrapper-desktop-media width-full">
  40.                     <img class="shop4free_banner_wrapper-desktop-media-img width-full height-full" src="{{ asset('bundles/shopwithmeui/assets/imgs/shop4freeBanner/banner-shop4free.jpeg') }}"/>
  41.                 </div>
  42.             </section>
  43.             <section class="section-2__shop4free">
  44.                 <div class="section-2__shop4free-content d-flex flex-col swm-mb-8">
  45.                     {% for product in products %}
  46.                         {% set isTop3Credit = product.customFields.productCreditPrice >= 999999 %}
  47.                         {% set widthProgress = 0 %}
  48.                         {% set balance = 0 %}
  49.                         {% if not isTop3Credit %}
  50.                             {% if (customer / product.customFields.productCreditPrice * 100) > 100 %}
  51.                                 {% set widthProgress = 100 %}
  52.                             {% else %}
  53.                                 {% set widthProgress = ( customer / product.customFields.productCreditPrice * 100) %}
  54.                             {% endif %}
  55.                         {% endif %}
  56.                         {% set balance = customer %}
  57.                         <div class="section-2__shop4free-content-product d-flex items-center" style="background-image: url({{ asset('bundles/shopwithmeui/assets/imgs/shop4free/img-bg1.png') }})">
  58.                             <div class="section-2__shop4free-content-product-info">
  59.                                 <div class="section-2__shop4free-content-product-info-description d-flex flex-col">
  60.                                     <div class="section-2__shop4free-content-product-info-description-name typo-head-2">
  61.                                         {{product.translated.name}}
  62.                                     </div>
  63.                                     <div class="section-2__shop4free-content-product-info-description-describe typo-sub-text-3-pr">
  64.                                         {{product.description|raw}}
  65.                                     </div>
  66.                                 </div>
  67.                                 <div class="section-2__shop4free-content-product-info-description-buy d-flex items-center justify-content-between">
  68.                                     {# Credit #}
  69.                                     <div class="d-flex flex-col justify-between section-2__shop4free-content-product-info-left-content">
  70.                                         <div class="d-flex gap-1rem">
  71.                                             {# {% sw_include '@Storefront/storefront/page/product-detail/buy-widget-form.html.twig' with {
  72.                                                 isHeaderButton: false,
  73.                                                 classTextButton: 'section-2__shop4free-content-product-info-left-content-earnmore-text'
  74.                                             } %} #}
  75.                                             {% set checkEnoughCredit = (context.customer && (balance < product.customFields.productCreditPrice)) %}
  76.                                             <button class="section-2__shop4free-content-product-info-description-btn button-square button-primary d-flex items-center shop4free-purchase-btn" 
  77.                                                     title="Shop4free now" 
  78.                                                     aria-label="Shop4free now"
  79.                                                     data-product-id= "{{ product.id }}"
  80.                                                     data-product-name= "{{ product.translated.name }}"
  81.                                                     data-product-credit= "{{ product.customFields.productCreditPrice }}"
  82.                                                     desktop-modal-target='#{{context.customer ? desktopShop4freePurchaseModal : ''}}'
  83.                                                     data-balance= "{{ balance }}"
  84.                                                     {% if checkEnoughCredit %} disabled {% endif %}
  85.                                                     >
  86.                                                 <div class="section-2__shop4free-content-product-info-description-title d-flex items-center justify-between">
  87.                                                     <div class="d-flex flex-col items-start gap-8px">
  88.                                                         <span class="{{classTextButton}} button-title typo-sub-text-2 section-2__shop4free-content-product-info-description-title-text">{{'app.shop4freeNowButton'|trans}}</span>
  89.                                                     </div>
  90.                                                     <svg width="18" height="18" viewBox="0 0 18 18" fill="none"
  91.                                                         xmlns="http://www.w3.org/2000/svg">
  92.                                                         <path
  93.                                                             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"
  94.                                                             stroke="currentColor" stroke-width="1.5" stroke-linecap="round" />
  95.                                                         <path d="M1 9H11M11 9L8 6M11 9L8 12" stroke="currentColor" stroke-width="1.5"
  96.                                                             stroke-linecap="round" stroke-linejoin="round" />
  97.                                                     </svg>
  98.                                                 </div>
  99.                                             </button>
  100.                                         </div>
  101.                                         <div class="section-2__shop4free-content-product-img_mobile">
  102.                                             {% if product.cover.media.mimeType starts with 'video' %}
  103.                                                 <video loading="lazy" class="section-2__shop4free-content-product-img-container" autoplay playsinline muted>
  104.                                                     <source src="{{ product.cover.media.url }}" type="{{ product.cover.media.mimeType }}" />
  105.                                                 </video>
  106.                                             {% else %}
  107.                                                 <img src-lazy="{{ product.cover.media.url }}" alt="{{product.name}}" class="section-2__shop4free-content-product-img-container"/>
  108.                                             {% endif %}
  109.                                         </div>
  110.                                         <div class="section-2__shop4free-content-product-info-credit d-flex flex-col">
  111.                                         {% if isTop3Credit %}
  112.                                             <div class="section-2__shop4free-content-product-info-credit-number">
  113.                                                 {{'app.shop4freePage.top3'|trans}} ({{'app.shop4freePage.mercedesMonth'|trans}} {{ "now"|date("Y") }})
  114.                                             </div>
  115.                                         {% else %}
  116.                                             <div class="section-2__shop4free-content-product-info-credit-number">
  117.                                                 {{product.customFields.productCreditPrice}}
  118.                                                 {{'app.credits'|trans}}
  119.                                             </div>
  120.                                         {% endif %}
  121.                                             
  122.                                             <div class="section-2__shop4free-content-product-info-credit-line"></div>
  123.                                             <div class="section-2__shop4free-content-product-info-credit-progress text-center d-flex flex-col">
  124.                                                 <div class="section-2__shop4free-content-product-info-credit-progress-head typo-sub-text-3-pr">
  125.                                                     {{'app.yourProgress'|trans}}
  126.                                                 </div>
  127.                                                 <div class="section-2__shop4free-content-product-info-credit-progress-ratio">
  128.                                                     <div class="section-2__shop4free-content-product-info-credit-progress-ratio-active" style="width: {{widthProgress}}%"></div>
  129.                                                 </div>
  130.                                                 <div class="section-2__shop4free-content-product-info-credit-progress-balance typo-sub-text-3-pr">
  131.                                                     {{'app.currentBalance'|trans}}:
  132.                                                     <span class="customer-credit-balance">{{balance}}</span>
  133.                                                     {{'app.credits'|trans}}
  134.                                                 </div>
  135.                                             </div>
  136.                                             <a href="{{ seoUrl('frontend.credit.lucky-wheel') }}" class="section-2__shop4free-content-product-info-credit-btn swm-btn swm-btn-earn-credit">
  137.                                                 <div class="section-2__shop4free-content-product-info-credit-btn-content-title d-flex items-center justify-center">
  138.                                                     <div class="d-flex flex-col items-start gap-8px">
  139.                                                         <span class="shop4free-earnmore-btn button-title typo-sub-text-4">{{'app.shop4freePage.earnMoreCredits'|trans}}</span>
  140.                                                     </div>
  141.                                                     <img src="{{ asset('bundles/shopwithmeui/assets/icons/earnmore_icon.svg') }}" alt="Earn More Credits Icon"/>
  142.                                                 </div>
  143.                                             </a>
  144.                                         </div>
  145.                                     </div>
  146.                                     <div class="section-2__shop4free-content-product-img">
  147.                                         {% if product.cover.media.mimeType starts with 'video' %}
  148.                                             <video loading="lazy" class="section-2__shop4free-content-product-img-container" autoplay playsinline muted>
  149.                                                 <source src="{{ product.cover.media.url }}" type="{{ product.cover.media.mimeType }}" />
  150.                                             </video>
  151.                                         {% else %}
  152.                                             <img src-lazy="{{ product.cover.media.url }}" alt="{{product.name}}" class="section-2__shop4free-content-product-img-container"/>
  153.                                         {% endif %}
  154.                                     </div>
  155.                                 </div>
  156.                             </div>
  157.                         </div>
  158.                     {% endfor %}
  159.                 </div>
  160.             </section>
  161.             {% sw_include '@Storefront/storefront/component/aistream/desktop-common-modal.html.twig' with {
  162.                 id: desktopShop4freePurchaseModal,
  163.                 height: '100%',
  164.                 className: 'lazy-load-modal full-screen appear-center',
  165.                 style: 'position: fixed !important; background-color: #00000066;',
  166.                 content: desktopShop4freePurchaseModalContent|raw,
  167.                 showTopNut: false,
  168.             } %}
  169.         </div>
  170.     {% endblock %}
  171.     <script>
  172.         const translationsShop4free = {
  173.             thisProduct: "{{ 'app.shop4freePage.thisProduct'|trans|sw_sanitize }}",
  174.             successMessage: "{{ 'app.shop4freePage.successMessage'|trans|sw_sanitize }}",
  175.             errorMessage: "{{ 'app.shop4freePage.errorMessage'|trans|sw_sanitize }}",
  176.         };
  177.         const redirectShop4free = {
  178.             shop4free: "{{ seoUrl('frontend.shop4free') }}",
  179.             login: "{{ seoUrl('frontend.econsor.app.storefront.login') }}",
  180.         }
  181.     </script>
  182. {% endblock %}