<?php
session_start();
include "includes/database.php";

$username=$_SESSION["username"];
$dataPengguna=mysqli_query($con,"SELECT * from tbl_shop where shop_username='$username'");
$showDataPengguna=mysqli_fetch_array($dataPengguna);

?>

<!-- DELETE BOOKING -->
<?php 
if(isset($_GET["delete"]))
{
  $del=$_GET["delete"];
  mysqli_query($con, "delete from tbl_booking where booking_id='$del'");
}

?>
<!DOCTYPE html>
<html lang="en">


  <head>
<script type="text/javascript">
  function buang(nama)
{
r=confirm("Delete Booking?");

if(r=true)
{
alert ('Booking Deleted')
window.location = "bookingstatus.php?delete="+nama;
}


}
</script>



    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>FIX-IT-ALL</title>

    <!-- Bootstrap core CSS -->
    <link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">

    <!-- Custom styles for this template -->
    <link href="css/heroic-features.css" rel="stylesheet">

    <!-- Page Content -->
    <div class="container">
  <link rel="stylesheet" type="text/css" href="styleall.css">

  </head>

  <body>

    <!-- Navigation -->
    <!-- w3school -->
    <style>
ul {
  list-style-type: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: url(images/pinkk.png);
}

li {
  float: left;
}

li a {
  display: block;
  font-family: verdana;
  color: white;
  text-align: center;
  padding: 14px 16px;
  text-decoration: none;
}

li a:hover {
  background-color: #fff2e6;
}
</style>

<body>

<ul>
     <li><a class="active" href="main2.php">Home</a></li>
  <li><a href="about2.php">About</a></li>
  <li><a href="bookingstatus.php">Booking Status</a></li>
  <li><a href="feedback2.php">Feedback</a></li>
  <li><a href="logout.php">Logout</a></li>
        
</ul>
<br>

    </nav>
                          
                          
</div>
<!-- /.panel-heading -->
<div class="panel-body">
<div class="table-responsive">
<table class="table">
<thead align="center">
<tr>
<th>NO.</th>
<th>NAME</th>
<th>DATE</th>
<th>TIME</th>
<th>STATUS</th>
<th>ACTION</th>
<th>DELETE</th>
</tr>
</thead>
                                   
                                   
                                   
<?php
$dataSubjects=mysqli_query($con,"SELECT * from tbl_booking where shop_id='$showDataPengguna[shop_id]'");
$bil_subjects=mysqli_num_rows($dataSubjects);

?>                              
                                   
<tbody>

<?php
if ($bil_subjects==0)
{
?>
<tr>
<td colspan="5">No record found!</td>

</tr>
<?php
}
else
{

$numbers=1;
while ($showSubjects=mysqli_fetch_array($dataSubjects))
    {

?>


<tr align="center">
<td><?php echo $numbers++;?></td>
<td><?php echo $showSubjects['user_id'];?></td>
<td><?php echo $showSubjects['booking_date'];?></td>
<td><?php echo $showSubjects['booking_time'];?></td>
<td><?php echo $showSubjects['booking_status'];?></td>
<td><a href="bookingstatus_view.php?id=<?php echo $showSubjects['booking_id'];?>"<i class="fa fa-edit"> View</a></td>
<td><p style="cursor:pointer"><a class".btn.btn-app" onclick="javascript:buang(<?php echo $showSubjects['booking_id'];?>)"<i class="fa fa-eraser"></i>Delete</a></td>

</tr>

<?php
}
}
?>
                                       
</tbody>
</table>         
</div>

   
    <br>
    <br>
    
    <!-- Footer -->
    <footer class="py-4 bg-dark">
      <div class="container" align="center">
        <p class="m-0 text-center text-white">Copyright &copy;Fix-It-All 2018</p>
      </div>
      <!-- /.container -->
    </footer>

    <!-- Bootstrap core JavaScript -->
    <script src="vendor/jquery/jquery.min.js"></script>
    <script src="vendor/bootstrap/js/bootstrap.bundle.min.js"></script>

  </body>

</html>

