{# @var product \Shopware\Core\Content\Product\ProductEntity #}
{# @var deliverytime \Shopware\Core\Checkout\Cart\Delivery\Struct\DeliveryTime #}
{% block component_delivery_information %}
{% if page is defined and page.product is defined %}
{% set product = page.product %}
{% endif %}
{#Product cart/Checkout show delivery time.#}
{%if lineItem is defined and lineItem.deliveryInformation is defined %}
{% set deliverytime = lineItem.deliveryInformation.deliveryTime %}
{# {% set deliveryTimeId = page.cart.data.elements["product-#{lineItem.id}"].deliveryTimeId %} #}
{% set deliveryTimeId = page.cart.data.elements["product-#{lineItem.referencedId}"].deliveryTimeId %}
{% block component_delivery_information_available_ammactrade %}
<link itemprop="availability" href="http://schema.org/InStock"/>
{% if(deliveryTimeId == '32c6890dcfe34dae9ef1c16320b3afc2') %}
<p class="delivery-information delivery-available">
<a href="/kundenservice/lieferzeiten/" target="_blank" style="color: #26c156;">
<span class="delivery-status-indicator bg-success"></span>
{{ deliverytime.name }} <span style="text-decoration: underline;">(mehr Infos)</span>
</a>
</p>
{% else %}
<p class="delivery-information delivery-restock">
<a href="/kundenservice/lieferzeiten/" target="_blank" style="color: #f89d0e;">
<span class="delivery-status-indicator bg-warning"></span>
{{ deliverytime.name }} <span style="text-decoration: underline;">(mehr Infos)</span>
</a>
</p>
{% endif %}
{% endblock %}
{% elseif lineItem is defined and page.order.deliveries %}
{#Product final page show delivery time.#}
{% if lineItem.type == PRODUCT_LINE_ITEM_TYPE %}
{% set shippingMethodId = null %}
{% for key, value in page.order.deliveries.elements %}
{% if lineItem.orderId == value.orderId %}
{% set shippingMethodId = value.shippingMethodId %}
{% endif %}
{% endfor %}
{% set deliverytime = null %}
{% for key, value in page.salesChannelShippingMethods.elements %}
{% if shippingMethodId == value.id %}
{% set deliverytime = value.deliveryTime %}
{% endif %}
{% endfor %}
<p class="delivery-information delivery-available">
<a href="/kundenservice/lieferzeiten/" target="_blank" style="color: {{ lineItem.payload.deliveryTimeacColor }};">
{% if lineItem.payload.deliveryTimeac %}
<span class="delivery-status-indicator {% if lineItem.payload.deliveryTimeacColor == '#ffbd5d' %}bg-warning{%else%}bg-success bg-success-indicator{% endif %}"></span>
{{ lineItem.payload.deliveryTimeac }} <span style="text-decoration: underline;">(mehr Infos)</span>
{% else %}
<span class="delivery-status-indicator {% if lineItem.payload.deliveryTimeacColor == '#ffbd5d' %}bg-warning{%else%}bg-success bg-success-indicator{% endif %}"></span>
{{ deliverytime.name }} <span style="text-decoration: underline;">(mehr Infos)</span>
{% endif %}
</a>
</p>
{# <p class="delivery-information delivery-available">
<a href="/kundenservice/lieferzeiten/" target="_blank" style="color: #26c156;">
<span class="delivery-status-indicator bg-success"></span>
{{ deliverytime.name }}
</a>
</p> #}
{% endif %}
{% else %}
{#
1. Wenn Artikel auf Lager dann anzeige auf lager und grün
2. Alle anderen Werte in orangener Farbe
3. wenn verfügbarer Bestand negativ, dann Anzeige von "Lieferbar in 1-3 Wochen und orange
#}
<div class="{{ product.deliveryTime.translation('name') }}"></div>
<div class="product-delivery-information">
{% if product.shippingFree %}
{% block component_delivery_information_shipping_free %}
<p class="delivery-information delivery-shipping-free">
<a href="/kundenservice/lieferzeiten/" target="_blank" style="">
<span class="delivery-status-indicator bg-info"></span>
{{ "general.deliveryShippingFree"|trans|sw_sanitize }} <span style="text-decoration: underline;">(mehr Infos)</span>
</a>
</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">
<a href="/kundenservice/lieferzeiten/" target="_blank" style="">
<span class="delivery-status-indicator bg-danger"></span>
{{ "general.deliveryNotAvailable"|trans|sw_sanitize }} <span style="text-decoration: underline;">(mehr Infos)</span>
</a>
</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">
<a href="/kundenservice/lieferzeiten/" target="_blank">
<span class="delivery-status-indicator bg-warning"></span>
{{ "general.deliveryShipping"|trans|sw_sanitize }} {{ product.releaseDate|format_date('long', locale=app.request.locale) }} <span style="text-decoration: underline;">(mehr Infos)</span>
</a>
</p>
{% endblock %}
{% else %}
{% block component_delivery_information_available %}
<link itemprop="availability" href="http://schema.org/InStock"/>
{% if(product.deliveryTimeId == '32c6890dcfe34dae9ef1c16320b3afc2') %}
<p class="delivery-information delivery-available">
<a href="/kundenservice/lieferzeiten/" target="_blank" style="color: #26c156;">
<span class="delivery-status-indicator bg-success"></span>
{{ product.deliveryTime.translation('name') }} <span style="text-decoration: underline;">(mehr Infos)</span>
</a>
</p>
{% else %}
<p class="delivery-information delivery-restock">
<a href="/kundenservice/lieferzeiten/" target="_blank" style="color: #f89d0e;">
<span class="delivery-status-indicator bg-warning"></span>
{{ product.deliveryTime.translation('name') }} <span style="text-decoration: underline;">(mehr Infos)</span>
</a>
</p>
{% endif %}
{% endblock %}
{% endif %}
</div>
{#<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"/>
<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/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 %}
{% endif %}
</div>#}
{% endif %}
{% endblock %}