<!-- Main Content -->
<div class="container">
  <div class="row">
    <!-- Widget Item -->
    <div class="col-md-12">
      <div class="widget-area-2 proclinic-box-shadow">
        <h3 class="widget-title">Patients List</h3>
        <div class="row justify-content-center">
          <div class="col-md-10">
            <div class="table-responsive mb-3">
              <table id="tableId" class="table table-bordered table-striped">
                <thead>
                <tr>
                  <th class="no-sort"></th>
                  <th>SNo</th>
                  <th>Patient ID</th>
                  <th>Patient Name</th>
                  <th>Gender</th>
                  <th>Phone</th>
                  <th>#</th>
                </tr>
                </thead>
                <tbody>

                <?php

                $patients = $query->getAll("SELECT * FROM udut_patients WHERE userId = '".$_SESSION['YUZA_ID']."' ");
                $serial_no = 0;
                foreach ($patients as $patient) {
                    //checking patient's last visit
                    $lastVisit = $query->getOne("
                    SELECT * 
                    FROM udut_visits 
                    WHERE patientId = '" . $patient["patientId"] . "' 
                    ORDER BY visitId DESC 
                    LIMIT 1 
                ");

                    //incrementing serial number
                    $serial_no += 1;

                    print("
                  
                    <tr>
                      <td>
                        <div class=\"custom-control custom-checkbox\">
                          <input class=\"custom-control-input\" type=\"checkbox\" id=\"1\">
                          <label class=\"custom-control-label\" for=\"1\"></label>
                        </div>
                      </td>
                      <td>" . $serial_no . "</td>
                      <td>" . $patient["patientUId"] . "</td>
                      <td>" . $patient["patientName"] . "</td>
                      <td>" . $patient["patientGender"] . "</td>
                      <td>" . $patient["patientPhone"] . "</td>
                      <td width=\"210\">
        
                        <nav aria-label=\"Page navigation example\">
                          <ul class=\"pagination pagination-sm justify-content-center export-pagination\" style=\"margin: 0;\">
                            <li class=\"page-item\">
                              <a class=\"page-link\" href=\"edit-patient/" . $patient["patientId"] . "\"><span class=\"ti-file\"></span> Edit</a>
                            </li>
                            <li class=\"page-item\">
                              <a class=\"page-link\" href=\"about-patient/" . $patient["patientId"] . "\"><span class=\"ti-align-justify\"></span> Details</a>
                            </li>
                          </ul>
                        </nav>
        
                      </td>
                    </tr>
                  
                  ");
                }
                ?>

                </tbody>
              </table>
              <!--Export links-->
              <nav aria-label="Page navigation example">
                <ul class="pagination justify-content-center export-pagination">
                  <li class="page-item">
                    <a class="page-link" href="#"><span class="ti-download"></span> csv</a>
                  </li>
                  <li class="page-item">
                    <a class="page-link" href="#"><span class="ti-printer"></span> print</a>
                  </li>
                  <li class="page-item">
                    <a class="page-link" href="#"><span class="ti-file"></span> PDF</a>
                  </li>
                  <li class="page-item">
                    <a class="page-link" href="#"><span class="ti-align-justify"></span> Excel</a>
                  </li>
                </ul>
              </nav>
              <!-- /Export links-->

            </div>
          </div>
        </div>
      </div>
    </div>
    <!-- /Widget Item -->
  </div>
</div>
<!-- /Main Content -->
