{% sw_extends '@Storefront/storefront/component/delivery-information.html.twig' %}
{% block component_delivery_information %}
{# @var product \Shopware\Core\Content\Product\ProductEntity #}
{% if page is defined and page.product is defined %}
{% set product = page.product %}
{% endif %}
<div class="product-delivery-information">
{% if product.shippingFree %}
{% block component_delivery_information_shipping_free %}
<p class="delivery-information delivery-shipping-free">
<span class="delivery-status-indicator bg-info"></span>
{{ "general.deliveryShippingFree"|trans|sw_sanitize }}
</p>
{% endblock %}
{% endif %}
{% if not product.active %}
{% block component_delivery_information_not_available %}
<link itemprop="availability"
href="http://schema.org/LimitedAvailability"/>
<p class="delivery-information delivery-not-available">
<span class="delivery-status-indicator bg-danger"></span>
{{ "general.deliveryNotAvailable"|trans|sw_sanitize }}
</p>
{% endblock %}
{% elseif product.releaseDate and product.releaseDate|date('U') > "now"|date('U') %}
{% block component_delivery_information_pre_order %}
<link itemprop="availability"
href="http://schema.org/PreOrder"/>
<p class="delivery-information delivery-preorder">
<span class="delivery-status-indicator bg-warning"></span>
{{ "general.deliveryShipping"|trans|sw_sanitize }} {{ product.releaseDate|format_date('long', locale=app.request.locale) }}
</p>
{% endblock %}
{% elseif product.availableStock >= product.minPurchase and product.deliveryTime %}
{% block component_delivery_information_available %}
<link itemprop="availability" href="http://schema.org/InStock"/>
<div class="delivery-headline">Lieferzeit</div>
<p class="delivery-information delivery-available">
<span class="delivery-status-indicator bg-success"></span>
{{ product.deliveryTime.translation('name')|replace({ ("Tage"): "Werktage" }) }}
</p>
{% endblock %}
{% elseif product.isCloseout and product.availableStock < product.minPurchase %}
{% block component_delivery_information_soldout %}
<link itemprop="availability" href="http://schema.org/LimitedAvailability"/>
<p class="delivery-information delivery-soldout">
<span class="delivery-status-indicator bg-danger"></span>
{{ "detail.soldOut"|trans|sw_sanitize }}
</p>
{% endblock %}
{% elseif product.availableStock < product.minPurchase and product.deliveryTime and product.restockTime %}
{% block component_delivery_information_restock %}
<link itemprop="availability" href="http://schema.org/LimitedAvailability"/>
<p class="delivery-information delivery-restock">
<span class="delivery-status-indicator bg-warning"></span>
{{ "detail.deliveryTimeRestock"|trans({
'%count%': product.restockTime,
'%restockTime%': product.restockTime,
'%name%': product.deliveryTime.translation('name')
})|sw_sanitize }}
</p>
{% endblock %}
{% else %}
{% if product.deliveryTime %}
<link itemprop="availability" href="http://schema.org/InStock"/>
<div class="delivery-headline">Lieferzeit</div>
<p class="delivery-information delivery-available">
<span class="delivery-status-indicator bg-success"></span>
{{ product.deliveryTime.translation('name')|replace({ ("Tage"): "Werktage" }) }}
</p>
{% else %}
<link itemprop="availability" href="http://schema.org/InStock"/>
<div class="delivery-headline">Lieferzeit</div>
<p class="delivery-information delivery-available">
<span class="delivery-status-indicator bg-success"></span>
5-7 Werktage
</p>
{% endif %}
{% endif %}
</div>
{% endblock %}