<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="datatable/data.css">
<script src="datatable/data.js" type="text/javascript"></script>
<script src="datatable/table.js" type="text/javascript"></script>
<script src="datatable/datatable.js"></script>
<link rel="stylesheet" href="datatable/data-boot.css">
<link href="javascript/select2.css" rel="stylesheet" >
<script src="javascript/selectt2.js"></script>
<style>
    
    #navbar
    {
        flex:15%;
        height:100%; 
        flex-direction:row;
        overflow:auto;
        
    }
    #content
    {
        flex:90%;
        overflow:auto;
        padding-left:10px;
        padding-right:10px;
    }
    #fullbody
    {
        display:flex;
        
         height:100%;         
    }
    label
    {
      font-size:20px;
    }
    .edit
    {
        font-size:18px;
        color:green;
        cursor:pointer;
    }
    .dele
    {
        font-size:18px;
        color:red;
        cursor:pointer;
    }
    .edit:hover
    {
        font-size:20px;
        
    }
    .dele:hover
    {
        font-size:20px;
        color:red;
        cursor:pointer;
        
    }
    td
    {
      text-align:center;
    }
    th
    {
      text-align:center;
    }
    li a 
    {
      color:black;
    }
    .page-item.active .page-link {
    
    background-color:yellow;
    border-color: #007bff;
}
    @media (max-width: 800px) {
        #fullbody
    {
        display:flex;
        flex-wrap: wrap;
                 
    }
        #navbar,#content {
    flex: 100%;
  }
}
</style>
<script>
$(document).ready( function () {
    $('#protable').DataTable();
} );
</script>

</head>
<body>
    <div ><?php include "navbar.php"?></div>
    <div id="fullbody"> 

<div id="content">
<br>
<h3>Userpermission</h3>
<br>
<!-- table -->
<!-- table -->
<!-- modal for add confirm -->
<input type="button" class="btn btn-success"data-toggle="modal"  data-target="#userPermissionEnter" value="+Add Permission"style="float:right" >
<div class="modal" id="userPermissionEnter">
    <div class="modal-dialog modal-sm">
      <div class="modal-content ">
      
        <!-- Modal Header -->
       
        
        <!-- Modal body -->
        <form action="insert_userpermission.php" method="post">
        <div class="modal-body ">
         <input type="text" class="form-control" placeholder="Permission" name="filename" required>
              <?php 
$cus=mysqli_query($connect,"select * from employeedetails where status !='deleted'");
while($cusshow = mysqli_fetch_array($cus))
{
?>
<input type="hidden" name="employeename[]" value="<?php echo $cusshow['employeename'] ?>">
<input type="hidden" name="employeecode[]" value="<?php echo $cusshow['employeecode'] ?>">
<input type="hidden" name="username[]" value="<?php echo $cusshow['username'] ?>">
        <?php }?>          
  
              </select>
</div>
        
        
        <!-- Modal footer -->
        <div class="modal-footer">
          <input type="submit" class="btn  btn-primary" value="Ok">
        </div>
</form>
      </div>
    </div>
  </div>
        <!-- modal to display price -->
<div>
<table class="table table-bordered table-hover " style="border:1px solid lightgrey" id="protable">
    <thead >
<tr>
  <!-- <th>S.no</th> -->
    <th>Code</th>
    <th>Name</th>
    <th>Employee-Type</th>
    <th>Status</th>
    <th>Permission</th>
    <!-- <th>Delete</th> -->
</tr>

    </thead>
    <tbody>
<?php 
$pro=mysqli_query($connect,"select * from employeedetails where status !='deleted'  order by id desc");
while($proshow = mysqli_fetch_array($pro))
{
?>
        <tr>
          
            <!-- <td><?php echo $proshow['id'] ?></td> -->
            <td><?php echo $proshow['employeecode'] ?></td>
            <td><?php echo $proshow['employeename'] ?></td>
            <td><?php echo $proshow['usertype'] ?></td>
            <td><?php if($proshow['statuslive'] == 1){echo 'Active';}else{echo 'Deleted';} ?></td>
            
            <td><a href="userpermissionedit.php?code=<?php echo $proshow['employeecode']?>"><i class="fas fa-edit edit"></i></a></td>
            <!-- <td><a data-toggle="modal" data-target="#delete<?php echo $proshow['employeecode']?>"><i  class="fas fa-trash-alt dele"></a></i></td> -->
        </tr>
        <?php
      } 
      
      ?>
    </tbody>



</table>
</div>
<!-- modal -->

<!-- table -->
</div>
<script>
    $('.selectpro').select2({ width: '100%',height:'420px;' });
    
</script>
</body>
</html>