{% extends 'views/product.html.twig' %}
{% block content %}
<div id="site-announcemment-block" class="clearfix">
{% if editmode %}
{{ pimcore_checkbox("announce-hide-show", {'label': 'Hide/Show Announcement'}) }}
{{ pimcore_input("site-announcemment", {
"class":"x-form-text-default mt-10",
"placeholder":"Site Announcement"
}) }}
{% else %}
{% if not pimcore_checkbox("announce-hide-show").isChecked() %}
<div class="marquee-cover">
<div class="container">
<!-- <span>Announcements</span> -->
<div class="marquee">
<p>{{ pimcore_input("site-announcemment") }}</p>
</div>
</div>
</div>
{% endif %}
{% endif %}
</div>
{% if not editmode %}
<section class="main-carousel">
{% endif %}
{% set myBlock = pimcore_block('contentblock', {'reload': true}) %}
{% for block in myBlock.iterator %}
{% if editmode %}
{{ pimcore_image("marqueeImage", {"thumbnail": "sliderImage-scale","title": "Drag your image here","width": 200,"height": 200}) }}
{% endif %}
{% set img = pimcore_image("marqueeImage").getSrc() %}
<div style="background-image: url({{ img }}); cursor: pointer" {% if pimcore_link("marqueeButton").getTarget() == "_blank" and not editmode %} onclick="window.open('{{ pimcore_link("marqueeButton").getHref() }}');" {% elseif not editmode %} onclick="location.href='{{ pimcore_link("marqueeButton").getHref() }}';"{% endif %}>
<div class="content" >
<div class="container row">
<div class="section-text">
<h1 class="header">
{% if pimcore_input("headline") or editmode %}<span class="marquee-header">{{ pimcore_input("headline") }}</span>{% endif %}
</h1>
{% if pimcore_input("subline") or editmode %}<p class="subheader">{{ pimcore_input("subline") }}</p>{% endif %}
{% if pimcore_link("marqueeButton").getText() or editmode %}{{ pimcore_link("marqueeButton", {'class': 'sublink'}) }}{% endif %}
</div>
</div>
</div>
</div>
{% endfor %}
{% if not editmode %}
</section>
{% endif %}
{% set classes = "front-panels" %}
{% if editmode %}
{% set heading = '<h4 class="mt-40">Please Add Your Image-Text Blocks</h4>' %}
{% set classes = "" %}
{% endif %}
<section class="banner-img-txt-panel text-center clearfix {{ classes }}">
{{ heading }}
{% for bannerPanel in pimcore_block("banner-panel").iterator %}
{% set blockWidth = pimcore_input("banner-panel-width").getValue() %}
{% if blockWidth is empty or editmode %}
{% set blockWidth = '100' %}
{% endif %}
{% set blockWidth = blockWidth ~ '%' %}
{% set panelCoverimgUrl = '' %}
{% set panelBodyimgUrl = '' %}
{% if not editmode %}
{% if pimcore_checkbox("text-hide-show").isChecked() %}
{% set panelBodyimgUrl = pimcore_image("banner-panel-image").getThumbnail('imagePanel') %}
{% else %}
{# {% set panelCoverimgUrl = pimcore_image("banner-panel-image").getThumbnail('imagePanel') %} #}
{% endif %}
{% endif %}
<div class="panel-cover" style="width:{{ blockWidth }}">
<div class="panel panel-default" style="background-image: url({{ panelCoverimgUrl }})">
{% if not editmode and pimcore_input("banner-panel-url").getValue() is not empty %}
<a target="_blank" href=""></a>
{% endif %}
{% if editmode %}
<div class="panel-body">
<label class="text-left w-100"><strong>Section Url (http://):</strong></label>
{{ pimcore_input("banner-panel-url", {"class" : "x-form-text-default light-bg text-left mb-10","placeholder" : "Url"}) }}
<label class="text-left w-100"><strong>Section Width (%):</strong></label>
{{ pimcore_input("banner-panel-width", { "class" :"x-form-text-default light-bg text-left mb-10","placeholder" : "Set Width in percentage(%)" }) }}
{{ pimcore_image("banner-panel-image", { 'thumbnail': 'imagePanel', 'hidetext': true, 'width': 250, 'height': 150, 'title': 'Drag your image here' }) }}
<div class="text-left">
{{ pimcore_checkbox("text-hide-show", { 'label': 'Hide/Show TextBox', 'reload': true }) }}
</div>
</div>
{% else %}
<div class="panel-image" style="background-image:url({{ panelBodyimgUrl }})"></div>
{% endif %}
{% if pimcore_checkbox("text-hide-show").isChecked() %}
<div class="panel-body">
{{ pimcore_textarea("banner-panel-text", { 'attr': { 'class': 'x-form-text-default light-bg text-left', 'height': 90, 'placeholder': 'Please add text here' }, 'nl2br': true }) }}
</div>
{% endif %}
{% if not editmode and pimcore_input("banner-panel-url").getValue() is not empty %}
</a>
{% endif %}
</div>
</div>
{% endfor %}
</section>
<div class="container">
<h1 class="product-carousel-heading">{{ pimcore_input("productcarouselheadline") }}</h1>
<section class="product-carousel">
{% for product in products %}
<div class="product-wrapper">
<div class="product">
<div class="product-wrap same-height">
<a href="{{ product.getDetailUrl }}">
<div class="img-holder">
<div class="img-wrap">
{% if product.getFirstImage('productList', country) %}
<img class="product-image" src="{{ product.getFirstImage('productList', country) }}">
{% endif %}
</div>
</div>
{# {% set brands = product.getBrand() %}
{% set brandname ='' %}
{% if brands %}
{% for brand in brands %}
{% set brandname = product.getBrandExtensionNameTrademark() %}
{% if brandname is empty %}
{% set brandname = product.getBrandExtensionName() %}
{% endif %}
{% endfor %}
{% endif %}
<span class="name"><a class="name" href="{{ editmode or preview ? '' : product.getDetailUrl }}">{{ brandname }}</a></span> #}
<span class="info">{{ product.getName() }}</span>
</div>
</a>
{# {% if product.getBrandExtensionDiscontinued() %}
<span class="text-info red">discontinued</span>
{% elseif product.getCreationDate() > lastlogin %}
<span class="text-info green">new</span>
{% elseif product.getmodificationDate() > lastlogin %}
<span class="text-info yellow">updates</span>
{% endif %} #}
<a href="{{ editmode or preview ? '' : path('shop-add-to-cart',{ item: product.getId()}) }}" class="download-btn"><span>{{ 'shop.buy'|trans }}</span></a>
</div>
</div>
{% endfor %}
</section>
</div>
{% endblock %}