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


<div class="container">
    <div class="row">

        
        <form  method="post" class="col-4 offset-1">
            <h1>Add Category</h1>
            {% csrf_token %}
            {{form}}
            <input type="submit" value="Submit">
        </form>

        <div class="col-7">
            <table class="table">
                <tr>
                    <th>Name</th>
                    <th>SubCategory</th>
                    <th>Update</th>
                    <th>Delete</th>
                </tr>

                {% for category in Categories reversed %}
                <tr>
                    
                    <td>{{ category }}</td>
                    <td><a class="btn btn-info" href="{% url 'adminAddSubCategory' category %}">SubCategory</a></td>

                    <td><a class="btn btn-warning" href="{% url 'adminUpdateCategory' category.id %}">Update</a></td>

                    <td>
                        <form action="{% url 'adminDeleteCategory' category.id %}" method="post">
                            {% csrf_token %}
                            <input class="btn btn-danger" type="submit" value="Delete">
                        </form>
                    
                    </td>
                </tr>
                    
                {% empty %}
                
                <h1>No Category Found</h1>
                
                {% endfor %}
            </table>
        </div>
        
    </div>
</div>

{% endblock content%}


