<div class="container">

	<section style="padding-top: 1rem; padding-bottom: 1rem;">
		<div class="row float-right">
			<?php if($this->session->userdata('user')['id'] == $staff_id){ ?>
				<a href="<?php echo base_url('hr/myprofile/staffDetail/'.$this->session->userdata('user')['id']); ?>" title="Update Personal Profile" class="btn btn-secondary" target="_blank" style="margin-right: 5px;">
					<i class="fa fa-edit"></i><br>Update Profile
				</a>
			<?php } ?>
			<a href="<?php echo base_url('hr/StaffProfile/actionReport/'.$staff_id); ?>" class="btn btn-secondary" target="_blank">
				<i class="fa fa-print"></i><br>Print
			</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" 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" 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" 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" 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" 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" 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_phone" 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_phone" 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_email" 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>
									<input type="text" class="form-control form-control-sm" 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_email" 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" 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" 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" 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" 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" 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>
									<button type="button" class="btn btn-default btn-sm d-print-none" onclick="openExt();" data-trigger="hover" data-tooltip="tooltip" title="Edit Extension Number">
										<i class="fa fa-edit" style="color: #F0AD4E;"></i>
									</button>
									<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>
									<select type="text" id="main_status" 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>
									<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>

	<?php if (($_SESSION['user']['id'] == $this->uri->segment(4)) || ($_SESSION['module_data']['role'] == 'admin')): ?>
	<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/staff-profiling/page/list/components/tab/tab-address'); ?>
				<?php $this->load->view('hr/staff-profiling/page/list/components/tab/tab-family-info'); ?>
				<?php $this->load->view('hr/staff-profiling/page/list/components/tab/tab-academic-qualifications'); ?>
			</div>
		</div>
		<!-- tabs -->
		<!-- collapse area -->
			<?php $this->load->view('hr/staff-profiling/page/list/components/content/tab-segment-address'); ?>
			<?php $this->load->view('hr/staff-profiling/page/list/components/content/tab-segment-family-info'); ?>
			<?php $this->load->view('hr/staff-profiling/page/list/components/content/tab-segment-academic-qualification'); ?>
		<!-- collapse area -->
		<div class="container">
			<div class="row mx-auto">
				<?php $this->load->view('hr/staff-profiling/page/list/components/tab/tab-education-in-progress'); ?>
				<?php $this->load->view('hr/staff-profiling/page/list/components/tab/tab-emergency-contact'); ?>
				<?php $this->load->view('hr/staff-profiling/page/list/components/tab/tab-additional-personal-data'); ?>
			</div>
		</div>
		<?php $this->load->view('hr/staff-profiling/page/list/components/content/tab-segment-education-in-progress'); ?>
		<?php $this->load->view('hr/staff-profiling/page/list/components/content/tab-segment-emergency-contact'); ?>
		<?php $this->load->view('hr/staff-profiling/page/list/components/content/tab-segment-additional-personal-data'); ?>
	</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/staff-profiling/page/list/components/tab/tab-employment-detail'); ?>
					<?php $this->load->view('hr/staff-profiling/page/list/components/tab/tab-previous-employment-details'); ?>
					<?php $this->load->view('hr/staff-profiling/page/list/components/tab/tab-contract-element'); ?>
				</div>
			</div>
			<!-- !tab -->
			<!-- collapse area-->
				<?php $this->load->view('hr/staff-profiling/page/list/components/content/tab-segment-employment-detail'); ?>
				<?php $this->load->view('hr/staff-profiling/page/list/components/content/tab-segment-previous-employment-details'); ?>
				<?php $this->load->view('hr/staff-profiling/page/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/staff-profiling/page/list/components/tab/tab-recognition'); ?>
						<?php $this->load->view('hr/staff-profiling/page/list/components/tab/tab-professional-membership'); ?>
						<?php $this->load->view('hr/staff-profiling/page/list/components/tab/tab-professional-license'); ?>
					</div>
				</div>
			<!-- !tab -->
			<!-- collapse area -->
				<?php $this->load->view('hr/staff-profiling/page/list/components/content/tab-segment-recognition'); ?>
				<?php $this->load->view('hr/staff-profiling/page/list/components/content/tab-segment-professional-membership'); ?>
				<?php $this->load->view('hr/staff-profiling/page/list/components/content/tab-segment-professional-license'); ?>
			<!-- !collapse area -->
		<!-- !professional row two -->

		<!-- professional row three -->
			<!-- tab -->
				<div class="container">
					<div class="row mx-auto">
						<?php $this->load->view('hr/staff-profiling/page/list/components/tab/tab-professional-education'); ?>
						<?php $this->load->view('hr/staff-profiling/page/list/components/tab/tab-professional-certificate'); ?>
						<?php $this->load->view('hr/staff-profiling/page/list/components/tab/tab-professional-experiencemgs'); ?>
					</div>
				</div>
			<!-- !tab -->
			<!-- collapse area -->
				<?php $this->load->view('hr/staff-profiling/page/list/components/content/tab-segment-professional-education'); ?>
				<?php $this->load->view('hr/staff-profiling/page/list/components/content/tab-segment-professional-certificate'); ?>
				<?php $this->load->view('hr/staff-profiling/page/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/staff-profiling/page/list/components/tab/tab-basic-pay'); ?>
				<?php $this->load->view('hr/staff-profiling/page/list/components/tab/tab-bank-details'); ?>
				<?php $this->load->view('hr/staff-profiling/page/list/components/tab/tab-statutory-details'); ?>	
			</div>
		</div>

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


		<div class="container">
			<div class="row mx-auto">
				<?php $this->load->view('hr/staff-profiling/page/list/components/tab/tab-recurring-pay-and-deduct'); ?>
				<?php $this->load->view('hr/staff-profiling/page/list/components/tab/tab-third-party-payment'); ?>
				<?php $this->load->view('hr/staff-profiling/page/list/components/tab/tab-pcb-consideration'); ?>
			</div>
		</div>

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

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

		<div class="container">
			<div class="row mx-auto">
				<?php $this->load->view('hr/staff-profiling/page/list/components/tab/tab-attachment'); ?>
			</div>
		</div>

		<?php $this->load->view('hr/staff-profiling/page/list/components/content/tab-segment-attachment'); ?>
	</section>

	<section class="py-2 mb-3 d-none d-lg-block">
		<div class="row">
			<div class="col">
				<h3 class="display-6">Actions Type</h3>
			</div>
		</div>
		<?php $this->load->view('hr/staff-profiling/page/list/components/timeline'); ?>
	</section>
	<?php endif ?>
</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 Extension -->
<div class="modal fade" id="updateExtModal">
    <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 Extension 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="updateExtForm" class="form">
					<div class="form-group">
						<label for="user_ext_number">Mobile Number</label>
						<div class="input-group mb-3">
							<input type="text" class="form-control" name="user_ext_number" id="user_ext_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="updateExt();" class="btn btn-primary">Save</button>
				</div>
			</div>
        </div>
    </div>
</div>

<!-- script -->
<?php $this->load->view('hr/staff-profiling/script/general'); ?>
<?php $this->load->view('hr/staff-profiling/page/list/scripts/tabcolor'); ?>

<?php if ($role == 'admin'): ?>
	<?php $this->load->view('hr/staff-profiling/page/list/scripts/tab-action'); ?>
	<?php $this->load->view('hr/staff-profiling/page/list/scripts/tab-professional-licenses');  ?>
	<?php $this->load->view('hr/staff-profiling/page/list/scripts/tab-addresses');  ?>
	<?php $this->load->view('hr/staff-profiling/page/list/scripts/tab-family-info');  ?>
	<?php $this->load->view('hr/staff-profiling/page/list/scripts/tab-academic-qualification');  ?>
	<?php $this->load->view('hr/staff-profiling/page/list/scripts/tab-professional-membership');  ?>
	<?php $this->load->view('hr/staff-profiling/page/list/scripts/tab-previous-employment-detail');  ?>
	<?php $this->load->view('hr/staff-profiling/page/list/scripts/tab-contract-element');  ?>
	<?php $this->load->view('hr/staff-profiling/page/list/scripts/tab-basic-pay');  ?>
	<?php $this->load->view('hr/staff-profiling/page/list/scripts/tab-bank-details');  ?>
	<?php $this->load->view('hr/staff-profiling/page/list/scripts/tab-statutory-details');  ?>
	<?php $this->load->view('hr/staff-profiling/page/list/scripts/tab-recurring-deduct');  ?>
	<?php $this->load->view('hr/staff-profiling/page/list/scripts/tab-third-party-payment');  ?>
	<?php $this->load->view('hr/staff-profiling/page/list/scripts/tab-recognition');  ?>
	<?php $this->load->view('hr/staff-profiling/page/list/scripts/tab-date-specification');  ?>
	<?php $this->load->view('hr/staff-profiling/page/list/scripts/tab-pcb-consideration');  ?>
	<?php $this->load->view('hr/staff-profiling/page/list/scripts/tab-personal-additional-data');  ?>

	<script>
		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' 		: '<?php echo (!empty($latest_profile->id))?$latest_profile->id:0; ?>',
					'user_id'			: '<?php echo $staff_id ?>',
					'phone' 			: $('#user_phone_number').val(),
				};
				
				$.ajax({
					url: "<?php echo base_url('hr/StaffProfile/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 openExt()
		{
			var ext_no = $('#ext_number').val();
			clearForm('#updateExtForm');

			$('#updateExtModal').modal('show');
			if(ext_no != 'N/A')
			{
				$('#user_ext_number').val(ext_no);
			}	
		}

		function updateExt()
		{
			validateForm("#updateExtForm", "Are you sure you want to update extension number?", function(){
				var update_data = {
					'profiling_id' 		: '<?php echo (!empty($latest_profile->id))?$latest_profile->id:0; ?>',
					'user_id'			: '<?php echo $staff_id ?>',
					'department_id'		: '<?php echo (!empty($join_groups[0]->personnel_area_id))?$join_groups[0]->personnel_area_id:0; ?>',
					'ext_no' 			: $('#user_ext_number').val(),
				};
				
				$.ajax({
					url: "<?php echo base_url('hr/StaffProfile/save_ext_no'); ?>",
					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 endif ?>