<section class="container" style="padding-bottom: 2rem;">
	<div class="row">
		<div class="col-sm-12">
			<div class="tab-content" id="tabContent">
				<div class="tab-pane fade show active" id="profile" role="tabpanel" aria-labelledby="profile-tab">
					<div class="card bg-light-transparent">
						<div class="card-header bg-light">
							<h4 class="card-title float-left"><?php echo ($type == 1)?'New Client':(($type == 2)?'Client Resignation':'N/A'); ?></h4>
						</div>
						<div class="card-body">
							<div class="card no-shadow">
								<div class="card-body">
									<form id="clientNewResignationForm" class="form" action="<?php echo ($ID)?base_url('hr/Serviceform/client_new_resignation_edit'):base_url('hr/Serviceform/client_new_resignation_save'); ?>" method="POST" enctype="multipart/form-data" onsubmit="return confirm('Confirm to submit this form?')">

										<input type="text" class="form-control" name="type" id="type" value="<?php echo $type; ?>" hidden>
										<input type="text" class="form-control" name="clientNewResignationID" id="clientNewResignationID" value="<?php echo $ID; ?>" hidden>

										<div class="form-row">
											<div class="col-12">
												<div class="form-group">
													<div class="form-row">
														<div class="col-12 col-sm-6">
															<div class="form-group">
																<label>Name</label>
																<input type="text" class="form-control" name="request_name" id="request_name" value="<?php echo ($ID)?$request_list['requester_name']:$_SESSION['user']['name']; ?>" readonly>	
																<input type="text" class="form-control" name="request_name_id" id="request_name_id" value="<?php echo ($ID)?$request_list['requester_id']:$_SESSION['user']['id']; ?>" hidden>
															</div>
														</div>

														<div class="col-12 col-sm-6">
															<div class="form-group">
																<label for="email">Email Address</label>
																<input type="text" class="form-control" name="request_email" id="request_email" value="<?php echo ($ID)?$request_list['requester_email']:$_SESSION['user']['email']; ?>" readonly>
															</div>
														</div>

														<div class="col-12 col-sm-6">
															<div class="form-group">
																<label for="department">Department</label>
																<input type="text" class="form-control" name="request_dept" id="request_dept" value="<?php echo ($ID)?$request_list['dept_name'].' ['.$request_list['branchName'].']':$_SESSION['user']['department_name'].' ['.$_SESSION['user']['branch_name'].']'; ?>" readonly>	
																<input type="text" class="form-control" name="request_dept_id" id="request_dept_id" value="<?php echo ($ID)?$request_list['department_id']:$_SESSION['user']['department_id']; ?>" hidden>
															</div>
														</div>

														<div class="col-12 col-sm-6">
															<div class="form-group">
																<label for="datereq">Date Request</label>
																<input type="text" class="form-control" name="datereq" id="datereq" value="<?php echo ($ID)?date("d-m-Y",strtotime($request_list['createdTS'])):date("d-m-Y"); ?>" readonly>
															</div>
														</div>
													</div>
												</div>
											</div>
										</div>

										<div class="form-row">
											<?php if($type == 1){ ?>
												<div class="col-12 col-sm-6">
													<div class="form-group">
														<label>Group Name</label>
														<select class="form-control select" name="master_id" id="master_id">
															<option></option>
															<?php if($master_client) foreach($master_client as $row){ ?>
																<option value="<?php echo $row->id; ?>" <?php echo ($ID)?(($request_list['master_id'] == $row->id)?'selected':''):''; ?>>
																	<?php echo $row->name; ?>
																</option>
															<?php } ?>
														</select>
													</div>
												</div>

												<div class="col-12 col-sm-6">
													<div class="form-group">
														<label>Client Name</label>
														<input type="text" class="form-control" name="client_name" id="client_name" required value="<?php echo ($ID)?$request_list['client_name']:''; ?>">
													</div>
												</div>

												<div class="col-12">
													<div class="form-group">
														<label>Nature of Business</label>
														<textarea class="form-control" name="nature_business" id="nature_business" rows="1.5" required><?php echo ($ID)?$request_list['nature_business']:''; ?></textarea>
													</div>
												</div>

												<div class="col-12 col-sm-6">
													<div class="form-group">
														<label>Director's Name</label>
														<input type="text" class="form-control" name="director_name" id="director_name" required value="<?php echo ($ID)?$request_list['director_name']:''; ?>">
													</div>
												</div>
											<?php } elseif($type == 2){ ?>
												<div class="col-12 col-sm-6">
													<div class="form-group">
														<label>Client Name</label>
														<select class="form-control select" name="client_id" id="client_id" required>
															<option></option>
															<?php if($client) foreach($client as $row){ ?>
																<option value="<?php echo $row->id; ?>" <?php echo ($ID)?(($request_list['client_id'] == $row->id)?'selected':''):''; ?>>
																	<?php echo $row->name; ?>
																</option>
															<?php } ?>
														</select>
													</div>
												</div>

												<div class="col-12 col-sm-6">
													<div class="form-group">
														<label>Reason of Resignation / Termination</label>
														<textarea class="form-control" name="reason" id="reason" rows="1.5" required><?php echo ($ID)?$request_list['reason']:''; ?></textarea>
													</div>
												</div>
											<?php } ?>

											<div class="col-12 col-md-6">
												<div class="form-group">
													<label>Attachment</label>
													<input type="file" class="form-control" id="picture_upload" name="picture_upload" value="" aria-describedby="attachmentHelp" <?php echo ($type == 2)?(($ID)?(($request_list['attachment_id'])?"":"required"):"required"):''; ?>>
												</div>
											</div>

											<div class="col-12 col-md-6">
												<div class="form-group <?php echo ($ID)?'':'d-none'; ?>">
													<label style="padding-right: 12px;">Current attachment :</label>
													<input class="form-control" type="text" name="curr_picture_upload" id="curr_picture_upload" value="<?php echo ($ID)?$request_list['filename']:''; ?>" aria-describedby="attachmentHelp" readonly>
												</div>
											</div>
										</div>

										<div class="form-row" <?php echo (isset($mode) && ($mode == 'view'))?'style="display: none;"':''; ?>>
											<div class="col-12" style="padding-top: 2rem;">
												<div class="float-left <?php echo ($ID)?'d-none':''; ?>">
													<table>
														<tbody>
															<tr>
																<td class="text-center">
																	<label class="switch" data-trigger="hover" data-tooltip="tooltip" title="" data-original-title="Send me a copy of this form">
																		<input type="checkbox" name="send_email_checkbox">
																		<span class="slider round"></span>
																	</label>
																</td>
																<td class="p-3 py-1"><b><h6 style="">Send me a copy of this form</h6></b></td>
															</tr>
														</tbody>
													</table>
												</div>

												<div class="float-right">
													<a class="btn btn-light" href="<?php echo base_url('hr/serviceform/client_new_resignation_list/'); ?>">Cancel</a>
													<button type="submit" id="submitBtn" class="btn btn-primary"><?php echo 'submit'; ?></button>
												</div> 
											</div>
										</div>
									</form>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</section>

<?php echo (!empty($approval))?$approval:''; ?>