<?php
include_once 'includes/processes.php';
$Process = new Login_Process;
$pageLink = basename($_SERVER['REQUEST_URI']);
$Process->check_status($pageLink);

$departmentData = $Process->getDepartmentInfo($_GET['did']);
$deptDesigData = $Process->getDeptDesignations($_GET['did']);

?>

				<form method="post" action="departments.php" >
				<input type="hidden" name="dept_id" value="<?php echo $_GET['did']; ?>" />
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true" class="ti-close"></span></button>
						<h4 class="modal-title" id="myModalLabel6"><i class="fa fa-edit"></i> Update Project</h4>
					</div>
					<div class="modal-body">
						<!-- xaddress form-->
						<div class="row">
							
							<div class="col-md-12">
								<div class="alert alert-info">
									<i class="ion ion-alert"></i> 
									Empty if you want to delete the designation
								</div>
							</div>
							
						<div class="form-group col-md-12">
							<label class="control-label">Department</label>
							<input type="text" name="dept_name" class="form-control col-md-12 col-xs-12" value="<?php echo $departmentData->dept_name; ?>"  autocomplete="off" placeholder="Department name" required />
						</div>
						
							
						<?php  						
							while($Data = $deptDesigData->fetch()) {
							$desig_id = $Data->designation_id;
							$designation = $Data->designations;
							
						?>
							
						<div class="form-group col-md-4">
							<label class="control-label">Designation</label>
							<div class="input-group">
								<input type="hidden" name="designation_id[]" value="<?php echo $desig_id; ?>" />
								<input type="text" name="designation_old[]" value="<?php echo $designation ?>" class="form-control col-md-12 col-xs-12"  autocomplete="off" placeholder="designation" />
							</div>
						</div>
						<?php }	?>
						
						<div id="dynamicInputs2"></div>
						<div class="col-md-12">
						<a href="#" class="btn btn-info btn-lg btn-xs" type="button" onclick="addDesignation('dynamicInputs2');"> Add Designation <i class="fa fa-plus"></i></a>
						</div>
						<div class="col-md-12">
						<br />
						<br />
							<div class="alert alert-warning">
								<i class="ion ion-alert-circled"></i> 
								Please Note: Emptying a designation will remove associated employees from that department
							</div>
						</div>
						<!-- xaddress form-->
						</div>
					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
						<button type="submit" name="update_designation" class="btn btn-primary">Update Project</button>
					</div>
				</form>
		