<?php
include('security.php');

include('includes/header.php');
include('includes/navbar.php');
?>


<div class="modal fade" id="addadminprofile" tabindex="-1" role="dialog" aia-labelledby="exampleModallabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title" id="exampleModalLabel">Add Admin Data</h5>
                <Button type="button" class="close" data-dismiss="modal" aria-label="close">
                    <span aria-hidden="true">&times;</span>
                </Button>
            </div>
            <form action="code.php" method="POST">
                
                <div class="modal-body">
                    
                    <div class="form-group">
                        <label>Username</label>
                        <input type="text" name="username" class="form-control" placeholder="Enter Username">
                    </div>
                <div class="form-group">
                        <label>Email</label>
                        <input type="text" name="email" class="form-control" placeholder="Enter Email">
                    </div>
                <div class="form-group">
                        <label>Password</label>
                        <input type="text" name="password" class="form-control" placeholder="Enter Password">
                    </div>
                <div class="form-group">
                        <label>Confrim Password</label>
                        <input type="text" name="confirmpassword" class="form-control" placeholder="Enter Password">
                    </div>
                    
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                    <button type="submit" name="registerbtn" class="btn btn-primary">Save</button>
                </div>
            </form>
            
        </div>
    </div>
</div>


<div class="container-fluid">

<!-- DataTales Example -->
<div class="card shadow mb-4">
    <div class="card-header py-3">
        <h6 class="m-0 font-weight-bold text-primary">Admin Profile
            <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addadminprofile">
            Add Admin Profile
            </button>
    </h6>
    </div>
    
    
    
    
    
    

<div class="modal fade" id="profile" tabindex="-1" role="dialog" aia-labelledby="exampleModallabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title" id="exampleModalLabel">Add Admin Data</h5>
                <Button type="button" class="close" data-dismiss="modal" aria-label="close">
                    <span aria-hidden="true">&times;</span>
                </Button>
            </div>
            <form action="code.php" method="POST">
                
                <div class="modal-body">
                    
                    <div class="form-group">
                        <label>Package Type</label>
                        <input type="text" name="Package" class="form-control" placeholder="">
                    </div>
                <div class="form-group">
                        <label>Origin Service Area</label>
                        <input type="text" name="der" class="form-control" placeholder="">
                    </div>
                <div class="form-group">
                        <label>Destination Service Area</label>
                        <input type="text" name="sarea" class="form-control" placeholder="">
                    </div>
                <div class="form-group">
                        <label>Quantity Of Product</label>
                        <input type="text" name="quality" class="form-control" placeholder="">
                    </div>
                <div class="form-group">
                        <label>Weight of Product</label>
                        <input type="text" name="weigh" class="form-control" placeholder="">
                    </div>
                <div class="form-group">
                        <label>Item Type</label>
                        <input type="text" name="itype" class="form-control" placeholder="">
                    </div>
                <div class="form-group">
                        <label>Mode Of Transportation</label>
                        <input type="text" name="mode" class="form-control" placeholder="">
                    </div>   
                </div>
                       <div class="form-group">
                        <label>Cognsignment</label>
                        <input type="text" name="Cognsignment" value="SL<?php echo rand(8,100000000); ?>" class="form-control" placeholder="">
                    </div>
                    
                <div class="form-group">
                        <label>Estimated Time Of Arrival</label>
                        <input type="text" name="time" class="form-control" placeholder="">
                    </div>
                <div class="form-group">
                        <label>Receiver Name</label>
                        <input type="text" name="name" class="form-control" placeholder="">
                    </div>
                       <div class="form-group">
                        <label>Receiver Address</label>
                        <input type="text" name="address" class="form-control" placeholder="">
                    </div>
                <div class="form-group">
                        <label>Receiver Email</label>
                        <input type="text" name="email" class="form-control" placeholder="">
                    </div>
                <div class="form-group">
                        <label>Receiver Phone Number</label>
                        <input type="text" name="phone" class="form-control" placeholder="">
                    </div>
                       <div class="form-group">
                        <label>Sender Name</label>
                        <input type="text" name="ame" class="form-control" placeholder="">
                    </div>
                       <div class="form-group">
                        <label>Sender Address</label>
                        <input type="text" name="saddress" class="form-control" placeholder="">
                    </div>
                <div class="form-group">
                        <label>Sender Phone Number</label>
                        <input type="text" name="sphone" class="form-control" placeholder="">
                    </div>
                <div class="form-group">
                        <label> Sender Email </label>
                        <input type="text" name="mail" class="form-control" placeholder="">
                    </div>
                      <br>
                       <div class="form-group">
                        <select class="form-control"
                         name="status" valu=""> <option value="">Status</option>
                                                <option value="Under Custom Review">Under Custom Review</option>
                                                <option value="Waiting Shipment">Waiting Shipment</option>
                                                <option value="Order Shipped">Order Shipped</option>
                                                <option value="Item Accepted">Item Accepted</option>
                                                <option value="Consignment Arrival">Consignment Arrival</option>
                                                <option value="Under Facility Review">Under Facility Review</option>
                                                <option value="Consignment Departed ">Consignment Departed</option>
                                                <option value="Consignment Arrived">Consignment Arrived</option>
                                                <option value="Avaliable For Pickup">Avaliable For Pickup</option>
                                                <option value="Cancelled">Cancelled</option>
                                                <option value="Delivered">Delivered</option>
                           </select>
                    </div>
                      <br>
                       <div class="form-group">
                        <label>Message</label>
                        <input type="text" name="Message" class="form-control" placeholder="">
                    </div>
                <div class="form-group">
                        <label>In Transit At:</label>
                        <input type="text" name="transit" class="form-control" placeholder="">
                    </div>
                    
                
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                    <button type="submit" name="item" class="btn btn-primary">Save</button>
                </div>
            </form>
            
        </div>
    </div>
</div>

<div class="container-fluid">

<!-- DataTales Example -->
<div class="card shadow mb-4">
    <div class="card-header py-3">
        <h6 class="m-0 font-weight-bold text-primary">ADD ITEMS
            <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#profile">
            Add items
            </button>
    
    <div class="card-body">
        
        <?php
        if(isset($_SESSION['success']) && $_SESSION['success'] !='')
        {
            echo '<h2 class="bg-primary text-white"> '.$_SESSION['success'].'</h2>';
            unset($_SESSION['success']);
        }
        
        if(isset($_SESSION['status']) && $_SESSION['status'] !='')
        {
            echo '<h2 class="bg-danger text-white"> '.$_SESSION['status'].'</h2>';
            unset($_SESSION['status']);
        }
        ?>
        
      
          
        <div class="table-responsive">
          
            <?php
                $connection = mysqli_connect("localhost","root","","mudidelivery");
            
                $query = "SELECT * FROM users";
                $query_run = mysqli_query($connection, $query);
                
            ?>
            <table class="table table-bordered" id="dataTable" width="100%" cellspacing="0">
                <thead>
                    <tr>
                        <th>id</th>
                        <th>Package Type</th>
                        <th>Origin Service Area</th>
                        <th>Destination Service Area</th>
                        <th>Quantity Of Product</th>
                        <th>Weight of Product</th>
                        <th>Item Type</th>
                        <th>Mode Of Transportation</th>
                        <th>Cognsignment</th>
                        <th>Estimated Time Of Arrival</th>
                        <th>Receiver Name</th>
                        <th>Receiver Address</th>
                        <th>Receiver Email</th>
                        <th>Receiver Phone Number</th>
                        <th>Sender Name</th>
                        <th>Sender Address</th>
                        <th>Sender Phone Number</th>
                        <th>Sender Email</th>
                        <th>Status</th>
                        <th>Message</th>
                        <th>In Transit At</th>
                        
                        
                        <th>EDIT</th>
                        
                        
                        
                        <th>DELETE</th>
                    </tr>
                </thead>
                <tbody>
                    <?php
                    if(mysqli_num_rows($query_run) > 0)
                    {
                        while($row = mysqli_fetch_assoc($query_run))
                        {
                           ?>
                    <tr>
                        <td><?php echo $row['id'] ?></td>
                        <td><?php echo $row['Package'] ?></td>
                        <td><?php echo $row['der'] ?></td>
                        <td><?php echo $row['sarea'] ?></td>
                        <td><?php echo $row['quality'] ?></td>
                        <td><?php echo $row['weigh'] ?></td>
                        <td><?php echo $row['itype'] ?></td>
                        <td><?php echo $row['mode'] ?></td>
                        <td><?php echo $row['Cognsignment'] ?></td>
                        <td><?php echo $row['time'] ?></td>
                        <td><?php echo $row['name'] ?></td>
                        <td><?php echo $row['address'] ?></td>
                        <td><?php echo $row['email'] ?></td>
                        <td><?php echo $row['phone'] ?></td>
                        <td><?php echo $row['ame'] ?></td>
                        <td><?php echo $row['saddress'] ?></td>
                        <td><?php echo $row['sphone'] ?></td>
                        <td><?php echo $row['mail'] ?></td>
                        <td><?php echo $row['status'] ?></td>
                        <td><?php echo $row['Message'] ?></td>
                        <td><?php echo $row['transit'] ?></td>
                        
                        
                       <td>
                            <form action="register_edit.php" method="post">
                                <input type="hidden" name="edit_id" value="<?php echo $row['id'] ?>">
                           <button type="submit" name="edit_btn"class="btn btn-success"> EDIT</button>
                            </form>
                    </td>
                           
                        
                           
                    <td>
                            <form action="code.php" method="post">
                            <input type="hidden" name="delete_id" value="<?php echo $row['id']; ?>">
                            <button type="submit" name="delete_btn" class="btn btn-danger"> DELETE</button> 
                        </form>
                    </td>
                    </tr>
                    <?php
                        }
                        
                    }
                    else{
                        echo "NO RECORD FOUND";
                    }
                    ?>    
                </tbody>
            </table>
            
        </div>
    </div>
</div>

</div>
<!-- /.container-fiuld -->

<?php
include('includes/scripts.php');
include('includes/footer.php');
?>