{% import "@SyliusShop/Common/Macro/money.html.twig" as money %}
{% set itemsSubtotal = sylius_order_items_subtotal(order) %}
{% set taxIncluded = sylius_order_tax_included(order) %}
{% set taxExcluded = sylius_order_tax_excluded(order) %}
{# {{ dump(order.items) }} #}
<div class="checkout-right-summary">
<table class="ui very basic table" id="sylius-checkout-subtotal" {{ sylius_test_html_attribute('checkout-subtotal') }}>
<thead>
{# <tr>
<th class="sylius-table-column-item">{{ 'sylius.ui.item'|trans }}</th>
<th class="sylius-table-column-qty">{{ 'sylius.ui.qty'|trans }}</th>
<th class="sylius-table-column-subtotal">{{ 'sylius.ui.subtotal'|trans }}</th>
</tr> #}
</thead>
<tbody>
{% for item in order.items %}
<tr>
<td>
{% include '@SyliusShop/Product/_mainImage.html.twig' with {'product': item.variant, 'filter': 'sylius_shop_product_tiny_thumbnail'} %}
<span>{{ item.quantity }}</span>
</td>
<td>
{{ item.getVariant.product.name }}
<small>
{% for adjustment in item.adjustments %}
({{ adjustment.label }})
{% endfor %}
<small>
</td>
<td class="right aligned" id="sylius-item-{{ item.variant.product.slug }}-subtotal" {{ sylius_test_html_attribute('item-subtotal', item.variant.product.slug) }}>
{{ money.convertAndFormat(item.subtotal) }}
</td>
</tr>
{% endfor %}
</tbody>
<tfoot>
<tr>
<td colspan="1" style="border-top: 2px solid #ddd;">
<strong>{{ 'sylius.ui.items_total'|trans }}:</strong>
</td>
<td colspan="2" id="sylius-summary-items-subtotal" class="right aligned" style="border-top: 2px solid #ddd;">
{{ money.convertAndFormat(itemsSubtotal) }}
</td>
</tr>
{# {% if taxIncluded or taxExcluded %}
<tr {% if taxIncluded and not taxExcluded %}{% endif %}>
<td colspan="1">
<strong>{{ 'sylius.ui.taxes_total'|trans }}:</strong>
</td>
<td colspan="2" class="right aligned">
{% if not taxIncluded and not taxExcluded %}
<div id="sylius-summary-tax-none">{{ money.convertAndFormat(0) }}</div>
{% endif %}
{% if taxExcluded %}
<div id="sylius-summary-tax-excluded">{{ money.convertAndFormat(taxExcluded) }}</div>
{% endif %}
{% if taxIncluded %}
<div>
<span id="sylius-summary-tax-included">{{ money.convertAndFormat(taxIncluded) }}</span>
</div>
{% endif %}
</td>
</tr>
{% endif %} #}
{% if order.shipments is not empty %}
<tr>
<td colspan="1">
<strong>{{ 'app.front.commande.estimation'|trans }}:</strong>
</td>
<td colspan="2" class="right aligned">
{% if order.getAdjustmentsTotal('shipping') > order.shippingTotal %}
<div class="old-price">{{ money.convertAndFormat(order.getAdjustmentsTotal('shipping')) }}</div>
{% endif %}
<span id="sylius-summary-shipping-total">{{ money.convertAndFormat(order.shippingTotal) }}</span>
</td>
</tr>
{% endif %}
{% if order.getOrderPromotionTotalWithoutGiftCard != 0 %}
<tr class="discount">
<td colspan="1">
<strong>Total {{ 'sylius.ui.discount'|trans }}:</strong>
</td>
<td colspan="2" id="sylius-summary-promotion-total" class="right aligned">
{{ money.convertAndFormat(order.getOrderPromotionTotalWithoutGiftCard) }}
</td>
</tr>
{% endif %}
{% if order.getAlreadyPaid is not empty %}
{% for payment in order.getAlreadyPaid %}
<tr>
<td colspan="1">
<strong>{{payment.method}}</strong>
</td>
<td colspan="2" class="right aligned">
<span id="sylius-summary-shipping-total">- {{money.convertAndFormat(payment.amount)}}</span>
</td>
</tr>
{% endfor %}
{% endif %}
{# {{order.getAlreadyPaid}}
#}
<tr class="ui large">
<td colspan="1">
<strong> {# {{ 'sylius.ui.order_total'|trans }}: #}
{{ 'app.front.panier.total'|trans }}
</strong>
{# <small>({{ 'app.front.panier.tvaincluse'|trans }})</small> #}
</td>
<td colspan="2" id="sylius-summary-grand-total" class="right aligned">
{{ money.convertAndFormat(order.total) }}
{# {{ order.leftToPay }} #}
</td>
</tr>
</tfoot>
</table>
</div>