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

{% block title %}
  {% translate "Checkout" %}
{% endblock %}

{% block content %}
  <h1>{% translate "Checkout" %}</h1>
  <div class="order-info">
    <h3>{% translate "Your order" %}</h3>
    <ul>
      {% for item in cart %}
        <li>
          {{ item.quantity }}x {{ item.product.name }}
          <span>${{ item.total_price|floatformat:2 }}</span>
        </li>
      {% endfor %}
      {% if cart.coupon %}
        <li>
          {% blocktranslate with code=cart.coupon.code discount=cart.coupon.discount %}
            "{{ code }}" ({{ discount }}% off)
          {% endblocktranslate %}
          <span class="neg">- ${{ cart.get_discount|floatformat:2 }}</span>
        </li>
      {% endif %}
    </ul>
    <p>{% translate "Total" %}: ${{ cart.get_total_price_after_discount|floatformat:2 }}</p>
  </div>
  <form method="post" class="order-form">
    {{ form.as_p }}
    <p><input type="submit" value="{% translate "Place order" %}"></p>
    {% csrf_token %}
  </form>
{% endblock %}
