<?php include_once('../data/settings');

if(!isset($_SESSION['admin']['role'])){
//	header('location: login?session=accessdenied'); exit(0);
}

include('header.php');

?>
<div class="page-wrapper">
<?php include('nav.php');?>
    
      <div class="page-body-wrapper">
        <?php include('sidebar.php');?>
        
		<div class="page-body">
          <div class="container-fluid">
            <div class="page-header">
              <div class="row">
                <div class="col">
                  <div class="page-header-left">
                    <h3>All Documents</h3>
                  </div>
                </div>
              </div>
            </div>
          </div>
          <!-- Container-fluid starts-->
          <div class="container-fluid">
            <div class="row">
              <!-- Zero Configuration  Starts-->
              <div class="col-sm-12">
                <div class="card">
                  <div class="card-body">
                    <div class="table-responsive">
                      <table class="display" id="basic-1">
                        <thead>
                          <tr>
                            <th>Fullname</th>
                            <th>Email</th>
                            <th>Phone</th>
                            <th>SSN</th>
                            <th>ID Cards</th>
                            <th>Delete</th>
                          </tr>
                        </thead>
                        <tbody>
                          <?php $num = 0;
        $query = "SELECT * FROM documents ORDER by fullname ASC";
        $result = $mysqli->query($query);
        $c= 0;
        while ($row = $result->fetch_array()) {

        
         $c++;
			
			
			$num = $num+1;
		
		
		if($row['status']=='verified'){
				$thestatus = '<span class="btn btn-success btn-xs"><i class="fa fa-check-circle"></i> Verified</span>';
			}elseif($row['status']=='inactive'){
				$thestatus = '<span class="btn btn-danger btn-xs"><i class="fa fa-times"></i> Not Active</span>';
			}elseif($row['status']=='declined'){
				$thestatus = '<span class="btn btn-danger btn-xs"><i class="fa fa-times-circle"></i> Declined</span>';
			}elseif($row['status']=='pending'){
				$thestatus = '<span class="btn btn-warning btn-xs"><i class="fa fa-minus-circle"></i> Pending</span>';
			}
		
            ?><tr>
                            <td><?= ucwords($row['fullname']);?></td>
                            <td><?= $row['email'];?></td>
                            <td><?= $row['phone'];?></td>
                            <td><?= $row['ssn'];?></td>
                            <td>
							<a href="../documents/<?= $row['file_front'];?>" target="_blank" class="btn btn-success btn-xs">View Front</a>
							<a href="../documents/<?= $row['file_back'];?>" target="_blank" class="btn btn-info btn-xs">View Back</a>
							</td>
                            <td><a href="?delete=<?= $row['docid'];?>" onclick="return confirm('Are you sure you want to Delete this Documents? NOTE: This Action cannot be Undo!');"class="btn btn-danger">Delete</a></td>
		</tr><?php }?>
                        </tbody>
                      </table>
                    </div>
                  </div>
                </div>
              </div>
             
			</div>
          </div>
          <!-- Container-fluid Ends-->
        </div>
        <?php include('footer.php');?>