{% block component_delivery_information %}
{% set downloadFlag = constant('Shopware\\Core\\Content\\Product\\State::IS_DOWNLOAD') %}
{# @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 or (downloadFlag in product.states and not product.isCloseout)) and product.deliveryTime %}
{% block component_delivery_information_available %}
<link itemprop="availability" href="http://schema.org/InStock"/>
<p class="delivery-information delivery-available">
<span class="delivery-status-indicator bg-success"></span>
{{ "detail.deliveryTimeAvailable"|trans({
'%name%': product.deliveryTime.translation('name')
})|sw_sanitize }}
</p>
{% endblock %}
{% elseif product.isCloseout and product.availableStock < product.minPurchase %}
{% block component_delivery_information_soldout %}
<link itemprop="availability" href="http://schema.org/OutOfStock"/>
<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 %}
{% block component_delivery_information_default %}{% endblock %}
{% endif %}
</div>
{% endblock %}