{% extends '@Public/common/general-layout.html.twig' %}
{% set donatsCartRouteIndex = constant('FMT\\Application\\Controller\\Student\\CartController::ROUTE_INDEX') %}
{% block content %}
<section class="content cart">
<div class="box box-primary books-box box-solid">
<div class="box-header with-border">
<h3 class="box-title">
{{ 'fmt.cart.title'|trans }}
</h3>
</div>
<div class="box-body">
<table class="table">
<tbody>
{% if cart.items|length > 0 %}
{% for item in cart.items %}
{% include '@Public/common/cart/_cart_row.html.twig' with {item: item} only %}
{% endfor %}
{% endif %}
<tr class="cart-is-empty{% if cart.items|length > 0 %} hidden{% endif %}">
<td rowspan="3">{{ 'fmt.cart.empty'|trans }}</td>
</tr>
</tbody>
<tfoot class="cart-summary summary{% if cart.items|length == 0 %} hidden{% endif %}">
<tr>
<td class="text-right">{{ 'fmt.cart.summary.subtotal'|trans }}</td>
<td class="cart-summary-subtotal text-right">{{ cart.getNetPrice()|price }}</td>
<td></td>
</tr>
<tr>
<td class="text-right">{{ 'fmt.cart.summary.shipping'|trans }}</td>
<td class="cart-summary-shipping text-right">{{ cart.shipping|price }}</td>
<td></td>
</tr>
<tr>
<td class="text-right">{{ 'fmt.cart.summary.tax'|trans }}</td>
<td class="cart-summary-tax text-right">{{ cart.tax|price }}</td>
<td></td>
</tr>
<tr>
<td class="text-right">{{ 'fmt.cart.summary.fmt_tax_fee'|trans }}</td>
<td class="cart-summary-fmt-fee text-right">{{ cart.fmtFee|price }}</td>
<td></td>
</tr>
<tr>
<td class="text-right">{{ 'fmt.cart.summary.transaction_fee'|trans }}</td>
<td class="cart-summary-transaction-fee text-right">{{ cart.transactionFee|price }}</td>
<td></td>
</tr>
<tr>
<td class="text-right"><strong>{{ 'fmt.cart.summary.total'|trans }}</strong></td>
<td class="cart-summary-total text-right"><strong>{{ cart.total|price }}</strong></td>
<td>
{% if student %}
<form action="{{ path(donatsCartRouteIndex) }}">
<input class="btn btn-primary btn-sm btn-fix-text btn-pay-with-donations" type="submit" value="Pay with donations"
{% if not payWithDonations %}
disabled title="You don’t have enough donations"
{% endif %}
/>
</form>
{% endif %}
</td>
</tr>
</tfoot>
</table>
</div>
</div>
{% if cart.total != 0 %}
{% include '@Public/form/checkout.html.twig' with { "form": form, "checkout" : true, "student" : "Student" } %}
{% endif %}
</section>
{% endblock content %}
{% block footer_scripts %}
{{ encore_entry_script_tags('common.campaign.view') }}
{{ encore_entry_script_tags('common.cart') }}
{% endblock footer_scripts %}