<?php include("header.php"); ?>
<title>List of Employees</title>
		<style type="text/css" title="currentStyle">
			@import "css/table/demo_page.css";
			@import "css/table/demo_table_jui.css";
			@import "css/table/jquery-ui-1.8.4.custom.css";
		</style>
		<script type="text/javascript" language="javascript" src="js/table/jquery.dataTables.js"></script>
		<script type="text/javascript" charset="utf-8">
			jQuery(document).ready(function() {
				oTable = jQuery('#emp').dataTable({
					"bJQueryUI": true,
					"sPaginationType": "full_numbers"
								} );
				});		
		</script>
</head>
<body class="view_user standard">
		<div class="wrapper">
		<div class="header"><h1>Lifeguard Archangels Security Corporation</h1></div>
				<?php include("main_menu.php"); ?>
				<div class="right_nav">
				<h1>Profiles</h1>
				<?php include("right_nav.php"); ?>
				</div>
		<div class="content">
		
		<div class="actions">
			<h2>Employee List 
			
			<!-- hide actions for user access level-->
			<?php if($_SESSION['user_type'] != 'User'){ ?>
			| <a href="add_emp.php"><img src="images/add-icon.png" height="28"></a><?php } ?>
			<!-- hide actions for user access level-->
			
			| <!-- call for pdf print --> <a href="mpdf51/examples/employees_pdf.php"><img src="images/printer.jpg" /></a></h2>
			<form action="mpdf51/examples/print_emp.php" method="POST">
			
			<div class="color2">
			Employee Type Reports<br><select name="type">
			<option value="emp">Staff</option>
			<option value="guard">Guards</option>
			</select>
			<input type="submit" value="Proceed">
			</form></br></br>
			</div>
			
			<div class="color2">
			<form action="mpdf51/examples/print_guards.php" method="POST">
			Guard Status Reports<br><select name="assignment">
			<option value="Assigned">Assigned</option>
			<option value="unassigned">Unassigned</option>
			</select>
			<input type="submit" value="Proceed">
			</form></br>
			</div>
		
			<div class="color2">
			<form action="mpdf51/examples/print_skills.php" method="POST">
			Skill Reports<br><select name="skill">
			<option value="pharmacy">Pharmacies</option>
			<option value="escort">Escort</option>
			<option value="Schools">Schools</option>
			<option value="Banks">Banks</option>
			<option value="Malls">Malls</option>
			<option value="Restaurants">Restaurants</option>
			<option value="Firms">Private Firms</option>
			<option value="Supermarkets">Supermarkets</option>
			<option value="Personal">Personal</option>
			<option value="Airports">Airports</option>
			</select>
			<input type="submit" value="Proceed"></br>
			</form></div>
			<br>
			
<div class="demo_jui">
<table cellpadding="0" cellspacing="0" border="0" class="display" id="emp" class="jtable">
	<thead>
		<tr>
			<th>Control Number</th>
			<th>Name</th>
			<th>Position</th>
			<th>Assignment Status</th>
			<th>Skill</th>
			<th style="width:120px!important;">Rating</th>
					
			<!-- hide actions for user access level-->
			<?php if($_SESSION['user_type'] != 'User'){ ?><th>Actions</th><?php } ?>
			<!-- hide actions for user access level -->
			
		</tr>
	</thead>
	<tbody>
			<?php $emp = mysql_query("SELECT * FROM employees") or die(mysql_error());  ?>
			<?php WHILE($emps = mysql_fetch_array($emp)){
				$id = $emps['emp_id'];
				$position = $emps['position'];
				$assignment = $emps['assignment'];
				$control = $emps['emp_id'];
				$skills = $emps['skills'];
				$ranking = $emps['ranking'];
				//$photo = $emps['photo'];
				$name = $emps['first_name'] . "&nbsp;" . $emps['last_name'];
				?>
			<tr class="gradeA del<?php echo $id;?>">
				<td><?php echo $control; ?></td>
				<td><?php echo $name; ?></td>
				<td><?php echo $position; ?></td>
				<td><?php echo $assignment; ?></td>
				<td><?php echo $skills; ?></td>
				<td style="width:120px!important;" ><?php echo $ranking; ?></td>
				
				<!-- hide actions for user access level-->
						<?php if($_SESSION['user_type'] != 'User'){ ?>
						<!-- hide actions for user access level-->
				<td style="width:110px;" ><a class="delete" id="<?php echo $id; ?>">
				<form action ="modify_emp.php" method="POST" >
					<img src = "images/edit_delete.png" height="30" alt = "delete" title = "delete"/></a>
					<input type="hidden" value="<?php echo $id; ?>" name="id" />
					<input type="image" src="images/edit-icon.png" height="30"/>
					<a href="view_emp.php<?php echo '?id='; echo $id; ?>">
					<img src= "images/view-icon.png" height="30" alt = "view" title = "view"/></a>
					
				</form>
				<?php } ?>
				</td>
				
			
			</tr>
			<?php } ?>
	</tbody>
</table>
</div></br>
		</div>
	
	</div>
<?php include("footer.php"); ?>
</div>
<input type="hidden" class="pc_date">
<input type="hidden" class="pc_time">
</body>
</html>
<script type="text/javascript">
	$(document).ready( function() {
/* bwesit nga local time*/
var myDate = new Date();
var pc_date = (myDate.getMonth()+1) + '/' + (myDate.getDate()) + '/' + myDate.getFullYear();
var pc_time = myDate.getHours()+':'+myDate.getMinutes()+':'+myDate.getSeconds();
jQuery(".pc_date").val(pc_date);
jQuery(".pc_time").val(pc_time);
/* bwesit nga local time*/
		
		$('.delete').click( function() {
		
		var id = $(this).attr("id");
		var date = $('.pc_date').val();
		var time = $('.pc_time').val();
		
		if(confirm("Are you sure you want to delete this employee?")){
			
		
			$.ajax({
			type: "POST",
			url: "delete_emp.php",
			data: ({id: id, date:date, time:time}),
			cache: false,
			success: function(html){
			$(".del"+id).fadeOut('slow', function(){ $(this).remove();}); 
			}
			}); 
			}else{
			return false;}
		});				
	});

</script>
