{% import "@SyliusShop/Common/Macro/money.html.twig" as money %}

{% if cart.empty == false %}

    <div class="rollover-container">
        <div class="rollover-wrapper rollover-items">
            <div class="items" data-simplebar data-simplebar-auto-hide="false">
                {% for item in cart.items %}
                    {% set product = item.product %}

                    <div class="item">
                        <div class="item-name">
                            <a class="link-secondary text-decoration-none" href="{{ path('sylius_shop_product_show', {'slug': product.slug }) }}">
                                <strong>{{ product }}</strong>
                            </a>
                            {% if item.variant.optionValues is not null %}
                                <div class="item-options">
                                    {% for optionValue in item.variant.optionValues %}
                                        <em>{{ optionValue.value }}</em>
                                    {% endfor %}
                                </div>
                            {% endif %}
                        </div>

                        <div class="item-price-wrapper">
                            <span class="item-qty">x {{ item.quantity }}</span>

                            <span class="item-price">
                                {% if item.unitPrice != item.discountedUnitPrice %}
                                    <span class="product-price-old">{{ money.convertAndFormat(item.unitPrice) }}</span>
                                {% endif %}
                                <span class="price product-price{% if item.unitPrice != item.discountedUnitPrice %} promo{% endif %}" {{ sylius_test_html_attribute('cart-product-unit-price', item.productName) }}>{{ money.convertAndFormat(item.discountedUnitPrice) }}</span>
                            </span>
                        </div>
                    </div>
                {% endfor %}
            </div>
            <div class="item total">
                <strong>{{ 'sylius.ui.subtotal'|trans }}</strong>
                <span class="price-sm">{{ money.convertAndFormat(cart.itemsTotal) }}</span>
            </div>

            <div class="btn-wrapper">
                <a href="{{ path('sylius_shop_cart_summary') }}" class="btn btn-sm btn-outline-secondary">{{ 'sylius.ui.view_and_edit_cart'|trans }}</a>
                <a href="{{ path('sylius_shop_checkout_start') }}" class="btn btn-sm btn-primary">{{ 'sylius.ui.checkout'|trans }}</a>
            </div>
        </div>
    </div>
{% endif %}
