<?php 
if(isset($_SESSION['msg'])){?>
	<div class="alert alert-info">                
	<h4>Info!</h4>
	<?php echo $_SESSION['msg']; unset($_SESSION['msg']); ?>
</div> 
<?php }?> 
<style>
.table thead th {
    vertical-align: bottom;
    white-space: nowrap;
}
.table tbody td {
    vertical-align: bottom;
    white-space: nowrap;
}
</style>    
    <div class="row-fluid" >
    <div class="span12">    
    	<div class="head clearfix">
        <div class="isw-ok"></div>
        <h1>VIEW STATE HEAD LIST</h1>
     </div>   
   		<div class="block-fluid">
        	<div style="overflow-x:auto;">
        	<table cellpadding="0" cellspacing="0" width="100%" class="table" id="example">
                <thead>
                    <tr>
                        <th>S.No.</th>
                        <th>DRIVER</th>
                       	<th>NAME</th>
                       	<th>FATHER Name</th>
                        <th>DESIGNATION</th>
                        <th>STATE</th>
                        <!--<th>DOB</th>-->
                        <th>AADHAR NO.</th>
                        <th>EDIT</th>
                        <th>DELETE</th>
                    </tr>
                </thead>                 
                <tbody>
					<?php
					$i=1;
					$menu		= mysql_query("SELECT * FROM `tbl_sh_driver` where `status`='1' order by `name` ASC")or die(mysql_error());
                    while($show_menu = mysql_fetch_array($menu)) 
                    {
                        $sqlDriver	   = mysql_query("SELECT * FROM `tbl_emp_driver` where `id`='".$show_menu['driver_id']."'");
                        $sqlDriverData = mysql_fetch_array($sqlDriver);
                    ?>	
                    	<tr>
                        <td><?php echo $i++; ?></td>
                        <td style="text-transform:uppercase;"><?php echo $sqlDriverData['emp_name']." - <strong>".$sqlDriverData['emp_code']?></strong></td>
                        <td><?php echo ucwords($show_menu['name']); ?></td>
                        <td><?php echo ucwords($show_menu['father_name']); ?></td>
                        <td><?php echo ucwords($show_menu['designation']); ?></td>
                        <td><?php echo ucwords($show_menu['state_id']); ?></td>
                        <!--<td><?php if(!empty($show_menu['dob'])){echo date("d-M-Y",strtotime($show_menu['dob']));}?></td>-->
                        <td><?php echo ucwords($show_menu['aadhar_no']); ?></td>
                        <td class="center" style="text-align:center">
                        	<a href="home.php?page=addDriverTeamSH&shId=<?php echo $show_menu['id'];?>"><img src="images/edit_new.png"  border="0" style="width:30px;"/></a>
                        </td>     
                        <td class="center" style="text-align:center">
                        <a onclick="return confirm_delete(<?php echo $i;?>,<?php echo $show_menu['id']; ?>);" href="home.php?page=stateHeadList&SHDelId=<?php echo $show_menu['id'];?>"><img src="images/delete.png" style="width:30px;height:30px;"/></a></td> 
                    </tr>
                    <?php }?>               	                
                </tbody>            
            </table>
            </div> 
        </div>    
   </div>
   </div>
<?php
if(isset($_GET['rspDelId']))
{
	$id      = $_GET['rspDelId'];
	$sql     = mysql_query("update `tbl_emp_driver` SET `status`=1 where id='$id'");
	if($sql)
	{
		$_SESSION['errorMsg'] = '<div class="alert alert-success"><strong>Success!</strong> Employee Deleted Successfully.</div>';
	}
	else
	{
		$_SESSION['errorMsg'] = "error: " . $sql . "<br>" . mysqli_error($conn);	
	}
	header("location:home.php?page=driverTeamList");
}
?>	   
<script>
function confirm_delete(row_num,delete_id)
{
	if (confirm("Delete Account?"))
	{		
	  return true;
	}
	else
	{
		return false;
	}
}  
$(document).ready(function() {
    var table = $('#example').DataTable( {
		"order": [[ 2, "asc" ]],
		"pageLength": 50,stateSave: true,
        fixedHeader: {
            header: true,
            footer: true
        }
    } );
	 table.on( 'order.dt search.dt', function () {
        table.column(0, {search:'applied', order:'applied'}).nodes().each( function (cell, i) {
            cell.innerHTML = i+1;
        } );
    }).draw(); 
});
</script>


   
