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

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>Quixlab - Bootstrap Admin Dashboard Template by Themefisher.com</title>
    <!-- Favicon icon -->
    <link rel="icon" type="image/png" sizes="16x16" href="images/favicon.png">
    <!-- Custom Stylesheet -->
    <link href="./plugins/tables/css/datatable/dataTables.bootstrap4.min.css" rel="stylesheet">
    <link href="css/style.css" rel="stylesheet">

</head>

<body>

    <!--*******************
        Preloader start
    ********************-->
    <div id="preloader">
        <div class="loader">
            <svg class="circular" viewBox="25 25 50 50">
                <circle class="path" cx="50" cy="50" r="20" fill="none" stroke-width="3" stroke-miterlimit="10" />
            </svg>
        </div>
    </div>
    <!--*******************
        Preloader end
    ********************-->

    
    <!--**********************************
        Main wrapper start
    ***********************************-->
    <div id="main-wrapper">

        <!--**********************************
            Nav header start
        ***********************************-->
        <div class="nav-header">
            <div class="brand-logo">
                <a href="index.html">
                    <b class="logo-abbr"><img src="images/logo.png" alt=""> </b>
                    <span class="logo-compact"><img src="./images/logo-compact.png" alt=""></span>
                    <span class="brand-title">
                        <img src="images/logo-text.png" alt="">
                    </span>
                </a>
            </div>
        </div>
        <!--**********************************
            Nav header end
        ***********************************-->

        <!--**********************************
            Header start
        ***********************************-->
        <div class="header">    
            <div class="header-content clearfix">
                
                <div class="nav-control">
                    <div class="hamburger">
                        <span class="toggle-icon"><i class="icon-menu"></i></span>
                    </div>
                </div>
                <div class="header-left">
                    <div class="input-group icons">
                        <div class="input-group-prepend">
                            <span class="input-group-text bg-transparent border-0 pr-2 pr-sm-3" id="basic-addon1"><i class="mdi mdi-magnify"></i></span>
                        </div>
                        <input type="search" class="form-control" placeholder="Search Dashboard" aria-label="Search Dashboard">
                        <div class="drop-down   d-md-none">
							<form action="#">
								<input type="text" class="form-control" placeholder="Search">
							</form>
                        </div>
                    </div>
                </div>
                <div class="header-right">
                    
                </div>
            </div>
        </div>
        <!--**********************************
            Header end ti-comment-alt
        ***********************************-->

        <!--**********************************
            Sidebar start
        ***********************************-->
        <div class="nk-sidebar">           
            <div class="nk-nav-scroll">
               
            </div>
        </div>
        <!--**********************************
            Sidebar end
        ***********************************-->

        <!--**********************************
            Content body start
        ***********************************-->
        <div class="content-body">

            <div class="row page-titles mx-0">
                <div class="col p-md-0">
                    <ol class="breadcrumb">
                        <li class="breadcrumb-item"><a href="javascript:void(0)">Dashboard</a></li>
                        <li class="breadcrumb-item active"><a href="javascript:void(0)">Home</a></li>
                    </ol>
                </div>
            </div>
            <!-- row -->

            <div class="container-fluid">
                <div class="row">
                    <div class="col-12">
                        <div class="card">
                            <div class="card-body">
                                <h4 class="card-title">Data Table</h4>
                                <div class="table-responsive">
                                    <table class="table table-striped table-bordered zero-configuration">
                                       <div class="container-fluid">
                <div class="row">
                    <div class="col-12">
                        <div class="card card-sm">
                            <div class="card-body">
                                <h4 class="card-title">Inventory</h4>
                                <div class="table-responsive">
                                    <table class="table  table-bordered zero-configuration table-sm">
                                        <thead>
                                            <tr>
                                                <th>Name</th>
                                                <th>Available</th>
                                                <th>Price</th>
                                                <th>Quantity</th>
                                                <th>Action</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            
                                                <?php
include 'database/shikanisha.kts.php';
                                                  $sql = "select * from products";
                                                  $result=mysqli_query($conn,$sql);
                                                   while($row=mysqli_fetch_array($result)){
                                                ?>
                                                <tr>
                                                    <form method="POST" action="orders.php"> 
                                                    <td><?php echo $row['product_name'] ; ?></td>
                                                    <td><?php echo $row['shop_quantity']; ?></td>
                                                    <td><?php echo $row['selling_price']; ?></td>
                                                     <input type="hidden" name="name" value="<?php echo $row['product_name'];?>" />
												     <input type="hidden" name="id" value="<?php echo $row['product_id'];?>" />
                                                    <input type="hidden" name="price" value="<?php echo $row['selling_price'];?>" class="form-control-sm" />
                                                    <td> <input type="number" class="form-control-sm" id="val-username" name="qty" placeholder="Enter qty needed.." step="any">
                                                    </td>
                                                     <td><button class="btn btn-success bg-success fa fa-shopping-cart btn-sm" type="submit" name="add" value="<?php $row['product_id']; ?>">Order</button></td>
                                                    </form>
                                                </tr>
                                            <?php } ?>
                                           
                                        </tbody>
                                        <tfoot>
                                             <tr>
                                                <th>Name</th>
                                                <th>Available</th>
                                                <th>Price</th>
                                                <th>Quantity</th>
                                                <th>Action</th>
                                            </tr>
                                        </tfoot>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                
                
                <div class="row">
                    <div class="col-lg-12">
                        <div class="card">
                            <div class="card-body">
                                <h4 class="card-title">Orders</h4>
                                <div class="active-member">
                                    <div class="table-responsive">
                                        <table id="bootstrap-data-table-export" class="table table-striped zero-cofiguration table-bordered">
                                            <thead>
                                                <tr>
                                                    <th>ID</th>
                                                    <th>Seller Name</th>
                                                    <th>Total</th>
                                                    <th>Date</th>
                                                    <th>Action</th>
                                                    <th>Update</th>
                                                </tr>
                                            </thead>
                                             <tbody>
                                              <?php
        
                                                   $sql = "SELECT * FROM orders WHERE seller_name='{$_SESSION['user']}'";
                                                    $result=mysqli_query($conn,$sql);
                                                     while($row=mysqli_fetch_array($result)){
                                                  ?>
                                                <tr>
                                                    <td><?php echo $row['order_id']; ?></td>
                                                    <td>
                                                      <?php echo $row['seller_name']; ?>
                                                    </td>
                                                    <td>
                                                        <?php echo $row['total_amount']; ?>
                                                    </td>
                                                    
                                                    <td>
                                                       <?php echo $row['order_date']; ?>
                                                    </td>
                                                    <td>
																			
             										<i class="fa fa-eye view-order-details" data-id="<?php echo $row['order_id'];?>"></i>

              										</td>
                                                  <td>
                                                    <form action="database/ordertosales.kts.php" method="post">
                                                    <input type="hidden" value="<?php echo $row['order_id'] ?>" name="order_id">
                                                    <button type="submit" class="btn btn-danger">Close Bill</button></form></td> <td>
                                                    <form action="database/updateorder.kts.php" method="post">
                                                    <input type="hidden" value="<?php echo $row['order_id'] ?>" name="order_id">
                                                    <button type="submit" class="btn btn-warning">Update Bill</button></form></td>
                                                </tr>
                                               <?php } ?>
                                               
                                            </tbody>
                                        </table>
                                    </div>
                                </div>
                            </div>
                        </div>                        
                    </div>
                </div>
                
                
                
                <!-- Transaction Modal -->
                                     <div class="modal fade bd-example-modal-sm" id="transaction"  role="dialog"  tabindex="-1" role="dialog" aria-hidden="true">
                                                
                                        <div class="modal-dialog modal-sm" >
                                                     
                                            <div class="modal-content">
                                               <form method="post" action="./database/orders.kts.php">
                                                <div class="modal-header">
                                               
                                                    <h5 class="modal-title">Table Details</h5>
                                                    <button type="button" class="close" data-dismiss="modal"><span>&times;</span>
                                                    </button>
                                                    
                                                </div>
                                               
                                                <div class="modal-header">
                                                <h4 class="modal-title" name="amount_to_pay" id="amounttopay" value="<?php echo $total; ?>">Total Amount: <?php echo $total; ?></h4>

                                                </div>
                                                <div class="modal-body">
                                                  <div class="table-responsive">
                                                        <table class="table header-border table-hover verticle-middle">
                                                                <thead>
                                                                
                                                                        
                                                                      <tr>
                                                                        <td colspan="3"></td>
                                                                            <th> Table Name</th>
                                                                            <td>
                                                                                <input type="text" class="form-control" name="client_name" onkeyup="searchClients(this.value)">
                                                                                <div id="clientsDropdown"></div>
                                                                            </td>
                                                                        </tr>
                                                                        <tr>
                                                                            <td colspan="3"></td>
                                                                            <th> Table Id</th>
                                                                            <td><input type="text" class="form-control" name="phone_number" id="phone_number"></td>
                                                                        </tr>
                                                                        
                                                                       <input type="hidden" name="cash" id ="cash" value="'.$total.'">
                                                                       <input type="hidden" name="total" id ="total"  value="<?php echo $total; ?>" >
                                                               
                                                
                                                                </thead>
                                                               
                                                           </table>
                                                               </div>
                                                              
                                                   
                                                </div>
                                                
                                                <div class="modal-footer">
                                                
                                                    <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                                                    
                                                   <button type="submit" name="transact" class="btn btn-primary">Submit</button>
                                                </div>
                                                </form>
                                         
                    </div>
                 </div>
              </div>
                
                <!-- end of transaction modal -->
                
                    <!-- Add Stock Modal -->
               <div class="modal fade" id="viewOrderDetailsModal">
                  <div class="modal-dialog" role="document">
                        <div class="modal-content">
                          <div class="modal-header">
                            <h5 class="modal-title" id="viewOrderDetailsModalLabel">Order Details</h5>
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                              <span aria-hidden="true">&times;</span>
                            </button>
                          </div>
                          <div class="modal-body">
                            <div class="row">
                              <div class="col-md-12">
                                <table class="table table-bordered">
                                  <thead>
                                    <tr>
                                      <th>Name</th>
                                      <th>Price</th>
                                      <th>Quantity</th>
                                      <th>Subtotal</th>
                                     
                                     
                                    </tr>
                                  </thead>
                                  <tbody id="orderDetailsTableBody">

                                  </tbody>
                                  <tfoot id="ordertotals">

                                  </tfoot>
                                </table>
                              </div>
                            </div>
                          </div>
                                <div class="modal-footer">
                                  <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                                </div>
                        </div>
                      </div>
                    </div>
               <!-- End Of aAdd Poduct Modal  -->
           

            </div>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <!-- #/ container -->
        </div>
        <!--**********************************
            Content body end
        ***********************************-->
        
        
        <!--**********************************
            Footer start
        ***********************************-->
        <div class="footer">
            
        </div>
        <!--**********************************
            Footer end
        ***********************************-->
    </div>
    <!--**********************************
        Main wrapper end
    ***********************************-->

    <!--**********************************
        Scripts
    ***********************************-->
    <script src="plugins/common/common.min.js"></script>
    <script src="js/custom.min.js"></script>
    <script src="js/settings.js"></script>
    <script src="js/gleek.js"></script>
    <script src="js/styleSwitcher.js"></script>

    <script src="./plugins/tables/js/jquery.dataTables.min.js"></script>
    <script src="./plugins/tables/js/datatable/dataTables.bootstrap4.min.js"></script>
    <script src="./plugins/tables/js/datatable-init/datatable-basic.min.js"></script>

</body>

</html>