{% sw_extends '@Storefront/storefront/component/buy-widget/buy-widget.html.twig' %}


{% block buy_widget %}
	<div class="product-detail-buy{% if elementId %}-{{ elementId }}{% endif %} js-magnifier-zoom-image-container">

		{% set hideProductHeadline = theme_config('theme-product-detail-hideProductHeadline') %}

		{% if hideProductHeadline == false %}
			<div class="detail-headline-wrapper row {{ hideProductHeadline }}">
				<div class="col product-detail-headline">
					<div class="product-detail-name-container">
						<h1 class="product-detail-name" itemprop="name">
							{{ product.translated.name }}
						</h1>
					</div>
				</div>
				<div class="col-md-auto product-detail-manufacturer">
					<a href="{{ page.product.manufacturer.link }}" class="product-detail-manufacturer-link" rel="noreferrer noopener" target="_blank" title="{{ page.product.manufacturer.translated.name }}">
						{% if page.product.manufacturer.media %}
							{% block page_product_detail_manufacturer_logo %}
								{% set attributes = { class: 'product-detail-manufacturer-logo', alt: page.product.manufacturer.translated.name, title: page.product.manufacturer.translated.name } %}
								{% sw_thumbnails 'product-detail-manufacturer-image-thumbnails' with { media: page.product.manufacturer.media, sizes: { default: '200px' } } %}
							{% endblock %}
						{% else %}
							{% block page_product_detail_manufacturer_text %}
								{{ page.product.manufacturer.translated.name }}
							{% endblock %}
						{% endif %}
					</a>
				</div>
			</div>
		{% endif %}
		{% block buy_widget_rich_snippets %}
			{{ parent() }}
		{% endblock %}

		{% block buy_widget_buy_container %}
			<div itemprop="offers" 
				itemscope 
				itemtype="{% if product.calculatedPrices|length > 1 %}https://schema.org/AggregateOffer{% else %}https://schema.org/Offer{% endif %}">
				{% block buy_widget_data %}
					{% block buy_widget_data_rich_snippet_url %}
						{{ parent() }}
					{% endblock %}
					{% block buy_widget_data_rich_snippet_price_range %}
						{{ parent() }}
					{% endblock %}
					{% block buy_widget_data_rich_snippet_price_currency %}
						{{ parent() }}
					{% endblock %}
					{% block buy_widget_price %}
						{{ parent() }}
					{% endblock %}
					{% block buy_widget_tax %}
						{% set taxprice = theme_config('theme-product-price-tax') %}
						{% if taxprice %}
							{{ parent() }}
						{% endif %}
					{% endblock %}
					{% block buy_widget_reviews %}
						{{ parent() }}
					{% endblock %}
					{# add addition block #}
					{% block element_manufacturer_logo_text %}
						{% set showManufacture = theme_config('theme-product-detail-manufacturer-show') %}
						{% if showManufacture and page.product.manufacturer.translated.name %}
							<div class="product-detail-manufacture-name">
								<h3>{{ "BrandCrockAquaTheme.detailpage.detailbuy.lable1"|trans|sw_sanitize }}
									<span>{{ page.product.manufacturer.translated.name }}</span>
								</h3>
							</div>
						{% endif %}
					{% endblock %}
					{% set shortDescriptionShow = theme_config('theme-product-detail-short-description-show') %}
					{% block page_product_detail_description_content_text %}

						{% if shortDescriptionShow %}
							{% if product.translated.customFields.bc_aqua_short_description %}
								<div class="product-detail-description-text" itemprop="description">

									{{ product.translated.customFields.bc_aqua_short_description|raw|sw_sanitize }}
								</div>
							{% endif %}
						{% endif %}
					{% endblock %}
					{% set StockShow = theme_config('theme-product-detail-stock-show') %}
					{% if StockShow %}
						<div class="stock--info">
							<span>{{ "BrandCrockAquaTheme.detailpage.detailbuy.lable2"|trans|sw_sanitize }}
								<em>{{ "BrandCrockAquaTheme.detailpage.detailbuy.lable3"|trans|sw_sanitize }}
									{{ page.product.stock }}</em>
							</span>
						</div>
					{% endif %}
					{# end #}

					{% block buy_widget_delivery_informations %}
						{{ parent() }}
					{% endblock %}
				{% endblock %}

				{% block buy_widget_configurator_include %}
					{{ parent() }}
				{% endblock %}

				{% block buy_widget_buy_form %}
					{% if product.active %}
						<div class="product-detail-form-container">
							{% sw_include '@Storefront/storefront/component/buy-widget/buy-widget-form.html.twig' %}
							{% if config('core.cart.wishlistEnabled') %}
								{% block buy_widget_wishlist %}
									{% sw_include '@Storefront/storefront/component/product/card/wishlist.html.twig' with {
										showText: true,
										size: 'sm',
										productId: product.id
									} %}
								{% endblock %}
							{% endif %}
						</div>
					{% endif %}
				{% endblock %}
			</div>
		{% endblock %}

		{# add condition #}
		{% set showSKU = theme_config('theme-product-detail-sku-show') %}
		{% if showSKU %}
			{% block buy_widget_ordernumber_container %}
				{{ parent() }}
			{% endblock %}
		{% endif %}

		{% set socialShareActive = false %}
		{% if theme_config('theme-product-detail-socialshare')  %}
			{% if theme_config('theme-product-detail-socialshare-facebook')
				or theme_config('theme-product-detail-socialshare-whatsapp')
				or theme_config('theme-product-detail-socialshare-instagram')
				or theme_config('theme-product-detail-socialshare-twitter')
				or theme_config('theme-product-detail-socialshare-pinterest')
			%}
				{% set socialShareActive = true %}
			{% endif %}
		{% endif %}
		{% if socialShareActive %}
			<div class="socials-wrap">
				<div class="detail-socials-heading">
					{{ "BrandCrockAquaTheme.detailpage.socialShareLabel"|trans|sw_sanitize }}
				</div>
				{% sw_include '@Storefront/storefront/Aquapages/product/bc-product-social-share.html.twig' with { socialShareActive: socialShareActive } %}
			</div>
		{% endif %}

		{% set showCategoryTags = theme_config('theme-product-detail-category-tags-show') %}
		{% if showCategoryTags %}
			<div class="cat--tag">
				<span class="cat">
					<em>{{ "BrandCrockAquaTheme.detailpage.detailbuy.lable4"|trans|sw_sanitize }}</em>
					{{ page.product.seoCategory.translated.name }}
				</span>
			</div>
		{% endif %}
		{# end #}

	</div>
{% endblock %}
