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

{% block title %}Zapłać za zamówienie{% endblock %}

{% block content %}
  <h1>Podsumowanie zamówienia</h1>
  <table class="cart">
    <thead>
      <tr>
        <th>Zdjęcie</th>
        <th>Produkt</th>
        <th>Cena</th>
        <th>Ilość</th>
        <th>Razem</th>
      </tr>
    </thead>
    <tbody>
      {% for item in order.items.all %}
        <tr class="row{% cycle "1" "2" %}">
          <td>
            <img src="{% if item.product.image %}{{ item.product.image.url }}
            {% else %}{% static "img/no_image.png" %}{% endif %}">
          </td>
          <td>{{ item.product.name }}</td>
          <td class="num">{{ item.price }} zł</td>
          <td class="num">{{ item.quantity }}</td>
          <td class="num">{{ item.get_cost }} zł</td>
        </tr>
      {% endfor %}
      <tr class="total">
        <td colspan="4">Razem</td>
        <td class="num">{{ order.get_total_cost }} zł</td>
      </tr>
    </tbody>
  </table>
  <form action="{% url "payment:process" %}" method="post">
    <input type="submit" value="Zapłać teraz">
    {% csrf_token %}
  </form>
{% endblock %}
