{% extends 'app/baseAdmin.html' %}
{% load static %}
{% block content %}
<div class="container">
    <div class="panel panel-danger">
      <div class="panel-heading">
        <h6 class="panel-title">Total Orders</h6>
      </div>
      <table class="table table-hover table-bordered" id="dev-table">
        <thead>
          <tr>
            <th>Customer</th>
            <th>Contact</th>
            <th>Address</th>
            <th>Product</th>
            <th>Image</th>
            <th>Ordered Date</th>
            <th>Status</th>
            <th>Payment</th>
            <th>Amount</th>
          </tr>
        </thead>

        <tbody>
            {% for order in Orders reversed %}
            <tr>
                <td>{{order.customer}}</td>
                <td>{{order.customer.mobile}}</td>
                <td><a href="{% url 'updateAddress' order.customer.id %}">{{order.customer.city}}</a></td>
                <td><a href="{% url 'product-detail' order.product.id %}">{{order.product}}</a></td>
                <td><img src="{{order.product.product_image.url}}" alt="order.product.product_image" width="100"></td>
                <td>{{order.ordered_date}}</td>
                <td><a href="{% url 'adminOrderStatus' order.id %}">{{order.status}}</a></td>
                <td>{{order.payment}}</td>
                <td>{{order.amount}}</td>
            </tr>
            {% endfor %}
        </tbody>

        {% comment %} <!-- p for product, c for customer-->
        {% for product,customer,order in data %}
        <tr>
          {% for c in customer %}
          <td> {{c.get_name}}</td>
          <td>{{c.mobile}}</td>
          <td>{{order.address}}</td>
  
          {% endfor %}
          {% for p in product %}
          <td> {{p.name}}</td>
          <td> <img src="{% static p.product_image.url %}" alt="Profile Pic" height="40px" width="40px" /></td>
          <td>{{order.status}}</td>
          <td><a class="btn btn-primary btn-xs" href="{% url 'update-order' order.id  %}"><span class="glyphicon glyphicon-edit"></span></a>
          <a class="btn btn-danger btn-xs" href="{% url 'delete-order' order.id  %}"><span class="glyphicon glyphicon-trash"></span></a></td>
  
          {% endfor %}
        </tr>
        {% endfor %}
         {% endcomment %}


      </table>
    </div>
  </div>
{% endblock content %}