<?php
session_start();
require_once 'includes/config.php';

if (!isset($_SESSION['user_logged_in']) && $_SESSION['user_logged_in'] != TRUE) {
    header('Location:login.php');
}

$customers=mysqli_query($con,'SELECT * FROM users WHERE status=1 AND role=3   ORDER BY id DESC');


require_once 'includes/header.php';
?>
<div class="content">
        <div class="container-fluid">
          <div class="row">
            <div class="col-md-12">
			<!--<a href="add_compliant.php" class="btn btn-primary btn-round">Add New Compliants<div class="ripple-container"></div></a>-->
              <div class="card">
                <div class="card-header card-header-primary">
                  <h4 class="card-title ">優惠券詳情  -Voucher Details</h4>
                  <p class="card-category"> </p>
                </div>
                <div class="card-body">
                  <div class="table-responsive">
                    <table class="table">
                      <thead class=" text-primary">
                        <th>UID</th>  
		  <th>名稱  <br>
Name</th> 
		  <th>每日優惠券  <br>
Daily Voucher</th> 
		  <th>可用優惠券<br>
Available Vouchers</th> 
		 
		  
		  <th>狀態  <br>
Status</th>
		  <th>Date</th>
                      </thead>
                      <tbody>
                        <?php
		if(mysqli_num_rows($customers)>0){	
		$i=1;
		while($customer=mysqli_fetch_array($customers)){?>
		<tr>
		
		<td><?php  echo $customer['phone'];?></td>
		<td><?php echo $customer['first_name'];?></td>
		<td><?php echo $customer['vouchers'];?></td>
		<td><?php echo $customer['vouchers'];?></td>
		<td></td>
		
		<td>
		<?php echo $customer['created_at'];?>
		</td>
		</tr>	
		<?php $i++;}
		}
		?>   
                      </tbody>
                    </table>
                  </div>
                </div>
              </div>
            </div>
            
          </div>
        </div>
      </div>

<?php include_once 'includes/footer.php'; ?>

<script type="text/javascript">
    $(document).ready(function () {
        $('.delete_btn').click(function () {
            var r = confirm("Are you sure?")
            if (r == true) {
                return true;
            } else {
                return false;
            }
        });
    });
</script> 