{% extends 'app/baseAdmin.html' %}
{% load static %}
{% block content %}

<div class="container">
    <div class="panel panel-danger">
        <div class="panel-heading">
            <h1 class="panel-title">Total Products</h1>
            <h4 style="text-align: end;"><a href="{% url 'adminAddProduct' %}">Add Product</a></h4>
        </div>
        <table class="table table-hover table-bordered" id="dev-table">
            <thead>
                <tr>
                    <th>Name</th>
                    <th>Image</th>
                    <th>Selling Price</th>
                    <th>Orignal Price</th>
                    <th>Description</th>
                    <th>Categorys</th>
                    <th>SubCategorys</th>
                    <th>Action</th>
                </tr>
            </thead>
            {% for product in products reversed %}
                <tr>
                    <td>{{product.title}}</td>
                    <td><img src="{{ product.product_image.url }}" alt="{{product.name}}" height="40px" width="40px"></td>
                    <td>{{product.selling_price}}</td>
                    <td>{{product.discount}}</td>
                    <td>{{product.description}}</td>
                    <td>{{product.categories}}</td>
                    <td>{{product.subCate}}</td>
                    <td>
                        <a href="{% url 'adminUpdateProduct' product.id %}" class="btn btn-primary btn-xs mt-2"><span class="glyphicon glyphicon-edit"></span></a>
                        <a href="{% url 'adminDeleteProduct' product.id %}" class="btn btn-danger btn-xs mt-2"><span class="glyphicon glyphicon-trash"></span></a>
                    </td>
                </tr>
            {% empty %}
            <td colspan="6" class="text-center"><h1>No Product Found.</h1></td>
            {% endfor %}
        </table>
    </div>
</div>

{% endblock content %}