{% load i18n %}
<html>
<body>
  <h1>{%trans "Mój sklep" %}</h1>
  <p>
    {% trans "Faktura nr" %}{{ order.id }}<br>
    <span class="secondary">
      {{ order.created|date:"M d, Y" }}
    </span>
  </p>
  <h3>{% trans "Nabywca" %}</h3>
  <p>
    {{ order.first_name }} {{ order.last_name }}<br>
    {{ order.email }}<br>
    {{ order.address }}<br>
    {{ order.postal_code }}, {{ order.city }}
  </p>
  <h3>{% trans "Kupione produkty" %}</h3>
  <table>
    <thead>
      <tr>
        <th>{% trans "Produkt" %}</th>
        <th>{% trans "Cena" %}</th>
        <th>{% trans "Ilość" %}</th>
        <th>{% trans "Wartość" %}</th>
      </tr>
    </thead>
    <tbody>
      {% for item in order.items.all %}
        <tr class="row{% cycle "1" "2" %}">
          <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 %}
      {% if order.coupon %}
      <tr class="subtotal">
        <td colspan="3">{% trans "Suma częściowa" %}</td>
        <td class="num">
          {{ order.get_total_cost_before_discount|floatformat:2 }} zł
        </td>
      </tr>
      <tr>
        <td colspan=3>
          {% blocktrans with code=order.coupon.code discount=order.discount %}
             "{{ kupon }}" ({{ rabat }}% off)
          {% endblocktrans %}
        </td>
        <td class="num neg">
          - {{ order.get_discount|floatformat:2 }} zł
        </td>
      </tr>
    {% endif %}
    <tr class="total">
      <td colspan="3">{% trans "Razem" %}</td>
      <td class="num">{{ order.get_total_cost|floatformat:2 }} zł</td>
    </tr>
  </tbody>
</table>
    
  <span class="{% if order.paid %}paid{% else %}pending{% endif %}"> 
    {% if order.paid %}{% trans "Zapłacono" %}{% else %}{% trans "Oczekiwanie na płatność" %}{% endif %}
  </span>
</body>
</html>