{% extends 'base.html' %}
{% block content %}


  <div class="row">
   
    <div class="col-md-12">
      <div class="card" style="padding-left: 20px;padding-top: 20px;">
        
       
            <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 class="table-responsive pt-3">
          
           
          <table class="table table-striped project-orders-table">
            {% if datarecords %}
            <p style="font-size: 20px;color: blue;text-align: center;">Data Between: "{{ start_date }} to {{ end_date }}"</p>
            <thead>
                <tr>
                    <th class="ml-5">S.No</th>
                    <th>Full Name</th>
                    <th>Profession</th>
                    <th>Mobile Number</th>
                    <th>Status</th>
                    <th>Action</th>
                  </tr>
                </thead>
                <tbody>
                  {% for i in datarecords %}
                  <tr>
                    <td>{{ forloop.counter }}</td>  <!-- Display serial number -->
                    <td>{{ i.fullname }}</td>       <!-- Display full name -->
                    <td>{{ i.profession }}</td>     <!-- Display profession -->
                    <td>{{ i.mobilenumber }}</td>   <!-- Display mobile number -->
                    {% if i.status == '2' %}
                    <td>Private</td>                <!-- Display status: Private if status is '1' -->
                    {% else %}
                    <td>Public</td>                 <!-- Display status: Public if status is not '1' -->
                    {% endif %}
                    <td>
                      <div class="d-flex align-items-center">
                        <a href="{% url 'view_data' i.id %}" class="btn btn-success btn-sm btn-icon-text mr-3">Edit Details <i class="typcn typcn-edit btn-icon-append"></i></a>
                        <a href="{% url 'delete_data' i.id %}" onclick="return confirm('Do you really want to delete?');" class="btn btn-danger btn-sm btn-icon-text" style="color:white">Delete <i class="typcn typcn-delete-outline btn-icon-append"></i></a>
                      </div>
                    </td>
                  </tr>
                  {% endfor %}
                
            </tbody>
            {% endif %}
        </div>
    </table>
   
         
         
        </div>
       
      </div>
    </div>
    </div>
 
  {% endblock %}