<div class="right_col" role="main">
	<div class="">
		<div class="page-title">
			<div class="title_left">
				<h3>Staff list <a href="index.php?pagecontent=staff_new"><button type="button" class="btn btn-dark">Add Staff</button></a></h3>
				
			</div>
		</div>
		<div class="clearfix"></div>
		<div class="row">
			<div class="col-md-12 col-sm-12 col-xs-12">
				<div class="x_panel">
					<div class="x_content">
						<table id="datatable" class="table table-striped table-bordered">
							<thead>
								<tr>
									<th>Nickname</th>
									<th>Username</th>
									<th>Password</th>
									<th>Contact</th>
									<th>Status</th>
									<th>Auth</th>
									<th>Salary</th>
									<th>Action</th>
								</tr>
							</thead>
							<tbody>
								<?php
									$result = mysqli_query($conn, "SELECT * FROM staffs ORDER BY s_status DESC");
									while($row = mysqli_fetch_array($result))
									{
										$sId=$row['s_id'];
								?>
								<tr>
									<td><?php echo $row['s_nickname'];?></a></td>
									<td><?php echo $row['s_username'];?></a></td>
									<td><?php echo $row['s_password'];?></a></td>
									<td><?php echo $row['s_contact'];?></a></td>
									<td><?php echo staffStatus($row['s_status'])['title']; ?></a></td>
									<td><?php echo $row['s_authorization'];?></a></td>
									<td><a href="?pagecontent=staff_salary&id=<?php echo $sId; ?>">Salary</a></td>
						
									<td>
										<a href="?pagecontent=staff_update&id=<?php echo $row['s_id']; ?>"><button class="btn btn-xs btn-primary">Update</button></a>
										
										<a href="?pagecontent=staffs&remove=<?php echo $row['s_id']; ?>"><button class="btn btn-xs btn-danger">Remove</button></a>
									</td>
								</tr>
								<?php
									}
								?>
						</table>
					</div>
				</div>
			</div>
        </div>
    </div>
</div>

<?php
	if(isset($_REQUEST['remove'])){
		$id = $_REQUEST['remove'];
		mysqli_query($conn,"DELETE FROM staffs WHERE s_id=$id");
		header('Location: ?pagecontent=staffs');  
	}
?>