{% import "@CoreShopFrontend/Common/Macro/currency.html.twig" as currency %}

{% if cart.hasPriceRules %}
    {% for priceRule in cart.priceRuleItems %}
        <tr>
            <td colspan="2" class="text-left">
                {{ priceRule.cartPriceRule.label ?: priceRule.cartPriceRule.name }}
            </td>
            <td class="text-center"></td>
            <td class="text-right" colspan="2">
                {% if priceRule.discount != 0 %}
                    {{ currency.convertAndFormat(priceRule.discount(true)) }} ({{ currency.convertAndFormat(priceRule.discount(false)) }})
                {% endif %}
            </td>
            <td colspan="1" class="text-left cart-sub-total">
                {% if priceRule.cartPriceRule.isVoucherRule and is_granted('CORESHOP_CART_REMOVE_PRICE_RULE') %}
                <a title="{{ 'coreshop.ui.remove'|trans }}" class="btn btn-danger tool-tip" href="{{ path('coreshop_cart_remove_price_rule', {'code' : priceRule.voucherCode }) }}">
                    <i class="fa fa-times-circle"></i>
                </a>
                {% endif %}
            </td>
        </tr>
    {% endfor %}
{% endif %}
