<?php
	include_once 'includes/processes.php';
	$Process = new Login_Process;

	$pageLink = basename($_SERVER['REQUEST_URI']);
	$Process->check_status($pageLink);
	extract($_GET);
	
	$empData = $Process->getEmployeeInfo($sid);
?>
		
		
		
		<form action="users.php" method="post">
		<input type="hidden" name="staff_id" value="<?php echo $sid; ?>" />
		<div class="modal-header">
			<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
			<h3 class="modal-title"><i class="fa fa-edit"></i> Edit User</h3>
		</div>	
		<div class="modal-body">
			<div class="row">
				<div class="form-group col-sm-12 col-sm-6">
					<label for="first-name">First name</label>
					<input type="text" id="first-name" name="first-name" value="<?php echo $empData->firstname; ?>" class="form-control" required />
				</div>
				<div class="form-group col-sm-12 col-sm-6">
					<label for="last-name">Last name</label>
					<input type="text" id="last-name" name="last-name" value="<?php echo $empData->firstname; ?>" class="form-control" required />
				</div>
				<div class="form-group col-md-6 col-sm-12">
					<label for="gender">Gender</label>
					<select class="form-control" id="gender" name="gender" required>
						<option value="">-- gender --</option>
						<option value="Male" <?php if($empData->gender=="Male") {echo "selected";} ?>>Male</option>
						<option value="Female" <?php if($empData->gender=="Female") {echo "selected";} ?>>Female</option>
					</select>
				</div>
				<div class="form-group col-sm-6">
					<label for="user-email">Email Address</label>
					<input type="email" id="user-email" name="user-email" value="<?php echo $empData->cooperate_email; ?>" class="form-control" required />
				</div>
				<div class="form-group col-sm-6">
					<label for="user-dept">User Department</label>
					<select class="form-control" id="user-dept" name="user-dept" required>
						<option value="">-- department --</option>
						<?php $Process->listDepartment($empData->department_id); ?>
					</select>
				</div>
				<div class="form-group col-sm-6">
					<label for="user-station">User Station</label>
					<select class="form-control" id="user-station" name="user-station" required>
						<option value="">-- station --</option>
						<?php $Process->listStation($empData->station_id); ?>
					</select>
				</div>
				<div class="form-group col-sm-6">
					<label for="user-phone">Phone Number</label>
					<input type="text" id="user-phone" name="user-phone" value="<?php echo $empData->phone; ?>" class="form-control" autocomplete="false" />
				</div>
				<div class="form-group col-sm-6">
					<label for="user-pass">Password</label>
					<input type="password" id="user-pass" name="user-pass" class="form-control" />
				</div>
				<div class="form-group col-sm-6">
					<label for="role">User Access Role</label>
					<select class="form-control" id="role" name="role" required>
						<option value="">-- role --</option>
						<?php $Process->listRoles($empData->access_role); ?>
					</select>
				</div>
				<div class="form-group col-sm-6">
					<label for="change_password">Force Password Change</label>
					<select class="form-control" id="change_password" name="change_password">
						<option value="No">Yes</option>
						<option value="Yes">No</option>
					</select>
				</div>
			</div>
		</div>
		<div class="modal-footer">
			<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
			<button type="submit" name="update-user" class="btn btn-primary">Update User</button>
		</div>
	</form>
		