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

    <div class="col-lg-12 grid-margin stretch-card">
      <div class="card">
        <div class="card-body">
            <div class="card-block">
                <h4 class="sub-title">Between Dates Report</h4>
                <form method="get" action="" enctype="multipart/form-data">
                    {% csrf_token %}
                    <div class="form-group row">
                        <label class="col-sm-2 col-form-label">From Date</label>
                        <div class="col-sm-10">
                            <input type="date" id="query" name="start_date" class="form-control" required="">
                        </div>
                    </div>
                     <div class="form-group row">
                        <label class="col-sm-2 col-form-label">To Date</label>
                        <div class="col-sm-10">
                            <input type="date" id="query" name="end_date" class="form-control" required="">
                        </div>
                    </div>
    
    
                    <div class="form-group row">
                        <div class="col-sm-10">
                            <button type="submit" class="btn btn-dark">Submit</button>
                        </div>
                    </div>
                </form>
                        
                            </div>
                            {% if userdetails %}
        <p style="font-size: 20px;color: blue;text-align: center;">Data Between: "{{ start_date }} to {{ end_date }}"</p>
         
          {% include 'includes/messages.html' %}
          <table class="table table-bordered">
            <thead>
              <tr>
                <th style="font-weight: bolder;"> # </th>
                <th style="font-weight: bolder;"> User Name</th>
                <th style="font-weight: bolder;"> Email</th>
                <th style="font-weight: bolder;"> Contcat Number</th>
               
                <th style="font-weight: bolder;"> Reg Date </th>
               
                <th style="font-weight: bolder;">Action </th>
              </tr>
            </thead>
            <tbody>
                {% for i in userdetails %}
              <tr>
                <td> {{ forloop.counter }} </td>
                <td>{{i.admin.first_name}} {{i.admin.first_name}}</td>
                <td>{{i.admin.email}}</td> 
                <td>{{i.mobilenumber}}</td>              
                <td>{{i.regdate_at}}</td>
               
                <td><a href="{% url 'viewusers' i.id %}" class="btn btn-success">
                    View</a> <a href="{% url 'delete_user' i.id %}" class="btn btn-danger">
                        DELETE</a> <a href="{% url 'view_complaints' i.id %}" class="btn btn-primary">
                            Complaints</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>
        {% endif %}
      </div>
    </div>
    
    
  </div>
  {% endblock %}