<?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 RSP 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>Emp Code</th>
                       	<th>Emp Name</th>
                       	<th>Fat. Name</th>
                        <th>Designation</th>
                        <th>State</th>
                        <!--<th>DOB</th>-->
                        <th>Aadhar No.</th>
                        <th>A/c No.</th>
                        <th>IFSC Code</th>
                        <th>Payment Status</th>
                        <th>UAN Status</th>
                        <th>Modify</th>
                        <th>Delete</th>
                    </tr>
                </thead>                 
                <tbody>
					<?php
					$i=1;
					$menu		= mysql_query("SELECT * FROM `tbl_emp_rsp` where `status`='0' order by `emp_name` asc ")or die(mysql_error());
                    while($show_menu = mysql_fetch_array($menu)) 
                    {
						$a			 = "<img height='20' width='20' src='images/right.png'/>";
						$b			 = "<img height='20' width='20' src='images/wrong.png'/>";
						$payment_status	 = $b;
						if($show_menu['payment_status']=='Complete')
						{
							$payment_status	= $a;
						}
						$uan_status	 = $b;
						if($show_menu['uan_status']=='Done')
						{
							$uan_status	= $a;
						}
						
                    ?>	
                    	<tr>
                        <td><?php echo $i++; ?></td>
                        <td ><?php echo ucwords($show_menu['emp_code']); ?></td>
                        <td><?php echo ucwords($show_menu['emp_name']); ?></td>
                        <td><?php echo ucwords($show_menu['fname']); ?></td>
                        <td><?php echo ucwords($show_menu['desiganation']); ?></td>
                        <td><?php echo ucwords($show_menu['state']); ?></td>
                        <!--<td><?php echo date("d-M-Y",strtotime($show_menu['dob'])); ?></td>-->
                        <td><?php echo ucwords($show_menu['aadhar_no']); ?></td>
                        <td><?php echo $show_menu['account_no']; ?></td>
                        <td><?php echo $show_menu['branch_ifsc']; ?></td>
                        <td style="text-align:center !important;"><?php echo $payment_status; ?></td>
                        <td style="text-align:center !important;"><?php echo $uan_status; ?></td>
                        <td class="center" style="text-align:center">
                        	<a href="home.php?page=addRsp&rspId=<?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=rspList&rspDelId=<?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_rsp` 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=rspList");
}
?>	   
<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>


   
