{% extends "shop/base.html" %}
{% load i18n %}

{% block title %}
  {% trans "Kasa" %}
{% endblock %}

{% block content %}
  <h1>{% trans "Kasa" %}</h1>

  <div class="order-info">
    <h3>{% trans "Zamówienie" %}</h3>
    <ul>
      {% for item in cart %}
        <li>
          {{ item.quantity }}x {{ item.product.name }}
          <span>{{ item.total_price }} zł</span>
        </li>
      {% endfor %}
      {% if cart.coupon %}
        <li>
          {% blocktrans with code=cart.coupon.code discount=cart.coupon.discount %} 
		     "{{ code }}" ({{ discount }}% rabatu)
          {% endblocktrans %}
          <span>- {{ cart.get_discount|floatformat:"2" }} zł</span>
        </li>
      {% endif %}
    </ul>
    <p>{% trans "Wartość całkowita" %}: {{ cart.get_total_price_after_discount|floatformat:"2" }} zł</p>
  </div>

  <form action="." method="post" class="order-form">
    {{ form.as_p }}
    <p><input type="submit" value="{% trans "Złóż zamówienie" %}"></p>
    {% csrf_token %}
  </form>
{% endblock %}