<?php  include "header.php"; ?>
<?php if($session_id ==1 || $allPermissions['roles']['read']=="1"){ ?>






<section class="content" >
    
    <div class="row">
		<div class="col-md-12">
			<div class="box box-primary">
			    <div class="box-header">
			        
			        <?php if($session_id==1 || $allPermissions['roles']['create']=="1"){ ?>
                        <a href="auth-role-add.php" class="btn btn-success btn-sm pull-right" contenteditable="false" style="cursor: pointer;"><i class="fa fa-plus-circle"></i> Add New Role</a>
                    <?php } ?>
                    
                        <span class="btn btn-default btn-sm pull-right filter" style="margin-right: 5px;"> Show/Hide Filter</span>
                    <h3 class="box-title"><i class="fa fa-users"></i> Auth - Role List</h3>
                </div>
                
                
                
			    <!-- Filter Starts Here -->
			    <div class="row" id="filter" style="padding: 15px;">
    
                            
    
    <div class="col-md-2">
        <div class="form-group">
            <label class="required" for="status">Status</label>                                   
            <select name="status" class="form-control select2" style="width:100%;" id="status" >
                <option value="1">Active</option>
                <option value="0">In-Active</option>
                <option value="">All Status</option>
            </select>
        </div>
    </div>
    
    
    </div>
			    <!-- Filter Endsss Here -->
			    
			</div>
		</div>
	</div>
	
	
    
    
	
	
	<div class="row">
		<div class="col-md-12">
			<div class="box box-info">
				<div class="box-body table-responsive">
					<table id="DataTables"  class="table table-bordered table-striped">
						<thead>
							<tr>
							    <th>Actions</th>
								<th width="10">S.No</th>
								<th>Role Name</th>
								<th>Status</th>
								<th>Updated By</th>
								<th>Updated At</th>
							</tr>
						</thead>
						
					</table>
				</div>
			</div>
		</div>
	</div>

</section>





<div class="modal fade" id="confirm-delete" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="myModalLabel">Delete Confirmation</h4>
            </div>
            <div class="modal-body">
                <p>Are you sure want to Delete Details?</p>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
                <a class="btn btn-danger btn-ok">Delete</a>
            </div>
        </div>
    </div>
</div>



<?php }else{ ?>
    <?=$page_not_access?>
<?php } ?>
<?php require_once('footer.php'); ?>


<script>
    $(document).ready(function(){
        $('#filter').hide();
        $('.filter').click(function(){
            $("#filter").slideToggle();
            return false;
        });
    });
</script>

<script type="text/javascript">
	$(document).ready(function() {
		get_data();	    
	});
			
			
function get_data(){
    var status = $('#status').val();
    var dataTable = $('#DataTables').DataTable( {
					"processing": true,
					"serverSide": true,
					"ajax":{
						url :"data-tables/role-data-table.php", 
						data: {status:status},
						type: "post",  
						error: function(){
							$(".datatable-error").html("");
							$("#DataTables").append('<tbody class="datatable-error"><tr><th colspan="3">No Data Found in the Server</th></tr></tbody>');
							$("#DataTables_processing").css("display","none");
							
						}
					}
				});
}
</script>