<?php 
require_once("config/configDB.php"); 
//session_start();
require "userPermission.php";
require 'financial_year_calculation.php';

$sql_employee = mysqli_query($conn,"SELECT id,ename FROM employee_master WHERE isdelete='1' order by ename ASC ");
$row_employee = '';
?>
<!DOCTYPE html>
<html>
<head>
    <?php 
        require 'meta.php';  
        require 'header.php'; 
    ?>
</head>
<body>
    <?php require 'menu.php' ?>
<div class="container-fluid">
    <form class="form-horizontal" action="usersMasterInsert.php" method="post">
    
    <div class="form-group">
        <label class="control-label col-sm-2" for="email">Emp.Name</label>
        <div class="col-sm-5">
        <select class="form-control input-lg customerName-select" name="employeename" required>
        <option value="">Please Select the Employee </option>
        <?php
        while($row4 = mysqli_fetch_array($sql_employee)){
        ?>
        <option value="<?php echo $row4['ename'] ?>" > <?php echo $row4['ename']; ?> </option>
        <?php
        //echo "<option value='".$row['id']."'>".$row['cname']."</option>";
        }
        ?>
        </select>
        </div>
    </div>
    
    <div class="form-group">
      <label class="control-label col-sm-2" for="email">Add New User</label>
      <div class="col-sm-5">
        <input type="text" class="form-control input-lg" placeholder="Enter User Name" name="username"> 
      </div>
      <div class="col-sm-1 text-center">
        <button type="submit" class="btn btn-default btn-lg">Submit</button>
      </div>
     
    </div>
  </form>   
</div>

<div class="container col-sm-12 ">
    <div class="datatable-header ">
        <div class="col-sm-12 box-title"><strong>Manage your brand master</strong></div>
        <table id="userpermissionMasterDashboard" class="table table-striped table-bordered dt-responsive nowrap" cellspacing="0" style="width:100%" >
            <thead>
                <tr>				
                    <th>UserName</th>
                    <th>Password</th>
                    <th>Permission</th>
                    <th>Action</th>
                </tr>
            </thead>
            <tbody></tbody>
           
        </table>
    </div>

</div>


    <?php require 'footer.php' ?>

    <script>
$(document).ready(function() {
			   var dataTable =  $('#userpermissionMasterDashboard').DataTable( {
			   	    responsive: {
					details: {
					    renderer: function ( api, rowIdx ) {
						var data = api.cells( rowIdx, ':hidden' ).eq(0).map( function ( cell ) {
						    var header = $( api.column( cell.column ).header() );
						    return  '<p style="color:#00A">'+header.text()+' : '+api.cell( cell ).data()+'</p>';
						} ).toArray().join('');
 
						return data ?    $('<table/>').append( data ) :    false;
					    }
					}
				    },
			   	processing: true,
				serverSide: true,
				//ajax: "test.js", // json datasource
				ajax: "usersMastergriddata.php",
			    } );
} );

</script>
</body>
</html>