{% extends "webshop/base.html" %}
{% block section_title %}Cart{% endblock %}
{% block content %}
    <h3>List of Items in your Shopping Cart:</h3>
    {% if cart_position_list_zip %}
      <table class="table price-table">
        <tr class="table_header">
          <th scope="col">POS.</th>
          <th scope="col">ART#</th>
          <th scope="col">NAME</th>
          <th scope="col">STOCK</th>
          <th scope="col">AMOUNT</th>
          <th scope="col" class="price-label">PRICE p.pce.</th>
          <th scope="col" class="price-label">POSITION PRICE</th>
        </tr>
        {% for cart_position, amount_form in cart_position_list_zip %}
          <tr class="table_content">
            <td scope="col">{{ cart_position.id }}</td>
            <td scope="col">{{ cart_position.article.id }}</td>
            <td scope="col">
              <a href="{% url 'details' cart_position.article.id %}">
                {{ cart_position.article.name }}
              </a>
            </td>
            <td scope="col">{{ cart_position.article.stock }}</td>
            <td scope="col">
              <form id="amount_form" action="" method="POST" novalidate>
                {{ amount_form.as_p }}
                <input type="hidden" value="{{ cart_position.article.id }}" name="article_id">
                <input type="submit" value="change" />
                <input type="submit" value="delete" name="delete" />
                {% csrf_token %}
              </form>
              <!-- {{ article.amount }} -->
            </td>
            <td scope="col" class="price-value">
              {{ cart_position.article.price_in_chf }}
              {{ currency_name }}
            </td>
            <td scope="col" class="price-value">
              {{ cart_position.position_price }} {{ currency_name }}
            </td>
          </tr>
        {% endfor %}
        <tr>
          <td scope="col" colspan="5"class="text-right">
          <td scope="col" class="price-value">
            <dl><dt>Total:</dl></dt></td>
          <td scope="col" class="price-value">
             <dl><dt>{{ total }} {{ currency_name }}</dl></dt>
          </td>
        </tr>
      </table>
      <a href="{% url 'checkout' %}" class="btn btn-primary" role="button">
        CHECKOUT
      </a>
    {% else %}
      <p class="alert alert-danger">
        <strong>
          This cart seams to lack some Items.
          Go get some in the store!
        <strong>
      </p>
    {% endif %}
    <p class="alert text-danger">
      <strong>
        {{ message }}
      <strong>
    </p>
{% endblock %}
