{#{% extends "_layouts/base.html" %}#}
{% extends request.master_template %}
{% load as_vertical_form from bootstrap %}
{% load gross from prices %}
{% load i18n %}
{% block title %}{% trans "Your cart" %} — {{ block.super }}{% endblock %}
{% block breadcrumb %}
{{ block.super }}
<li><a href="{% url 'cart:index' %}">{% trans "Cart" %}</a></li>
{% endblock breadcrumb %}
{% block header_text %}{% trans "Shopping Cart" %}{% endblock header_text %}
{% block content %}
<div class='container' style='padding-bottom:25px;'>
<div class='row' style='margin-top:40px;'></div>
{% if cart %}
<div style='float:right;'>
<a href='/products/'>
<button class='btn btn-blue'>{% trans "Continue Shopping" %}</button>
{# <img src='{{ STATIC_URL }}img/{% trans "continue_shopping" %}.gif' alt="Continue Shopping" /> #}
</a>
</div>
<form id='cart_form' role="form" action="." method="post">
{% csrf_token %}
{{ formset.management_form }}
<table class="table table-striped">
<thead>
<tr>
<th class="col-sm-4">{% trans "Product" %}</th>
<th class="col-sm-2">{% trans "Quantity" %}</th>
<th class="col-sm-2">{% trans "Price" %}</th>
<th class="col-sm-2">{% trans "Subtotal" %}</th>
</tr>
</thead>
<tfoot>
{# <tr> #}
{# <td class="col-sm-4">{% trans "Shipping" %}</td> #}
{# <td class="col-sm-2"></td> #}
{# <td class="col-sm-2"></td> #}
{# <td class="col-sm-2 individual_item_total">${{ cart.get_delivery_total.gross|floatformat:2 }}</td> #}
{# </tr> #}
<tr>
<td class="col-sm-4"></td>
<td class="col-sm-2">
<button class="btn btn-default" type="submit">
{% trans "Update Cart" %}
</button>
</td>
<th class="col-sm-2">{% trans "Total" %}:</th>
<td class="col-sm-2 total_price">${{ cart.get_my_sub_total.gross|floatformat:2 }}</td>
</tr>
</tfoot>
<tbody>
{% for form in formset %}
<tr>
<td><a href="{{ form.cart_line.product.get_absolute_url }}">{{ form.cart_line.product }}</a></td>
<td>{{ form.quantity|as_vertical_form:False }}</td>
{# <td>{% gross form.cart_line.get_price_per_item %}</td> #}
<td>${{ form.cart_line.get_price_per_item.gross|floatformat:2 }}</td>
{# <td class='individual_item_total'>{% gross form.cart_line.get_total %}</td> #}
<td><div class='individual_item_total'>${{ form.cart_line.get_total.gross|floatformat:2 }}</div></td>
</tr>
{% endfor %}
</tbody>
</table>
<div class="form-group" style='clear:both;'>
<div style='float:left;'>
<a href="javascript:clearCart('{% trans 'Empty Your Cart?' %}','{% trans 'Are you sure you want to empty your cart?' %}','{% trans 'Proceed' %}','{% trans 'Cancel' %}')" class='btn btn-default'>{% trans "Empty Cart" %}</a>
</div>
<div style='float:right;'>
{#<a href="{% url "checkout:index" %}">#}
<a href="javascript:validate_checkout();">
<div class='btn btn-blue'>{% trans "Check Out Now" %}</div>
{# <img src='{{ STATIC_URL }}img/{% trans "check_out_now" %}.gif' alt='Check Out' /> #}
</a>
</div>
</div>
</form>
{% else %}
<h1>
{% trans "Your cart is empty" %}
</h1>
{% endif %}
</div>
<script type='text/javascript'>
function validate_checkout() {
$("#cart_form input:not([type='hidden'])").each(function(){
$(this).val( parseInt($(this).val()) );
this.value = parseInt(this.value);
}).promise().done(function(){window.location = "{% url 'checkout:index' %}"});
}
</script>
{% endblock content %}
{% block doc_ready %}
{# {% if messages %} #}
{# {% for msg in messages %} #}
{# alert('{{ msg }}'); #}
{# {% endfor %} #}
{# {% endif %} #}
{% endblock %}