{% extends 'base.html' %}
{% block content %}
<div class="row">

    <div class="col-lg-12 grid-margin stretch-card">
      <div class="card">
        <div class="card-body">
          <h4 class="card-title">Manage State</h4>
          {% include 'includes/messages.html' %}
          <table class="table table-bordered">
            <thead>
              <tr>
                <th style="font-weight: bolder;"> # </th>
                <th style="font-weight: bolder;"> State Name</th>
               
                <th style="font-weight: bolder;"> Creation Date </th>
                <th style="font-weight: bolder;"> Updated Date </th>
                <th style="font-weight: bolder;">Action </th>
              </tr>
            </thead>
            <tbody>
                {% for i in states %}
              <tr>
                <td> {{ forloop.counter }} </td>
                <td>{{i.statename}}</td>
               
                <td>{{i.created_at}}</td>
                <td>{{i.updated_at}}</td>
                <td><a href="{% url 'update_state' i.id %}" class="btn btn-success">
                    EDIT</a> <a href="{% url 'delete_state' i.id %}" class="btn btn-danger">
                        DELETE</a></td>
              </tr>{% endfor %}
           
            </tbody>
          </table>
          <div class="pagination" style="padding-top: 10px;text-align: center;">
            <span class="step-links">
                {% if states.has_previous %}
                    <a href="?page=1">&laquo; first</a>
                    <a href="?page={{ states.previous_page_number }}">previous</a>
                {% endif %}
        
                <span class="current">
                    Page {{ states.number }} of {{ states.paginator.num_pages }}.
                </span>
        
                {% if states.has_next %}
                    <a href="?page={{ states.next_page_number }}">next</a>
                    <a href="?page={{ states.paginator.num_pages }}">last &raquo;</a>
                {% endif %}
            </span>
        </div>
        </div>
        
      </div>
    </div>
    
    
  </div>
  {% endblock %}