<?php 
include ('config.php');
if(!isset($_SESSION['emp_name']))
	 {
	  echo("<script language='javascript'>window.location.href='index.php'</script>");
	  exit;
	 }
	 if(isset($_REQUEST['delete'])!='')
{
	$del_cat=mysqli_query($conn,"delete from tbl_admin where sno='".base64_decode($_REQUEST['delete'])."'");
	if($del_cat)
	{
      header("location:staffdetails.php");
	}
}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="content-type" content="text/html; charset=utf-8" />
		<link rel="stylesheet" type="text/css" href="css/grid.css" tppabs="" media="screen" />
        <!-- Main stylesheet -->
        <link rel="stylesheet" type="text/css" href="css/styles.css" tppabs="" media="screen" />
	
    <script language="javascript">
var xmlHttp12
function ajaxstatus(str,state)
{
//alert(str);
//alert(state);
xmlHttp12=GetXmlHttpObject()
if (xmlHttp12==null)
 {
 alert ("Browser does not support HTTP request")
 return
 }
var url12="view_emp_active.php"
url12=url12+"?q="+str+"&s="+state
xmlHttp12.onreadystatechange=stateChanged12
xmlHttp12.open("GET",url12,true)
xmlHttp12.send(null)
}
function stateChanged12() 
{ 
if (xmlHttp12.readyState==4 || xmlHttp12.readyState=="complete")
 {
window.location.reload(); 
}
}
function GetXmlHttpObject()
{
var xmlHttp12=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp12=new XMLHttpRequest();
 }
catch (e)
 {
 //Internet Explorer
 try
  {
  xmlHttp12=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp12=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp12;
}
</script>

	<body>
    	<!-- Header -->
        <?php include('header.php');?>
		<div class="container_12">
         <div class="float-right">
                        <a href="add_staffs.php" class="button" >
                        	<button >Add Staffs <img src="plus-small.gif" width="18" height="12" alt="Add Staffs" /></button>
                        </a>
                    </div>
        
               <!-- Example table -->
                <div class="module">
                </br>
                	<h2><span>Staff Details</span></h2>
                    
                    <div class="module-table-body">
                    	<form action="">
                        <table id="myTable" >
                        	<thead >
                                <tr >
                                    <th style="width:1%">S.No</th>
                                     <th style="width:5px">Employee Name</th>
                                      <th style="width:5px">User Name</th>
                                    <th style="width:5px">Employee Acc.No</th>
                                    <th style="width:5px">Password</th>
                                   <th style="width:5px">Gender</th>
                                   <th style="width:5px">Edit</th>
                                     <th style="width:5px">Delete</th>
                                

                                    
                                
                                
                                </tr>
                            </thead>
<?php
$i=1; 
$select_query=mysqli_query($conn,"select * from tbl_admin where emp_name!='admin' and emp_accno!='123' ");
while($result=mysqli_fetch_array($select_query))

{
?>
                            <tbody>
                                <tr>
                                    <td align="center"><?php echo $i;  ?></td>
                                  <td align="center"><?php echo $result['emp_name'];?></td>
                                 <td align="center"><?php echo $result['emp_uname'];?></td>
                                    <td align="center"><?php echo $result['emp_accno'];?></td>
                                    <td align="center"><?php echo $result['emp_password'];?></td>
                                    <td align="center"><?php echo $result['gender'];?></td>
                                    <td align="center" class="table_text"><a href="edit_staff.php?id=<?php echo base64_encode($result['sno']); ?>&rpage=<?php echo base64_encode($cont); ?>" ><img src="edit.png"  border="0" /></a></td>  
                                   
                              <td align="center" class="table_text">
                    <a href="staffdetails.php?delete=<?php echo base64_encode($result['sno']); ?>"  onclick="return confirm('Are you sure to delete');"><img src="delete.png" width="14"  border="0" /></a>
                    </td>
                    	 <?php /*?><?php
							   if($result['emp_status']=='Y')
							   {
							   ?>
                  <td align="center"><select name="status" id="status" onChange="ajaxstatus('<?php echo $result['sno'];?>', this.value);" style="color:#006400;"><option value="Y" selected>ACTIVE</option><option value="N">INACTIVE</option></select></td>
                               <?php 
							   }
							    if($result['emp_status']=='N')
							   {
							   ?>
                  <td align="center"><select name="status" id="status" onChange="ajaxstatus('<?php echo $result['sno'];?>', this.value);" style="color:#FF0000;"><option value="Y">ACTIVE</option><option value="N" selected>INACTIVE</option></select></td>
                               <?php 
                               }
                               ?><?php */?>
                                    <?php $i++;}?>
                                </tr>
                            </tbody>
                        </table>
                        </form>
                        <div style="clear: both"></div>
                     </div> <!-- End .module-table-body -->
                </div> <!-- End .module -->
			</div> <!-- End .grid_12 -->
            <div style="clear:both;"></div>
        </div> <!-- End .container_12 -->
		
           
        <!-- Footer -->
      <!-- End #footer -->
	</body>
</html>