<?php
include('../headertop.php');
//include('../datepicker.php');
include('../db.php');

$disp = '';
$pagetitle = 'View Staff';

$q = "select * from employee";
$res = mysqli_query($dbcon,$q) or die(mysqli_error($dbcon));

if(mysqli_num_rows($res)<1)
{
$disp .= 'No employees found';
include('../template.php');
exit;
}

if(isset($_REQUEST['sm']))
$disp .= '<div class="smdiv">'.$_REQUEST['sm'].'</div>';
else
$disp .= '<div class="smdiv">List of Employees/Staff</div>';


 
$disp .= '<div class="row">
                <div class="col-md-12">
                    <!-- Advanced Tables -->
                    <div class="panel panel-default">
                        <div class="panel-heading">
                             Employee List
                        </div>
                        <div class="panel-body">
                            <div class="table-responsive">
                                <table class="table table-striped table-bordered table-hover" id="dataTables-example">
                                    <thead>
                                        <tr>
                                            <th>Photo</th>
											<th>Name</th>
                                            <th>Father/Husband Name</th>
                                            <th>Qualification</th>
                                            <th>Address</th>
											<th>Mobile</th>
                                            <th>Salary</th>
											<th>Operation</th>
                                        </tr>
                                    </thead>
                                    <tbody>';
									
$dispp = '<div class="row">
                <div class="col-md-12">
                    <!-- Advanced Tables -->
                    <div class="panel panel-default">
                        <div class="panel-heading">
                             Employee List
                        </div>
                        <div class="panel-body">
                            <div class="table-responsive">
                                <table class="table table-striped table-bordered table-hover" id="dataTables-example">
                                    <thead>
                                        <tr>
                                            
											<th>Name</th>
                                            <th>Father/Husband Name</th>
                                            <th>Qualification</th>
                                            <th>Address</th>
											<th>Mobile</th>
                                            <th>Salary</th>
											
                                        </tr>
                                    </thead>
                                    <tbody>';
									
  while($row=mysqli_fetch_array($res))
{  
$disp .= '<tr class="odd gradeX">';
$dispp .= '<tr class="odd gradeX">';
//$qphoto = "select path from empuploads where user='employee' and uid='".$row['id']."'";
//$rphoto = mysqli_query($dbcon,$qphoto);  
                         
      
$disp .= '<td><a href="'.$row['photopath'].'" target=_blank><img src="'.$row['photopath'].'" style="width:50px;height:50px"></a></td><td>'.$row['name'].'</td>';	
$dispp .= '<td>'.$row['name'].'</td>';

$disp .= '<td>'.$row['fname'].'<td>'.$row['qualification'].'</td>
                                            <td class="center">'.$row['address'].'</td>
                                            <td class="center">'.$row['mobile'].'</td>
											<td class="center">'.$row['salary'].'</td>
											<td class="center"><a href="editemployee.php?id='.$row['id'].'"><img src="../assets/img/edit.png"></a> &nbsp; <a href="deleteemployee.php?id='.$row['id'].'"><img src="../assets/img/delete.png"></a></td>
                                        </tr>
                                       ';

$dispp .= '<td>'.$row['fname'].'<td>'.$row['qualification'].'</td>
                                            <td class="center">'.$row['address'].'</td>
                                            <td class="center">'.$row['mobile'].'</td>
											<td class="center">'.$row['salary'].'</td>
											
                                        </tr>
                                       '; 
} //end of while

$disp .='            </tbody>
                                </table>
                            </div>
                            
                        </div>
                    </div>
                    <!--End Advanced Tables -->
                </div>
            </div>';
			
$dispp .=  ' </tbody>
                                </table>
                            </div>
                            
                        </div>
                    </div>
                    <!--End Advanced Tables -->
                </div>
            </div>';
		
			?>
		
     <script>
            $(document).ready(function () {
                $('#dataTables-example').dataTable();
            });
    </script>
          <?php
		  
		  $disp2 = '<form method="post" action="../printtemplate.php">
		<input type="hidden" name="disp" value="'.htmlspecialchars($dispp).'"><input type="submit" value="Print">
		</form>';
		
		$disp .= $disp2;
			
			include('../template.php');
               