<?php 
require_once("config/configDB.php"); 
require "userPermission.php";
?>
<!DOCTYPE html>
<html>
<head>
    <title>Expense Master</title>
    <?php require 'header.php' ?>
    

</head>
<body>
    <?php require 'menu.php' ?>
<div class="container-fluid">
<?php if($expenseMaster_Add==1) {  ?>  
    <form class="form-horizontal" action="expenseMasterInsert.php" method="post">
    <div class="form-group">
      <label class="control-label col-sm-2" for="email">Add New Expense</label>
      <div class="col-sm-5">
        <input type="text" class="form-control" placeholder="Enter Customer Name" name="expense"> 
      </div>
      <label class="label-command col-sm-4" for="email">Example : Telephone,Electricity....</label>
    </div>
    <div class="form-group">        
      <div class="col-sm-12 text-center">
        <button type="submit" class="btn btn-default">Submit</button>
      </div>
    </div>
  </form> 
<?php }  ?>  
</div>

<div class="container">

<table id="expenseMaster" class="table table-striped table-bordered dt-responsive nowrap" cellspacing="0" width="100%">
        <thead>
            <tr>
                <th>Expense</th>
                <th>Action</th>
            </tr>
        </thead>
        <tbody>
       
           
        </tbody>
       
    </table>
    
</div>



    <?php require 'footer.php' ?>

    <script>
$(document).ready(function() {
			   var dataTable =  $('#expenseMaster').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: {
                    url: "expensegriddata.php",
                    type: 'POST',
                    data:  {
                        userpermissionEdit   : "<?php echo $expenseMaster_Edit; ?>",
                        userpermissionDelete : "<?php echo $expenseMaster_Delete; ?>"
                }
                
                }

			    } );
} );

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