<table class="mall-table">
    {% for product in products %}
        <tr>
            <td>
                {{ product.name }}
                {% if product.service_options %}
                    {% for option in product.service_options %}
                        <br/>
                        <span class="text-muted">
                        <strong>{{ 'offline.mall::lang.common.service' | trans }}</strong>:
                        {{ option.name }}
                    </span>
                    {% endfor %}
                {% endif %}
                {% if product.variant %}
                    <br/>
                    <span class="text-muted">
                        {{ product.variant.properties_description | raw }}
                    </span>
                {% endif %}
                {% if product.custom_field_values %}
                    <br/>
                    <span class="text-muted">
                        {{ product.custom_field_value_description | raw }}
                    </span>
                {% endif %}
                {% if product.product_file_grants.count > 0 %}
                    <br/>
                    {% for grant in product.product_file_grants %}
                        <br/>
                        <a href="{{ grant.download_link }}">
                            Download {{ grant.display_name }}
                            {{ loop.length > 1 ? ('#' ~ loop.index) }}
                        </a>
                        {% if grant.expires_at %}
                            <br>valid until {{ grant.expires_at.toDateString() }}
                        {% endif %}
                        {% if grant.max_download_count %}
                            <br>max. {{ grant.max_download_count }} downloads
                        {% endif %}
                    {% endfor %}
                {% endif %}
            </td>
            <td>{{ product.quantity }}</td>
            <td class="text-right">
                {{ product.pricePostTaxes() | raw }}
                {% if product.service_options %}
                    {% for option in product.service_options %}
                        <div class="text-muted" title="{{ option.name }}">
                            + {{ option.price_formatted }}
                        </div>
                    {% endfor %}
                {% endif %}
            </td>
            <td class="text-right">
                {{ product.totalPostTaxes() | raw }}
            </td>
        </tr>
    {% endfor %}
    <tr class="mall-cart__total">
        <td></td>
        <td colspan="2">
            {{ 'offline.mall::frontend.total' | trans }}
        </td>
        <td class="text-right">
            {{ order.totalProductPostTaxes() | raw }}
        </td>
    </tr>
    <tr class="mall-cart__shipping">
        <td></td>
        <td colspan="2">
            {{ order.shipping.method.name }}
        </td>
        <td class="text-right">
            {{ order.totalShippingPostTaxes() | raw }}
        </td>
    </tr>
    {% for entry in order.discounts %}
        <tr class="mall-cart__discount">
            <td></td>
            <td colspan="2">
                {{ entry.discount.name }}
                {% if entry.discount.code %}
                    ({{ entry.discount.code }})
                {% endif %}
            </td>
            <td class="text-right">
                {{ entry.savings_formatted }}
            </td>
        </tr>
    {% endfor %}
    {% if order.payment and order.payment.total > 0 %}
        <tr class="mall-cart__payment">
            <td></td>
            <td colspan="2">
                {{ order.payment_method.fee_label | default(order.payment_method.name) }}
            </td>
            <td class="text-right">
                {{ order.payment.total | money }}
            </td>
        </tr>
    {% endif %}
    <tr class="mall-cart__grand-total">
        <td></td>
        <td colspan="2">
            {{ 'offline.mall::frontend.grand_total' | trans }}
        </td>
        <td class="text-right">
            {{ order.totalPostTaxes() | raw }}
        </td>
    </tr>
</table>
