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

{% block title %}
  Kasa
{% endblock %}

{% block content %}
  <h1>Kasa</h1>
  <div class="order-info">
    <h3>Zamówienie</h3>
    <ul>
      {% for item in cart %}
        <li>
          {{ item.quantity }}x {{ item.product.name }}
          <span>{{ item.total_price|floatformat:2 }} zł</span>
        </li>
      {% endfor %}
      {% if cart.coupon %}
        <li>
          Kupon "{{ cart.coupon.code }}" ({{ cart.coupon.discount }}% rabatu)
          <span class="neg">-{{ cart.get_discount|floatformat:2 }} zł</span>
        </li>
      {% endif %}
    </ul>
    <p>Razem: {{ cart.get_total_price_after_discount|floatformat:2 }} zł</p>
  </div>
  <form method="post" class="order-form">
    {{ form.as_p }}
    <p><input type="submit" value="Złóż zamówienie"></p>
    {% csrf_token %}
  </form>
{% endblock %}
