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

{% set unitPromotionAdjustment = constant('Sylius\\Component\\Core\\Model\\AdjustmentInterface::ORDER_UNIT_PROMOTION_ADJUSTMENT') %}
{% set unitPromotions = item.units.first.adjustments(unitPromotionAdjustment) %}
<tr {{ sylius_test_html_attribute('product-row', item.productName) }}>
    <td>
        {% include '@SyliusShop/Product/_info.html.twig' with {'variant': item.variant} %}
    </td>

    <td class="text-right">
        {% if item.unitPrice != item.discountedUnitPrice %}
            <i class="question circle icon unit-promotions"
               data-toggle="tooltip"
               title="{% for promotion in unitPromotions %}<div>{{ promotion.label }}: {{ money.convertAndFormat(promotion.amount) }}</div>{% endfor %}"
            ></i>
        {% endif %}

        <div class="price-wrapper-vertical">
            <span class="title-mobile">{{ 'sylius.ui.unit_price'|trans }}</span>
            {% if item.unitPrice != item.discountedUnitPrice %}
                <span class="price-old" {{ sylius_test_html_attribute('product-old-price', item.productName) }}>{{ money.convertAndFormat(item.unitPrice) }}</span>
            {% endif %}
            <span class="price {% if item.unitPrice != item.discountedUnitPrice %}promo{% endif %}" {{ sylius_test_html_attribute('product-unit-price', item.productName) }}>{{ money.convertAndFormat(item.discountedUnitPrice) }}</span>
        </div>
    </td>

    <td class="text-md-center">
        <span class="title-mobile">{{ 'sylius.ui.qty'|trans }}</span>
        {{ item.quantity }}
    </td>
    <td class="text-right">
        <span class="title-mobile">{{ 'sylius.ui.total'|trans }}</span>
        <span class="price">{{ money.convertAndFormat(item.subtotal) }}</span>
    </td>
</tr>
