{#
# Project: www.betten-abc.de
# Company: arboro GmbH
# Created by: Daniel Geike
# Created on: 22.08.22
# Description:
#}
{% sw_extends "@Storefront/storefront/component/delivery-information.html.twig" %}
{% block component_delivery_information_soldout %}
{{ block("component_delivery_information_default") }}
{% endblock %}
{% block component_delivery_information_restock %}
{{ block("component_delivery_information_default") }}
{% endblock %}
{% block component_delivery_information_default %}
{# controls the default status for "Availability" microdata #}
{# string will be appended to "http://schema.org/" #}
{% set availabilityStatus = "InStock" %}
{# initially set status to available #}
{# controls the color of text and icon #}
{% set status = "success" %}
{% if page.product %}
{% set product = page.product %}
{% endif %}
{% set shippingTimes = {
"252": "general.defaultDeliveryTime"|trans,
"323": "general.defaultDeliveryTime"|trans,
"400": "general.dispatchDeliveryTime"|trans,
"500": "general.extraServiceDeliveryTime"|trans
} %}
{% if product.stock <= 0 %}
{% set availabilityStatus = "LimitedAvailability" %}
{% set status = "danger" %}
{% set shippingTime = "general.restockDeliveryTime"|trans({
"%count%": product.restockTime,
"%days%": product.restockTime
}) %}
{% elseif product.translated.customFields.custom_product_1 %}
{% set shippingTime = shippingTimes[product.translated.customFields.custom_product_1|number_format] %}
{% else %}
{% set shippingTime = "general.defaultDeliveryTime"|trans %}
{% endif %}
{% block component_delivery_information_default_availability %}
<link itemprop="availability" href="http://schema.org/{{ availabilityStatus }}"/>
{% endblock %}
{% block component_delivery_information_default_icon %}
<span class="delivery-status-indicator bg-{{ status }}"></span>
{% endblock %}
{% block component_delivery_information_default_text %}
{% set FURNPLAN_CONTAINER_LINE_ITEM_TYPE = constant('ArboroFurnplan\\Core\\Checkout\\Furnplan\\LineItemFactoryHandler\\FurnplanContainerLineItemFactory::TYPE') %}
{% if lineItem.type == FURNPLAN_CONTAINER_LINE_ITEM_TYPE %}
{{ block("component_delivery_information_default_text_furnplan", "@ArboroFurnplan/storefront/component/delivery-information.html.twig") }}
{% else %}
{% if status is same as("success") %}
{{ "detail.deliveryTimeAvailable"|trans({
'%name%': shippingTime
})|sw_sanitize }}
{% else %}
{{ "detail.deliveryTimeNotAvailable"|trans({
'%deliveryTime%': shippingTime
})|sw_sanitize }}
{% endif %}
{% endif %}
{% endblock %}
{% endblock %}