{% extends 'base.html' %}
{% block content %}
<section class="content-header">
    <div class="container-fluid">
      <div class="row mb-2">
        <div class="col-sm-6">
          <h1>Search User Enquiry</h1>
        </div>
        <div class="col-sm-6">
          <ol class="breadcrumb float-sm-right">
            <li class="breadcrumb-item"><a href="{% url 'dashboard' %}">Home</a></li>
            <li class="breadcrumb-item active">Search User Enquiry</li>
          </ol>
        </div>
      </div>
    </div><!-- /.container-fluid -->
  </section>    <section class="content">
    <div class="container-fluid">
      <div class="row">
        <div class="col-12">
          <div class="card">
            <div class="card-header">
                <form method="get">
                    {% csrf_token %}
                   
                    <div class="form-group row">
                        <label class="col-sm-4 col-form-label">Search(By Mobilenumber, Enquiry Number an Fullname)</label>
                        <div class="col-sm-10">
                            <input type="text" id="query" name="query" 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>
            <!-- /.card-header -->
            {% if searchenq %}
            <div class="card-body">
                {% if messages %}
                {% for message in messages %}
                 {% if message.tags == 'error' %}
                <div class="alert alert-warning alert-dismissible fade show" role="alert">
                {{message}}
                <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                <span aria-hidden="true">&times;</span>
                 </button>
                  </div>
                {% endif %}
                {% endfor %}
                {% endif %}
                   {% if messages %}
                {% for message in messages %}
                 {% if message.tags == 'info' %}
                <div class="alert alert-warning alert-dismissible fade show" role="alert">
                {{message}}
                <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                <span aria-hidden="true">&times;</span>
                 </button>
                  </div>
                {% endif %}
                {% endfor %}
                {% endif %}
              <table id="example2" class="table table-bordered table-hover">
                <thead>
                    <tr>
                        <th>S.NO</th>
                  
                       
                          <th>Enquiry Number</th>
                          <th>Full Name</th>
                          <th>Mobile Number</th>
                          <th>Date of Enquiry</th>
                          <th>Status</th>
                                <th>Action</th>
                      </tr>
                </thead>
                <tbody>
                    {% for i in searchenq %}
                <tr>
                  <td>{{ forloop.counter }}</td>
                  <td>{{i.enquirynumber }}
                </td>
                  <td>{{i.fullname}}
                  </td>
                  <td>{{i.mobnum }}
                </td>
               
                  <td>{{i.enquiry_date}}</td>
                  <td>{% if i.status == '' %}
                    <span class="badge badge-danger">Not Answered Yet</span>
                {% elif i.status == 'Answered' %}
                    <span class="badge badge-success">Answered</span>
                
                {% endif %}</td>
                  <td><a href="{% url 'view-enquiry' i.id %}" class="btn btn-success">
                        View Details</a></td>
                </tr>{% endfor %}
                </tbody>
                <tfoot>
                    <tr>
                        <th>S.NO</th>
                  
                       
                          <th>Enquiry Number</th>
                          <th>Full Name</th>
                          <th>Mobile Number</th>
                          <th>Date of Enquiry</th>
                          <th>Status</th>
                                <th>Action</th>
                      </tr>
                </tfoot>
              </table>
              {% else %}
              {% if query %}
                  <p style="font-size: 20px;color: blue;text-align: center;">No records found for: "{{ query }}"</p>
              
              {% endif %}
              {% endif %}
            </div>
          
            <!-- /.card-body -->
          </div>
          
          <!-- /.card -->

          <!-- /.card -->
        </div>
        <!-- /.col -->
      </div>
      <!-- /.row -->
    </div>
    <!-- /.container-fluid -->
  </section>{% endblock %}
  