{% extends 'base.html' %}
{% block content %}
{% load static %}
  

 <section id="cart-view">
   <div class="container">
     <div class="row">
       <div class="col-md-12">
         <div class="cart-view-area">
           <div class="cart-view-table">
             <form action="">
               <div class="table-responsive">
                  <table class="table">
                    <thead>
                      <tr>
                        <th></th>
                        <th></th>
                        <th>Product</th>
                        <th>Price</th>
                        <th>Quantity</th>
                        <th>Total</th>
                      </tr>
                    </thead>
                    {% for order_item in object.items.all %}
                    <tbody>
                      
                      <tr>
                        <td><a class="remove" href="{% url 'core:remove-from-cart' order_item.item.slug %}"><fa class="fa fa-close"></fa></a></td>
                        <td><a href="#"><img src="{{ order_item.item.thumbnail.url }}" alt="img"></a></td>
                        <td><a class="aa-cart-title">{{ order_item.item.title }}</a></td>
                        <td>Kshs {{ order_item.item.price }}</td>
                        <td><a href="{% url 'core:add-to-cart' order_item.item.slug %}"><b>+</b></a> {{ order_item.quantity }} <a href="{% url 'core:remove-single-item-from-cart' order_item.item.slug %}"><b>-</b></a></td>
                        {% if order_item.item.discount_price %}
                        <td>Kshs {{ order_item.get_total_discount_item_price }} <b>(Saving Kshs {{ order_item.get_amount_saved }})</b></td>     
                        {% else %}
                        <td>Kshs {{ order_item.get_total_item_price }}</td>

                        {% endif %}
                      <tr>                    
                      </tr>
                      </tbody>
                      {% empty %}
                      <td><a class="remove">Your cart is empty </a></td>
                      
                      <td><a href="/" class="btn btn-primary float-right">Continue Shoping</a></td>
                      {% endfor %}
                  </table>
                </div>
             </form>
             <!-- Cart Total view -->
             {% if object.get_total %}
             <div class="cart-view-total">
               <h4>Order Totals</h4>
               <table class="aa-totals-table">
                 <tbody>
                   <tr>
                     <th>Total</th>
                     <td><b>Kshs {{ object.get_total }}</b></td>
                   </tr>
                 </tbody>
               </table>
               <a href="/payment/" class="btn btn-warning float-left ml-2">Proceed to Checkout</a>
               <a href="/" class="btn btn-primary float-right">Continue Shoping</a>
             </div>
             {% endif %}
           </div>
         </div>
       </div>
     </div>
   </div>
 </section>



{% endblock content %}

  
 


