<div class="container <?php echo $btn_hidden; ?> d-none" style="position: fixed; position: relative;">
	<div class="jumbotron bg-white" style="padding-top: 0px; padding-bottom: 0px;">
		<div class="row d-print-none">
			<div class="col-12" style="margin-top:1rem;">
				<h4 style="color: red;"><b>Item Checklist</b></h4>
				<table id="table_update_profile_checklist_top" class="table table-hover table-bordered">
					<thead>
						<tr class="text-center">
							<th width="15%">Marital Status</th>
							<th width="10%">Address</th>
							<th width="10%">Family Info</th>
							<th width="15%">Next of Kin</th>
							<th width="15%">Employee Rate (%)</th>
							<th width="15%">PCB Deduction Rate (%)</th>
							<!-- <th width="10%">Statutory Year</th> -->
							<th width="15%">PCB Consideration</th>
							<th width="10%">Emergency Contact</th>
							<!-- <th width="10%">Experience in SALIHIN</th> -->
						</tr>
					</thead>

					<tbody>
						<?php 
						$is_able_submit = 0;
						if($user_profile) foreach($user_profile as $row) { ?>
							<tr>
								<td class="text-center">
									<?php 
										if($row['marital_status'] > 0)
										{
											echo '<i class="fa fa-check" style="color: green;"></i>';
											$is_able_submit += 1;
										}else{
											echo '<i class="fa fa-times" style="color: red;"></i>'; 
											$is_able_submit += 0;
										}
									?>
								</td>
								<td class="text-center">
									<?php 
										if($row['address'] > 0)
										{
											echo '<i class="fa fa-check" style="color: green;"></i>';
											$is_able_submit += 1;
										}else{
											echo '<i class="fa fa-times" style="color: red;"></i>'; 
											$is_able_submit += 0;
										}
									?>
								</td>
								<td class="text-center">
									<?php 
										if($row['family_info'] > 0)
										{
											echo '<i class="fa fa-check" style="color: green;"></i>';
											$is_able_submit += 1;
										}else{
											echo '<i class="fa fa-times" style="color: red;"></i>'; 
											$is_able_submit += 0;
										}
									?>
								</td>
								<td class="text-center">
									<?php 
										if($row['next_kin'] > 0)
										{
											echo '<i class="fa fa-check" style="color: green;"></i>';
											$is_able_submit += 1;
										}else{
											echo '<i class="fa fa-times" style="color: red;"></i>'; 
											$is_able_submit += 0;
										}
									?>
								</td>
								<td class="text-center">
									<?php 
										if($row['user_rate'] > 0)
										{
											echo '<i class="fa fa-check" style="color: green;"></i>';
											$is_able_submit += 1;
										}else{
											echo '<i class="fa fa-times" style="color: red;"></i>'; 
											$is_able_submit += 0;
										}
									?>
								</td>
								<td class="text-center">
									<?php 
									$salary_after_epf = $row['gross_pay'] - (($row['user_rate'] / 100) * $row['gross_pay']);
									if(number_format($salary_after_epf,2) >= number_format(2833.33,2))
									{
										if($row['user_pcb_rate'] > 0 || $row['user_zakat_rate'] > 0)
										{
											echo '<i class="fa fa-check" style="color: green;"></i>';
											$is_able_submit += 1;
										}else{
											echo '<i class="fa fa-times" style="color: red;"></i>'; 
											$is_able_submit += 0;
										}
									}else{
										echo 'N/A';
										$is_able_submit += 1;
									}
									?>
								</td>

								<!-- <td class="text-center">
									<?php 
										if($row['user_statutory_year'] > 0)
										{
											//echo '<i class="fa fa-check" style="color: green;"></i>';
											//$is_able_submit += 1;
										}else{
											//echo '<i class="fa fa-times" style="color: red;"></i>'; 
											//$is_able_submit += 0;
										}

									?>
								</td> -->
								<td class="text-center">
									<?php 
									if($row['child_info'] > 0)
									{
										if($row['pcb_consideration'] > 0)
										{
											echo '<i class="fa fa-check" style="color: green;"></i>';
											$is_able_submit += 1;
										}else{
											echo '<i class="fa fa-times" style="color: red;"></i>'; 
											$is_able_submit += 0;
										}
									}else{
										echo 'N/A';
										$is_able_submit += 1;
									}
									?>
								</td>
								<td class="text-center">
									<?php 
										if($row['case_emergency'] > 0)
										{
											echo '<i class="fa fa-check" style="color: green;"></i>';
											$is_able_submit += 1;
										}else{
											echo '<i class="fa fa-times" style="color: red;"></i>'; 
											$is_able_submit += 0;
										}
									?>
								</td>
								<!-- <td class="text-center"><?php //echo ($row['working_experience'] > 0)?'<i class="fa fa-check" style="color: green;"></i>':'<i class="fa fa-times" style="color: red;"></i>'; ?></td> -->
							</tr>
						<?php } ?>
					</tbody>
				</table>
			</div>
		</div>
	</div>
</div>

<div class="container">
	<input type="text" name="profiling_id_new" id="profiling_id_new" value="<?php echo $profiling_id_new; ?>" hidden>
	<section style="/*padding-top: 1rem;*/ padding-bottom: 1rem;">
		<div class="row float-right">
			<div class="d-none">
				<?php if(!empty($submit_status)){ ?>
					<?php if($is_able_submit == 8){ ?>
						<button class="btn btn-success <?php echo $btn_hidden; ?>" title="You Have Submitted Your Profile Update" data-staffid="<?php echo $staff_id; ?>" data-date="<?php echo date('Y-m-d'); ?>" onclick="submit_update_profile(this)"><i class="fa fa-check"></i><br>Submit</button>
					<?php } else { ?>
						<button class="btn btn-danger <?php echo $btn_hidden; ?>" title="Item Checklist Not Completed Yet" style="cursor: not-allowed; opacity: .65;"><i class="fa fa-times"></i><br>Submit</button>
					<?php } ?>
				<?php } else { ?>
					<?php if($is_able_submit == 8){ ?>
						<button class="btn btn-danger <?php echo $btn_hidden; ?>" title="Please Submit Your Profile Update" data-staffid="<?php echo $staff_id; ?>" data-date="<?php echo date('Y-m-d'); ?>" onclick="submit_update_profile(this)"><i class="fa fa-times"></i><br>Submit</button>
					<?php } else { ?>
						<button class="btn btn-danger <?php echo $btn_hidden; ?>" title="Item Checklist Not Completed Yet" style="cursor: not-allowed; opacity: .65;"><i class="fa fa-times"></i><br>Submit</button>
					<?php } ?>
				<?php } ?>
			</div>
			&nbsp;
			<a href="<?php echo base_url('hr/Myprofile/view_profile/view'); ?>" class="btn btn-secondary" target="_blank">
				<i class="fa fa-eye"></i><br>Summary
			</a>
		</div> 
	</section>

	<div class="jumbotron" style="background-color: white;">
		<div class="row">
			<div class="col-12 col-sm-3 text-center" style="padding-left: 5rem;">
				<div class="border border-secondary img-responsive rounded-circle" style="background-image: url(<?php echo base_url(($staff_list['file_name'])?($staff_list['file_location'].$staff_list['file_name']):((strpos(strtoupper($staff_list['name']), "BINTI"))?'assets/images/user-female.png':'assets/images/user.png')); ?>); background-position:50% 50%; background-size: cover; width: 9rem; height: 9rem;"></div>
			</div>
			<div class="col-12 col-sm-9">
				<h1 class="display-6">Personal Details</h1>
				<hr class="my-4">
			</div> 
		</div>
		<div class="row">
			<div class="col-12">
				<form id="mainInfo">
					<div class="form-row">
						<div class="col-12 col-sm-6">
							
							<div class="form-row">
								<div class="col-12">
									<label for="inputEmail3" class="col-form-label-sm">Title</label>
									<select id="main_type" type="text" class="form-control form-control-sm" disabled>
										<option value="-1">N/A</option>
										<?php if(!empty($latest_profile->title_id)) foreach ($titles as $key => $title): ?>
										<option value="<?php echo $title->id;?>" <?php echo ($latest_profile->title_id == $title->id)?'selected':''; ?> ><?php echo $title->title;?></option>
									<?php endforeach ?>
								</select>
							</div>
						</div>

						<div class="form-row">
							<div class="col-12">
								<label for="inputEmail3" class="col-form-label-sm"> Name</label>
								<input type="text" id="main_company_name" data-id="" class="form-control form-control-sm" value="<?php echo ($rsStaff['name'])?$rsStaff['name']:'N/A'; ?>" disabled>
							</div>
						</div>

						<div class="form-row mb-2">
							<div class="col">
								<label for="inputEmail3" class="col-form-label-sm">Gender</label><br>
								<div class="row">
									<div class="col">
										<div class="custom-control custom-radio custom-control-inline">
											<?php if (!empty($latest_profile->gender_id)) {?>
												<input type="radio" id="customRadioInline5" name="main_master" class="custom-control-input" value="1" <?php echo ($latest_profile->gender_id == 1)?'checked':''; ?> disabled>
											<?php }else{ ?>
												<input type="radio" id="customRadioInline5" name="main_master" class="custom-control-input" value="1" disabled>
											<?php } ?>
											<label class="custom-control-label" for="customRadioInline5">Male</label>	
										</div>
										<!-- </div> -->
										<!-- <div class="col"> -->
											<div class="custom-control custom-radio custom-control-inline">
												<?php if (!empty($latest_profile->gender_id)): ?>
													<input type="radio" id="customRadioInline6" name="main_master" class="custom-control-input" value="0" <?php echo ($latest_profile->gender_id == 2)?'checked':''; ?> disabled>
												<?php else: ?>
													<input type="radio" id="customRadioInline6" name="main_master" class="custom-control-input" value="0" disabled>
												<?php endif ?>
												<label class="custom-control-label" for="customRadioInline6">Female</label>
											</div>
										</div>										
									</div>	

								</div>							
							</div>

							<div class="form-row">
								<div class="col-12">
									<label for="inputEmail3" class="col-form-label-sm">NRIC/Passport No</label>
									<input type="text" id="main_roc_no_ic" class="form-control form-control-sm" value="<?php echo (!empty($latest_profile->ic_no))?$latest_profile->ic_no:'N/A'; ?>" disabled>
								</div>
							</div>

							<div class="form-row">
								<div class="col-12 col-sm-6">
									<label for="inputEmail3" class="col-form-label-sm">Passport Expired Date</label>
									<?php
									if(!empty($latest_profile->passport_expired_date))
									{
										?>
										<input type="text" id="main_roc_no_pass_date" class="form-control form-control-sm" value="<?php echo (!empty(mysql_to_date_format($latest_profile->passport_expired_date)))?mysql_to_date_format($latest_profile->passport_expired_date):'N/A'; ?>" disabled>	
										<?php
									}else
									{
										?>
										<input type="text" id="main_roc_no_pass_date" class="form-control form-control-sm" value="N/A" disabled>
										<?php
									}
									?>
								</div>	
								<div class="col-12 col-sm-6">
									<label for="inputEmail3" class="col-form-label-sm">Working Permit Expired Date</label>
									<?php
									if(!empty($latest_profile->working_expired_date))
									{
										?>
										<input type="text" id="main_roc_no_work_date" class="form-control form-control-sm" value="<?php echo (!empty(mysql_to_date_format($latest_profile->working_expired_date)))?mysql_to_date_format($latest_profile->working_expired_date):'N/A'; ?>" disabled>	
										<?php
									}
									else
									{
										?>
										<input type="text" id="main_roc_no_work_date" class="form-control form-control-sm" value="N/A" disabled>
										<?php
									}
									?>
								</div>						
							</div>

							<div class="form-row">
								<div class="col-12 col-sm-6">
									<label for="inputEmail3" class="col-form-label-sm">Place of Issue</label>
									<?php if (!empty($latest_profile->place_issue)): ?>
										<?php foreach ($countries as $key => $country): ?>
											<?php if ($latest_profile->place_issue == $country->id): ?>
												<input type="text" id="main_address1" class="form-control form-control-sm" value="<?php echo $country->country; ?>" disabled>							
											<?php endif ?>
										<?php endforeach ?>
									<?php else: ?>
										<input type="text" id="main_address1" class="form-control form-control-sm" value="N/A" disabled>
									<?php endif ?>
								</div>
								<div class="col-12 col-sm-6">
									<label for="staticEmail" class="col-form-label-sm">Residential Status</label>
									<select type="text" id="main_status_residential" class="form-control form-control-sm" value="" disabled>
										<option value="-1">N/A</option>
										<?php if ($latest_profile->residential_id): ?>
											<option value="1" <?php echo ($latest_profile->residential_id == 1)?'selected':''; ?> >Resident</option>
											<option value="2" <?php echo ($latest_profile->residential_id == 2)?'selected':''; ?> >Non Resident</option>
										<?php endif ?>
									</select>
								</div>
							</div>

							
							
							<div class="form-row">
								<div class="col-12 col-sm-6">
									<label for="inputEmail3" class="col-form-label-sm">Birthdate</label>
									<?php
									if(!empty($latest_profile->birth_date))
									{
										?>
										<input type="text" id="main_birthdate" class="form-control form-control-sm" value="<?php echo (!empty(mysql_to_date_format($latest_profile->birth_date)))?mysql_to_date_format($latest_profile->birth_date):'N/A'; ?>" disabled>
										<?php
									}else
									{
										?>
										<input type="text" id="main_birthdate" class="form-control form-control-sm" value="N/A" disabled>									
										<?php
									}
									?>
								</div>
								<div class="col-12 col-sm-6">
									<label for="inputEmail3" class="col-form-label-sm">Birthplace</label>
									<input type="text" id="main_birthplace" class="form-control form-control-sm" value="<?php echo (!empty($latest_profile->birth_place))?$latest_profile->birth_place:'N/A'; ?>" disabled>
								</div>
							</div>
							
							<div class="form-row">
								<div class="col-12 col-sm-6">
									<label for="inputEmail3" class="col-form-label-sm">Age</label>
									<?php
									$age = 'N/A';
									if(!empty(mysql_to_date_format((!empty($latest_profile->birth_date))?$latest_profile->birth_date:null))){
										$current = date_create(date('Y-m-d'));
										$difference = date_diff($current,date_create($latest_profile->birth_date));
										$age = $difference->format('%Y');
									}
									?>
									<input type="text" id="main_fax" class="form-control form-control-sm" value="<?php echo $age; ?>" disabled>
								</div>
								<div class="col-12 col-sm-6">
									<label class="col-form-label-sm">Hobby</label>
									<button type="button" class="btn btn-default btn-sm d-print-none <?php echo $btn_hidden; ?>" onclick="openHobby();" data-trigger="hover" data-tooltip="tooltip" title="Edit Hobby">
										<i class="fa fa-edit" style="color: #F0AD4E;"></i>
									</button>
									<input type="text" class="form-control form-control-sm" id="hobby" value="<?php echo (!empty($latest_profile->hobby))?$latest_profile->hobby:'N/A'; ?>" disabled>
								</div>
							</div>			
							
						</div>
						<div class="col-12 col-sm-6">
							<span>
								<label for="inputEmail3" class="col-form-label-sm">Address</label>
								<input type="text" id="main_address" class="form-control form-control-sm" value="<?php echo (!empty($addresses[0]))? $addresses[0]->address:'N/A'; ?>" disabled>

								<div class="form-row">
									<div class="col-12 col-sm-6">
										<label for="inputEmail3" class="col-form-label-sm">Country</label>
										<input type="text" id="main_city_country" class="form-control form-control-sm" value="<?php echo (!empty($addresses[0]))? $addresses[0]->country_name:'N/A'; ?>" disabled>
									</div>
									<div class="col-12 col-sm-6">
										<label for="inputEmail3" class="col-form-label-sm">State</label>
										<input type="text" id="main_city_state" class="form-control form-control-sm" value="<?php echo (!empty($addresses[0]))? $addresses[0]->state_name:'N/A';?>" disabled>
									</div>		
								</div>
								<div class="form-row">
									<div class="col-12 col-sm-6">
										<label for="inputEmail3" class="col-form-label-sm">Postcode</label>
										<input type="text" id="main_postcode" class="form-control form-control-sm" value="<?php echo (!empty($addresses[0]))?$addresses[0]->postcode:'N/A'; ?>" disabled>
									</div>
									<div class="col-12 col-sm-6">
										<label for="inputEmail3" class="col-form-label-sm">City</label>
										<input type="text" id="main_city" class="form-control form-control-sm" value="<?php echo (!empty($addresses[0]))?$addresses[0]->city:'N/A'; ?>" disabled>
									</div>
								</div>
							</span>

							<div class="form-row">
								<div class="col-12">
									<label for="inputEmail3" class="col-form-label-sm">Nationality</label>
								</div>
							</div>
							<div class="form-row">
								<div class="col-12">
									<select class="form-control form-control-sm" disabled>
										<option value="-1">N/A</option>
										<?php foreach ($countries as $key => $country): ?>
											<option value="<?php echo $country->id; ?>" <?php echo ($country->id == $latest_profile->citizen_id)?'selected':''; ?> ><?php echo $country->country;?></option>
										<?php endforeach ?>
									</select>
								</div>
							</div>
							
							<div class="form-row">
								<div class="col-12 col-sm-6">
									<label for="inputEmail3" class="col-form-label-sm">Religion</label>
									<select type="text" id="main_status_religion" class="form-control form-control-sm" value="" disabled>
										<option value="-1">N/A</option>
										<?php if (!empty($latest_profile->religion_id)): ?>
											<?php foreach ($religions as $key => $religion): ?>
												<option value="<?php echo $religion->id; ?>" <?php echo ($latest_profile->religion_id == $religion->id)?'selected':''; ?>><?php echo $religion->name; ?></option>
											<?php endforeach ?>
										<?php endif ?>
									</select>
								</div>
								<div class="col-12 col-sm-6">
									<label for="inputEmail3" class="col-form-label-sm">Race</label>
									<select type="text" id="main_status_race" class="form-control form-control-sm" value="" disabled>
										<option value="-1">N/A</option>
										<?php if (!empty($latest_profile->race_id)): ?>
											<?php foreach ($races as $key => $race): ?>
												<option value="<?php echo $race->id;?>" <?php echo ($latest_profile->race_id == $race->id)?'selected':''; ?>><?php echo strtoupper($race->race);?></option>
											<?php endforeach ?>
										<?php endif ?>
									</select>
								</div>
							</div>
							<div class="form-row">
								<div class="col-12 col-sm-6">
									<label for="staticEmail" class="col-form-label-sm">Mobile Number</label>
									<button type="button" class="btn btn-default btn-sm d-print-none <?php echo $btn_hidden; ?>" onclick="openPhone();" data-trigger="hover" data-tooltip="tooltip" title="Edit Mobile Number">
										<i class="fa fa-edit" style="color: #F0AD4E;"></i>
									</button>
									<input type="text" class="form-control form-control-sm" id="phone_number" value="<?php echo (!empty($latest_profile->phone))?$latest_profile->phone:'N/A'; ?>" disabled>
								</div>
								<div class="col-12 col-sm-6">
									<label for="staticEmail" class="col-form-label-sm">Extension Number</label>
									<input type="text" class="form-control form-control-sm" id="ext_number" value="<?php echo (!empty($latest_profile->ext_no))?$latest_profile->ext_no:'N/A'; ?>" disabled>
								</div>
							</div>
							<div class="form-row">
								<div class="col-12 col-sm-6">
									<label for="inputEmail3" class="col-form-label-sm">Marital Status</label>
									
									<button type="button" class="btn btn-default btn-sm d-print-none <?php echo $btn_hidden; ?>" onclick="editMaritalStatus('<?php echo (!empty($latest_profile))?$latest_profile->id:0; ?>');" data-trigger="hover" data-tooltip="tooltip" title="Edit Marital Status">
										<i class="fa fa-edit" style="color: #F0AD4E;"></i>
									</button>
									
									<select type="text" id="main_status_marital" class="form-control form-control-sm" value="" disabled>
										<option value="-1">N/A</option>
										<?php if ($latest_profile->marital_status): ?>
											<option value="1" <?php echo ($latest_profile->marital_status == 1)?'selected':''; ?> >Single</option>
											<option value="2" <?php echo ($latest_profile->marital_status == 2)?'selected':''; ?> >Married</option>
											<option value="3" <?php echo ($latest_profile->marital_status == 3)?'selected':''; ?> >Divorce</option>
										<?php endif ?>
									</select>
								</div>
								<div class="col-12 col-sm-6">
									<label for="inputEmail3" class="col-form-label-sm">Married Date</label>
									<?php if (!empty($latest_profile->marital_status)): ?>
										<?php if ($latest_profile->marital_status == 2): ?>
											<input type="text" class="form-control form-control-sm" value="<?php echo (!empty(mysql_to_date_format($latest_profile->married_date)))?mysql_to_date_format($latest_profile->married_date):'N/A'; ?>" disabled>											
										<?php else: ?>
											<input type="text" class="form-control form-control-sm" value="N/A" disabled>	
										<?php endif ?>
									<?php else: ?>
										<input type="text" class="form-control form-control-sm" value="N/A" disabled>	
									<?php endif ?>
								</div>
							</div>	

							<div class="form-row">
								<div class="col-12 col-sm-6">
									<label for="inputEmail3" class="col-form-label-sm">Primary Email</label>
									<input type="text" class="form-control form-control-sm" value="<?php echo (!empty($latest_profile->primary_email))?$latest_profile->primary_email:'N/A'; ?>" disabled>
								</div>
								<div class="col-12 col-sm-6">
									<label for="inputEmail3" class="col-form-label-sm">Secondary Email</label>

									<button type="button" class="btn btn-default btn-sm d-print-none <?php echo $btn_hidden; ?>" onclick="editSecondaryEmail('<?php echo (!empty($latest_profile))?$latest_profile->id:0; ?>');" data-trigger="hover" data-tooltip="tooltip" title="Edit Secondary Email">
										<i class="fa fa-edit" style="color: #F0AD4E;"></i>
									</button>

									<input type="text" class="form-control form-control-sm" value="<?php echo (!empty($latest_profile->secondary_email))?$latest_profile->secondary_email:'N/A'; ?>" disabled>
								</div>
							</div>	

						</div>
					</div>					
				</form>
			</div>
		</div>
	</div>

	<!-- Modal Marital Status -->
	<div class="modal fade" id="maritalStatusModal">
		<div class="modal-dialog modal-lg">
			<div class="modal-content">
				<div class="modal-header">
					<h5 class="modal-title" id="racks-modal-title">Update Marital Status</h5>
					<button type="button" class="close" data-dismiss="modal" aria-label="Close">
						<span aria-hidden="true">&times;</span>
					</button>
				</div>
				<div class="modal-body">
					<form id="maritalStatusForm" class="form">
						<div class="form-group">
							<label for="marital_status">Marital Status</label>
							<select class="form-control" name="marital_status" id="marital_status" onchange="change_married_date_input()">
								<option disabled selected>Please Select Marital Status</option>
								<?php if (!empty($latest_profile->marital_status)): ?>
									<option value="1" <?php echo ($latest_profile->marital_status == 1)?'selected':''; ?>>Single</option>
									<option value="2" <?php echo ($latest_profile->marital_status == 2)?'selected':''; ?>>Married</option>
									<option value="3" <?php echo ($latest_profile->marital_status == 3)?'selected':''; ?>>Divorce</option>
								<?php else: ?>
									<option value="1">Single</option>
									<option value="2">Married</option>
									<option value="3">Divorce</option>
								<?php endif ?>
							</select>
						</div>
						<div class="form-group">
							<label>Married Date</label>
							<input class="datepicker form-control" name="married_date" id="married_date">
						</div>
					</form>
				</div>
				<div class="modal-footer">
					<div class="btn-group float-right">
						<button type="button" class="btn btn-light" data-dismiss="modal">Cancel</button>
						<button type="button" id="saveMaritalStatusButton" onclick="saveMaritalStatus();" class="btn btn-primary">Save</button>
					</div>
				</div>
			</div>
		</div>
	</div>

	<!-- Modal Email -->
	<div class="modal fade" id="secondaryEmailModal">
		<div class="modal-dialog modal-lg">
			<div class="modal-content">
				<div class="modal-header">
					<h5 class="modal-title" id="racks-modal-title">Update Secondary Email</h5>
					<button type="button" class="close" data-dismiss="modal" aria-label="Close">
						<span aria-hidden="true">&times;</span>
					</button>
				</div>
				<div class="modal-body">
					<form id="secondaryEmailForm" class="form">
						<div class="form-group">
							<label for="secondary_email">Secondary Email</label>
							<input type="text" class="form-control" name="secondary_email" id="secondary_email" value="<?php echo (!empty($latest_profile->secondary_email))?$latest_profile->secondary_email:''; ?>" autocomplete="off">
						</div>
					</form>
				</div>
				<div class="modal-footer">
					<div class="btn-group float-right">
						<button type="button" class="btn btn-light" data-dismiss="modal">Cancel</button>
						<button type="button" id="saveSecondaryEmailButton" onclick="saveSecondaryEmail();" class="btn btn-primary">Save</button>
					</div>
				</div>
			</div>
		</div>
	</div>

	<!-- Modal Phone -->
	<div class="modal fade" id="updatePhoneModal">
	    <div class="modal-dialog modal-lg">
	        <div class="modal-content">
	            <div class="modal-header">
	                <h5 class="modal-title" id="racks-modal-title">Update User's Mobile Number</h5>
	                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
	                    <span aria-hidden="true">&times;</span>
	                </button>
	            </div>
				<div class="modal-body">
					<form id="updatePhoneForm" class="form">
						<div class="form-group">
							<label for="user_phone_number">Mobile Number</label>
							<div class="input-group mb-3">
								<input type="text" class="form-control" name="user_phone_number" id="user_phone_number">
							</div>
						</div>
					</form>
				</div>
				<div class="modal-footer">
					<div class="btn-group float-right">
						<button type="button" class="btn btn-light" data-dismiss="modal">Cancel</button>
						<button type="button" onclick="updatePhone();" class="btn btn-primary">Save</button>
					</div>
				</div>
	        </div>
	    </div>
	</div>

	<!-- Modal Hobby -->
	<div class="modal fade" id="updateHobbyModal">
	    <div class="modal-dialog modal-lg">
	        <div class="modal-content">
	            <div class="modal-header">
	                <h5 class="modal-title" id="racks-modal-title">Update Hobby</h5>
	                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
	                    <span aria-hidden="true">&times;</span>
	                </button>
	            </div>
				<div class="modal-body">
					<form id="updateHobbyForm" class="form">
						<div class="form-group">
							<label for="user_hobby">Hobby</label>
							<div class="input-group mb-3">
								<input type="text" class="form-control" name="user_hobby" id="user_hobby">
							</div>
						</div>
					</form>
				</div>
				<div class="modal-footer">
					<div class="btn-group float-right">
						<button type="button" class="btn btn-light" data-dismiss="modal">Cancel</button>
						<button type="button" onclick="updateHobby();" class="btn btn-primary">Save</button>
					</div>
				</div>
	        </div>
	    </div>
	</div>

	<script type="text/javascript">
		function editMaritalStatus(id)
		{
			var profiling_id = id;

			$.ajax({
				type: 'POST',
				url: '<?php echo base_url('hr/Myprofile/getMaritalStatus'); ?>',
				data: {
					'profiling_id' : profiling_id
				},
				dataType: 'JSON',
				success: function(data) {
					if ($.trim(data.status) == "success")
					{
						var maritalStatusData = data.maritalStatus;

						if(maritalStatusData[0]['married_date'] != '' && maritalStatusData[0]['married_date'] != '0000-00-00' && maritalStatusData[0]['married_date'] != null)
						{
							var maritalDate = moment(maritalStatusData[0]['married_date']).format('DD-MM-YYYY');
						}else{
							var maritalDate = '';
						}

						$("#marital_status").val(maritalStatusData[0]['marital_status']);
						$("#married_date").val(maritalDate);
					}
				}
			});

			$('#maritalStatusModal').find('#racks-modal-title').text('Update Marital Status');
			$('#saveMaritalStatusButton').attr('onclick', 'saveMaritalStatus()');
			$('#maritalStatusModal').modal('show');
		}

		function editSecondaryEmail(id)
		{
			var profiling_id = id;

			$.ajax({
				type: 'POST',
				url: '<?php echo base_url('hr/Myprofile/getSecondaryEmail'); ?>',
				data: {
					'profiling_id' : profiling_id
				},
				dataType: 'JSON',
				success: function(data) {
					if ($.trim(data.status) == "success")
					{
						var secondaryEmailData = data.secondaryEmail;

						$("#secondary_email").val(secondaryEmailData[0]['secondary_email']);
					}
				}
			});

			$('#secondaryEmailModal').find('#racks-modal-title').text('Update Secondary Email');
			$('#saveSecondaryEmailButton').attr('onclick', 'saveSecondaryEmail()');
			$('#secondaryEmailModal').modal('show');
		}

		function saveSecondaryEmail()
		{
			var postData = {
				'profiling_id' 		: $("#profiling_id_new").val(),
				'secondary_email' 	: $("#secondary_email").val()
			};

			$.ajax({
				type: 'POST',
				url: '<?php echo base_url('hr/Myprofile/save_secondary_email'); ?>',
				data: postData,
				dataType: 'JSON',
				success: function(data) {
					if(data.status == 'success')
					{
						localStorage.setItem("status",data.status);
						localStorage.setItem("msg",data.msg);

						location.replace(data.redirect);
					}
				}
			});
		}

		function saveMaritalStatus()
		{
			$('#saveMaritalStatusButton').addClass("btn-progress");
			$('#saveMaritalStatusButton').prop('disabled', true);
			
			var postData = {
				'profiling_id' 		: $("#profiling_id_new").val(),
				'marital_status' 	: $("#marital_status").val(),
				'married_date' 		: $("#married_date").val()
			};

			$.ajax({
				type: 'POST',
				url: '<?php echo base_url('hr/Myprofile/save_marital_status'); ?>',
				data: postData,
				dataType: 'JSON',
				success: function(data) {
					if(data.status == 'success')
					{
						localStorage.setItem("status",data.status);
						localStorage.setItem("msg",data.msg);

						location.replace(data.redirect);
					}
				}
			});
		}

		function change_married_date_input()
		{
			var status = $('#marital_status').val();
			{
				if(status == 1)
				{
					$('#married_date').val('');
				}
			}
		}

		function submit_update_profile(elem)
		{
			var postData = {
				'staff_id' 		: $(elem).data('staffid'),
				'date' 			: $(elem).data('date'),
			};

			$.ajax({
				type: 'POST',
				url: '<?php echo base_url('hr/Myprofile/submit_update_profile'); ?>',
				data: postData,
				dataType: 'JSON',
				success: function(data) {
					if(data.status == 'success')
					{
						localStorage.setItem("status",data.status);
						localStorage.setItem("msg",data.msg);

						location.replace(data.redirect);
					}
				}
			});
		}

		function openPhone()
		{
			var phone_no = $('#phone_number').val();
			clearForm('#updatePhoneForm');

			$('#updatePhoneModal').modal('show');
			if(phone_no != 'N/A')
			{
				$('#user_phone_number').val(phone_no);
			}	
		}

		function updatePhone()
		{
			validateForm("#updatePhoneForm", "Are you sure you want to update phone number?", function(){
				var update_data = {
					'profiling_id' 		: $("#profiling_id_new").val(),
					'phone' 			: $('#user_phone_number').val(),
				};
				
				$.ajax({
					url: "<?php echo base_url('hr/Myprofile/save_phone'); ?>",
					type: "POST",
					data: update_data,
					dataType: "JSON",
					success: function(data) {
						if(data.status == 'success')
						{
							localStorage.setItem("status",data.status);
							localStorage.setItem("msg",data.msg);

							location.replace(data.redirect);
						}
					}
				});
			});
		}

		function openHobby()
		{
			var phone_no = $('#hobby').val();
			clearForm('#updateHobbyForm');

			$('#updateHobbyModal').modal('show');
			if(phone_no != 'N/A')
			{
				$('#user_hobby').val(phone_no);
			}	
		}

		function updateHobby()
		{
			validateForm("#updateHobbyForm", "Are you sure you want to update Hobby?", function(){
				var update_data = {
					'profiling_id' 		: $("#profiling_id_new").val(),
					'hobby' 			: $('#user_hobby').val(),
				};
				
				$.ajax({
					url: "<?php echo base_url('hr/Myprofile/save_hobby'); ?>",
					type: "POST",
					data: update_data,
					dataType: "JSON",
					success: function(data) {
						if(data.status == 'success')
						{
							localStorage.setItem("status",data.status);
							localStorage.setItem("msg",data.msg);

							location.replace(data.redirect);
						}
					}
				});
			});
		}
	</script>

	<?php if (($_SESSION['user']['id'] == $this->uri->segment(4))): ?>

		<section class="py-2 mb-3">
			<div class="row">
				<div class="col">
					<h3 class="display-6">Background Details</h3>
				</div>
			</div>
			<!-- tabs -->
			<div class="container">
				<div class="row mx-auto">
					<?php $this->load->view('hr/myprofile/list/components/tab/tab-address'); ?>
					<?php $this->load->view('hr/myprofile/list/components/tab/tab-family-info'); ?>
					<?php $this->load->view('hr/myprofile/list/components/tab/tab-academic-qualifications'); ?>
				</div>
			</div>
			<!-- tabs -->
			<!-- collapse area -->
			<?php $this->load->view('hr/myprofile/list/components/content/tab-segment-address'); ?>
			<?php $this->load->view('hr/myprofile/list/components/content/tab-segment-family-info'); ?>
			<?php $this->load->view('hr/myprofile/list/components/content/tab-segment-academic-qualification'); ?>
			<!-- collapse area -->
			<div class="container">
				<div class="row mx-auto">
					<!-- <?php //$this->load->view('hr/myprofile/list/components/tab/tab-additional-personal-data'); ?> -->
					<?php $this->load->view('hr/myprofile/list/components/tab/tab-education-in-progress'); ?>
					<?php $this->load->view('hr/myprofile/list/components/tab/tab-emergency-contact'); ?>
				</div>
			</div>
			<!-- <?php //$this->load->view('hr/myprofile/list/components/content/tab-segment-additional-personal-data'); ?> -->
			<?php $this->load->view('hr/myprofile/list/components/content/tab-segment-education-in-progress'); ?>
			<?php $this->load->view('hr/myprofile/list/components/content/tab-segment-emergency-contact'); ?>
		</section>

		<section class="py-2 mb-3">
			<div class="row">
				<div class="col">
					<h3 class="display-6">Professional Details</h3>
				</div>
			</div>
			<!-- pofessional row one -->
			<!-- tab -->
			<!-- <div class="container"> -->
			<!-- <div class="row mx-auto"> -->
			<!-- <?php //$this->load->view('hr/myprofile/list/components/tab/tab-employment-detail'); ?> -->
			<!-- <?php //$this->load->view('hr/myprofile/list/components/tab/tab-previous-employment-details'); ?> -->
			<!-- <?php //$this->load->view('hr/myprofile/list/components/tab/tab-contract-element'); ?> -->
			<!-- </div> -->
			<!-- </div> -->
			<!-- !tab -->
			<!-- collapse area-->
			<!-- <?php //$this->load->view('hr/myprofile/list/components/content/tab-segment-employment-detail'); ?> -->
			<!-- <?php //$this->load->view('hr/myprofile/list/components/content/tab-segment-previous-employment-details'); ?> -->
			<!-- <?php //$this->load->view('hr/myprofile/list/components/content/tab-segment-contract-element'); ?> -->
			<!-- collapse area-->
			<!-- !professional row one -->

			<!-- professional row two -->
			<!-- tab -->
			<div class="container">
				<div class="row mx-auto">
					<!-- <?php //$this->load->view('hr/myprofile/list/components/tab/tab-recognition'); ?> -->
					<?php $this->load->view('hr/myprofile/list/components/tab/tab-professional-membership'); ?>
					<?php $this->load->view('hr/myprofile/list/components/tab/tab-professional-license'); ?>
					<?php $this->load->view('hr/myprofile/list/components/tab/tab-professional-education'); ?>
				</div>
			</div>
			<!-- !tab -->
			<!-- collapse area -->
			<!-- <?php //$this->load->view('hr/myprofile/list/components/content/tab-segment-recognition'); ?> -->
			<?php $this->load->view('hr/myprofile/list/components/content/tab-segment-professional-membership'); ?>
			<?php $this->load->view('hr/myprofile/list/components/content/tab-segment-professional-license'); ?>
			<?php $this->load->view('hr/myprofile/list/components/content/tab-segment-professional-education'); ?>
			<!-- !collapse area -->
			<!-- !professional row two -->

			<!-- professional row three -->
			<!-- tab -->
			<div class="container">
				<div class="row mx-auto">
					<?php $this->load->view('hr/myprofile/list/components/tab/tab-professional-certificate'); ?>
					<?php $this->load->view('hr/myprofile/list/components/tab/tab-professional-experiencemgs'); ?>
				</div>
			</div>
			<!-- !tab -->
			<!-- collapse area -->
			<?php $this->load->view('hr/myprofile/list/components/content/tab-segment-professional-certificate'); ?>
			<?php $this->load->view('hr/myprofile/list/components/content/tab-segment-professional-experiencemgs'); ?>
			<!-- !collapse area -->
			<!-- !professional row three -->
		</section>	

		<section class="py-2 mb-3">
			<div class="row">
				<div class="col">
					<h3 class="display-6">Financial Details</h3>
				</div>
			</div>

			<!-- <div class="container"> -->
			<!-- <div class="row mx-auto"> -->
			<!-- <?php //$this->load->view('hr/myprofile/list/components/tab/tab-basic-pay'); ?> -->
			<!-- <?php //$this->load->view('hr/myprofile/list/components/tab/tab-bank-details'); ?> -->
			<!-- </div> -->
			<!-- </div> -->

			<!-- <?php //$this->load->view('hr/myprofile/list/components/content/tab-segment-basic-pay'); ?> -->
			<!-- <?php //$this->load->view('hr/myprofile/list/components/content/tab-segment-bank-details'); ?> -->


			<div class="container">
				<div class="row mx-auto">
					<?php $this->load->view('hr/myprofile/list/components/tab/tab-statutory-details'); ?>
					<!-- <?php //$this->load->view('hr/myprofile/list/components/tab/tab-recurring-pay-and-deduct'); ?> -->
					<?php $this->load->view('hr/myprofile/list/components/tab/tab-third-party-payment'); ?>
					<?php $this->load->view('hr/myprofile/list/components/tab/tab-pcb-consideration'); ?>
				</div>
			</div>
			<?php $this->load->view('hr/myprofile/list/components/content/tab-segment-statutory-details'); ?>

			<!-- <?php //$this->load->view('hr/myprofile/list/components/content/tab-segment-recurring-pay-deduct'); ?> -->
			<?php $this->load->view('hr/myprofile/list/components/content/tab-segment-third-party-payment'); ?>
			<?php $this->load->view('hr/myprofile/list/components/content/tab-segment-pcb-consideration'); ?>
		</section>

	<?php endif; ?>
</div>

<?php $this->load->view('hr/myprofile/list/scripts/tabcolor'); ?>
<script type="text/javascript">
	$(document).ready(function() {
	    $('#table_update_profile_checklist_top').DataTable().destroy();
	});
</script>