<?php
$active_sub_menu = 'hr-employment' ;
switch($employment_status){
	case 'Pending' :
		$active_menu = 'hr-letter-pending' ;
	break ;
	case 'Interview' :
		$active_menu = 'hr-letter-interview' ;
	break ;
	case 'Reschedule' :
		$active_menu = 'hr-letter-reschedule' ;
	break ;
	case 'Offer' :
		$active_menu = 'hr-letter-offer' ;
	break ;	
	case 'Confirmation' :
		$active_menu = 'hr-letter-confirmation' ;
	break ;	
	case 'Reject' :
		$active_menu = 'hr-letter-reject' ;
	break ;	
	case 'Terminate' :
		$active_menu = 'hr-letter-terminate' ;
	break ;
}

// echo $_SERVER["DOCUMENT_ROOT"];exit;
// update database
if (isset($type) && $type == 'edit' && $_POST['hide'] == 1 && $_POST['hide_select_worker'] == 'Local'){

	
	$array_other_details = array() ;

	// personal information
	$positionApplyText = escapeString($_POST['positionApplyText']) ;
	$nric = escapeString($_POST['nric']);
	$positionApplySelect = $_POST['positionApplySelect'] ;
	$expectedSalary = escapeString($_POST['expectedSalary']) ;
	$noticePeroid = escapeString($_POST['noticePeroid']) ;
	$referralName = escapeString($_POST['referralName']) ;
	$personal_name = escapeString($_POST['personal_name']) ;
	$personal_name_chinese = ($_POST['personal_name_chinese']) ;
	$personal_name_nickname = escapeString($_POST['personal_name_nickname']) ;
	$personal_dob = escapeString($_POST['personal_dob']) ;
	$personal_age = escapeString($_POST['personal_age']) ;
	$personal_email = escapeString($_POST['personal_email']) ;
	$personal_nationality = escapeString($_POST['personal_nationality']) ;
	$personal_religion = escapeString($_POST['personal_religion']) ;
	$personal_mobile = escapeString($_POST['personal_mobile']) ;
	$personal_home_tel = escapeString($_POST['personal_home_tel']) ;
	$personal_gender = escapeString($_POST['personal_gender']) ;// radio value male:female
	$personal_marital_status = escapeString($_POST['personal_marital_status']) ; // radio value single married ...
	$personal_lisence = escapeString($_POST['personal_lisence']) ; // radio value yes no
	$personal_lisence_class = escapeString($_POST['personal_lisence_class']) ; // only if personal lisence is yes
	$personal_permanent_address = escapeString($_POST['personal_permanent_address']) ;
	$personal_residential_address = escapeString($_POST['personal_residential_address']) ;

	// Family member
	$array_family_member = array();
	for ($i = 0; $i < 8; $i++) {
	    $array_family_member[] = array(
	        'name' => !empty($_POST['family_member_name'][$i]) ? $_POST['family_member_name'][$i] : '',
	        'age' => !empty($_POST['family_member_age'][$i]) ? $_POST['family_member_age'][$i] : '',
	        'occupation' => !empty($_POST['family_member_occupation'][$i]) ? $_POST['family_member_occupation'][$i] : '',
	        'relationship' => !empty($_POST['family_member_relationship'][$i]) ? $_POST['family_member_relationship'][$i] : '',
	        'company' => !empty($_POST['family_member_company'][$i]) ? $_POST['family_member_company'][$i] : ''
	    );
	}
	
	// education background
	$array_education_level = array();
	for ($i = 0; $i < 5; $i++) {
	    $array_education_level[] = array(
	        'schoolName' => !empty($_POST['education_name_school'][$i]) ? $_POST['education_name_school'][$i] : '',
	        'startYear' => !empty($_POST['education_start_year'][$i]) ? $_POST['education_start_year'][$i] : '',
	        'finishYear' => !empty($_POST['education_finish_year'][$i]) ? $_POST['education_finish_year'][$i] : '',
	        'grade' => !empty($_POST['education_grade'][$i]) ? $_POST['education_grade'][$i] : '',
	        'qualification' => !empty($_POST['education_qualification'][$i]) ? $_POST['education_qualification'][$i] : ''
	    );
	}

	// professional qualification
	$array_professional_qualification = array();
	for ($i = 0; $i < 5; $i++) {
	    $array_professional_qualification[] = array(
	        'qualification' => !empty($_POST['professional_qualification'][$i]) ? $_POST['professional_qualification'][$i] : '',
	        'accredited' => !empty($_POST['professional_accredited_by'][$i]) ? $_POST['professional_accredited_by'][$i] : '',
	        'startYear' => !empty($_POST['professional_qualification_start_year'][$i]) ? $_POST['professional_qualification_start_year'][$i] : '',
	        'finishYear' => !empty($_POST['professional_qualification_finish_year'][$i]) ? $_POST['professional_qualification_finish_year'][$i] : '',
	    );
	}

	// language proficiency
	$spoken_english = $_POST['spoken_english'];
	$written_english = $_POST['written_english'];
	$spoken_mandarin = $_POST['spoken_mandarin'];
	$written_mandarin = $_POST['written_mandarin'];
	$spoken_bm = $_POST['spoken_bm'];
	$written_bm = $_POST['written_bm'];
	$language_other_1=$_POST['language_other_1'];
	$spoken_other1 = $_POST['spoken_other1'];
	$written_other1 = $_POST['written_other1'];
	$language_other_2 = $_POST['language_other_2'];
	$spoken_other2 = $_POST['spoken_other2'];
	$written_other2 = $_POST['written_other2'];


	//REFERENCE DETAIL
	$array_reference = array();
	for ($i = 0; $i < 2; $i++) {
	    $array_reference[] = array(
	        'name' => !empty($_POST['references_name'][$i]) ? $_POST['references_name'][$i] : '',
	        'position' => !empty($_POST['references_position'][$i]) ? $_POST['references_position'][$i] : '',
	        'contact' => !empty($_POST['references_contacts'][$i]) ? $_POST['references_contacts'][$i] : '',
	        'year' => !empty($_POST['references_years'][$i]) ? $_POST['references_years'][$i] : '',
	    );
	}

	//employment history
	$currentCompanyName = $_POST['current_company_name'];
	$currentCompanyPosition = $_POST['current_position_name'];
	$currentCompanyAddress = $_POST['current_company_full_address'];
	$currentCompanyJoinDate = $_POST['current_company_join_date'];
	$currentCompanyLeftDate = $_POST['current_company_left_date'];
	$currentCompanySalary = $_POST['current_company_basic_salary'];
	$currentCompanyAllowance = $_POST['current_company_fix_allowance']; 
	$currentCompanyReason = $_POST['current_company_leave_reason'];


	//subsequent employment history
	$array_subsequent_employment = array() ;
	for ($i = 0; $i < 3; $i++) {
	    $array_subsequent_employment[] = array(
	        'name' => !empty($_POST['subsequent_company_name'][$i]) ? $_POST['subsequent_company_name'][$i] : '',
	        'position' => !empty($_POST['subsequent_position_name'][$i]) ? $_POST['subsequent_position_name'][$i] : '',
	        'joinDate' => !empty($_POST['subsequent_company_join_date'][$i]) ? $_POST['subsequent_company_join_date'][$i] : '',
	        'leftDate' => !empty($_POST['subsequent_company_left_date'][$i]) ? $_POST['subsequent_company_left_date'][$i] : '',
	        'salary' => !empty($_POST['subsequent_company_basic_salary'][$i]) ? $_POST['subsequent_company_basic_salary'][$i] : '',
	        'allowance' => !empty($_POST['subsequent_company_fix_allowance'][$i]) ? $_POST['subsequent_company_fix_allowance'][$i] : '',
	        'reason' => !empty($_POST['subsequent_company_leave_reason'][$i]) ? $_POST['subsequent_company_leave_reason'][$i] : '',
	    );
	}

	//other info
	$gambling = $_POST['gambling'];
	$smoking = $_POST['smoking'];
	$drug = $_POST['drug'];
	$drinking = $_POST['drinking'];

	$disability =$_POST['disability'];
	$disability_detail = ($_POST['disability'] == 'yes')?$_POST['disability_detail']:'';
	$medication = $_POST['medication'];
	$medication_detail = ($_POST['medication'] == 'yes')?$_POST['medication_detail']:'';
	$pregnancy = $_POST['pregnancy'];
	$pregnancy_detail = ($_POST['pregnancy'] == 'yes')?$_POST['pregnancy_detail']:'';
	$dismissed = $_POST['dismissed'];
	$dismissed_detail = ($_POST['dismissed'] == 'yes')?$_POST['dismissed_detail']:'';
	$court = $_POST['court'];
	$court_detail = ($_POST['court'] == 'yes')?$_POST['court_detail']:'';
	$finance = $_POST['finance'];
	$finance_detail = ($_POST['finance'] == 'yes')?$_POST['finance_detail']:'';
	$applied = $_POST['applied'];
	$applied_detail = ($_POST['applied'] == 'yes')?$_POST['applied_detail']:'';
	$dispute = $_POST['dispute'];
	$dispute_detail = ($_POST['dispute'] == 'yes')?$_POST['dispute_detail']:'';
	$other_job = $_POST['other_job'];
	$other_job_detail = ($_POST['other_job'] == 'yes')?$_POST['other_job_detail']:'';

	$willingToTransferWithrelocation = $_POST['relocation']; //yes no
	$willingToTransferWithoutrelocation = $_POST['without_relocation']; //yes no
	$bankruptcy = $_POST['bankruptcy'];
	$vehicle = $_POST['vehicle'];
	$overtime = $_POST['overtime'];
	$attract = $_POST['attract'];
	$career_plan = $_POST['career_plan'];


	// policy
	$privacy_name = $_POST['privacy_name'];
	$privacy_nric_number = $_POST['privacy_nric_number'];
	$privacy_date = $_POST['privacy_date'];


	//acknowledgement
	$acknowledgement_name = $_POST['acknowledgement_name'];
	$acknowledgement_nric_number = $_POST['acknowledgement_nric_number'];
	$acknowledgement_privacy_date = $_POST['acknowledgement_privacy_date'];

	// signature
	$acknowledgement_certify = escapeString($_POST['acknowledgement_certify']) ;
	$acknowledgement_authorize = escapeString($_POST['acknowledgement_authorize']) ;
	$acknowledgement_event = escapeString($_POST['acknowledgement_event']) ;
	
	// print_r($_POST['application_signature']);
	// echo "<br>";
	// print_r($_POST['application_signature_hidden']);exit;

	if ($_POST['application_signature'] != '' && $_POST['application_signature'] != $_POST['application_signature_hidden']) {
		// signature
		$application_signature = escapeString($_POST['application_signature']) ;
		$application_signature_date = TODAYDATE ;

		$image_name		= time().'-'.uniqid(count($application_signature));
		$sign_img_name 	= $image_name.'.jpg';

		$boolean_upload_signature = uploadImageBased64('Employment_Application', $sign_img_name, $application_signature);
		// $boolean_upload_signature = true;
		if($boolean_upload_signature == true){
			$signature_image_uploaded = '/uploads/Employment_Application/'.$sign_img_name;
		}else{
			$signature_image_uploaded = '';
		}
	}else{
		$user_details = jsonEncodeDecode('decode', $row_page['employment_details']) ;
		$application = $user_details['application'] ;
		if($application != ''){
			$application_signature = $application['signature'] ;
			$application_signature_date = $application['date'] ;
			$signature_image_uploaded = $application_signature;
		}else{
			$application_signature = escapeString($_POST['application_signature']) ;
			$application_signature_date = TODAYDATE ;
			$signature_image_uploaded = '';
		}
		

	}
	
	// if (strstr($application_signature, 'uploads')) {
	// 	$signature_image_uploaded = $application_signature;
	// 	// echo "aaa";
	// }else{
	// 	if ($application_signature != 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/4gIoSUNDX1BST0ZJTEUAAQEAAAIYAAAAAAQwAABtbnRyUkdCIFhZWiAAAAAAAAAAAAAAAABhY3NwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAA9tYAAQAAAADTLQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAlkZXNjAAAA8AAAAHRyWFlaAAABZAAAABRnWFlaAAABeAAAABRiWFlaAAABjAAAABRyVFJDAAABoAAAAChnVFJDAAABoAAAAChiVFJDAAABoAAAACh3dHB0AAAByAAAABRjcHJ0AAAB3AAAADxtbHVjAAAAAAAAAAEAAAAMZW5VUwAAAFgAAAAcAHMAUgBHAEIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFhZWiAAAAAAAABvogAAOPUAAAOQWFlaIAAAAAAAAGKZAAC3hQAAGNpYWVogAAAAAAAAJKAAAA+EAAC2z3BhcmEAAAAAAAQAAAACZmYAAPKnAAANWQAAE9AAAApbAAAAAAAAAABYWVogAAAAAAAA9tYAAQAAAADTLW1sdWMAAAAAAAAAAQAAAAxlblVTAAAAIAAAABwARwBvAG8AZwBsAGUAIABJAG4AYwAuACAAMgAwADEANv/bAEMAAwICAgICAwICAgMDAwMEBgQEBAQECAYGBQYJCAoKCQgJCQoMDwwKCw4LCQkNEQ0ODxAQERAKDBITEhATDxAQEP/bAEMBAwMDBAMECAQECBALCQsQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEP/AABEIAJYBXgMBIgACEQEDEQH/xAAVAAEBAAAAAAAAAAAAAAAAAAAACf/EABQQAQAAAAAAAAAAAAAAAAAAAAD/xAAUAQEAAAAAAAAAAAAAAAAAAAAA/8QAFBEBAAAAAAAAAAAAAAAAAAAAAP/aAAwDAQACEQMRAD8AqmAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD//2Q==' && $application_signature != '') {
			
	// 		$image_name		= time().'-'.uniqid(count($application_signature));
	// 		$sign_img_name 	= $image_name.'.jpg';

	// 		$boolean_upload_signature = uploadImageBased64('Employment_Application', $sign_img_name, $application_signature);
	// 		// $boolean_upload_signature = true;
	// 		if($boolean_upload_signature == true){
	// 			$signature_image_uploaded = '/uploads/Employment_Application/'.$sign_img_name;
	// 			// echo "bbb";
	// 		}else{
	// 			$signature_image_uploaded = '';
	// 			// echo "ccc";
	// 		}
	// 	}	
	// }

		// keep other value in array
		$array_other_details = [
				    // Personal Information
				    'positionApplyText' => $positionApplyText,
				    'expectedSalary' => $expectedSalary,
				    'noticePeriod' => $noticePeroid,
				    'referralName' => $referralName,
				    'nric' => $nric,
				    'personal_name' => $personal_name,
				    'personal_name_chinese' => $personal_name_chinese,
				    'personal_name_nickname' => $personal_name_nickname,
				    'personal_dob' => $personal_dob,
				    'personal_age' => $personal_age,
				    'personal_email' => $personal_email,
				    'personal_nationality' => $personal_nationality,
				    'personal_religion' => $personal_religion,
				    'personal_mobile' => $personal_mobile,
				    'personal_home_tel' => $personal_home_tel,
				    'personal_gender' => $personal_gender,
				    'personal_marital_status' => $personal_marital_status,
				    'personal_lisence' => $personal_lisence,
				    'personal_lisence_class' => $personal_lisence_class,
				    'personal_permanent_address' => $personal_permanent_address,
				    'personal_residential_address' => $personal_residential_address,

				    // Family Members
				    'family_members' => $array_family_member,

				    // Education Background
				    'education_levels' => $array_education_level,

				    // Professional Qualification
				    'professional_qualifications' => $array_professional_qualification,

				    // Language Proficiency
				    'language_proficiency' => [
				        'spoken_english' => $spoken_english,
				        'written_english' => $written_english,
				        'spoken_mandarin' => $spoken_mandarin,
				        'written_mandarin' => $written_mandarin,
				        'spoken_bm' => $spoken_bm,
				        'written_bm' => $written_bm,
				        'language_other_1'=>$language_other_1,
				        'spoken_other1' => $spoken_other1,
				        'written_other1' => $written_other1,
				        'language_other_2' => $language_other_2,
				        'spoken_other2' => $spoken_other2,
				        'written_other2' => $written_other2,
				    ],

				    // Reference Detail
				    'references' => $array_reference,

				    // Current Employment
				    'current_employment' => [
				        'company_name' => $currentCompanyName,
				        'position' => $currentCompanyPosition,
				        'address' => $currentCompanyAddress,
				        'join_date' => $currentCompanyJoinDate,
				        'left_date' => $currentCompanyLeftDate,
				        'salary' => $currentCompanySalary,
				        'allowance' => $currentCompanyAllowance,
				        'leave_reason' => $currentCompanyReason,
				    ],

				    // Subsequent Employment
				    'subsequent_employments' => $array_subsequent_employment,

				    // Other Info
				    'habits' => [
				        'gambling' => $gambling,
				        'smoking' => $smoking,
				        'drug' => $drug,
				        'drinking' => $drinking,
				    ],
				    'conditions' => [
				    	'disability' => $disability,
				        'disability_detail' => $disability_detail,
				        'medication' => $medication,
				        'medication_detail' => $medication_detail,
				        'pregnancy' => $pregnancy,
				        'pregnancy_detail' => $pregnancy_detail,
				        'dismissed' => $dismissed,
				        'dismissed_detail' => $dismissed_detail,
				        'court' => $court,
				        'court_detail' => $court_detail,
				        'finance' => $finance,
				        'finance_detail' => $finance_detail,
				        'applied' => $applied,
				        'applied_detail' => $applied_detail,
				        'dispute' => $dispute,
				        'dispute_detail' => $dispute_detail,
				        'other_job' => $other_job,
				        'other_job_detail' => $other_job_detail,
				    ],

				    'relocation' => [
				        'with' => $willingToTransferWithrelocation,
				        'without' => $willingToTransferWithoutrelocation,
				    ],

				    'vehicle' => $vehicle,
				    'overtime' => $overtime,
				    'attract' => $attract,
				    'career_plan' => $career_plan,

				    // Policy Consent
				    'privacy' => [
				        'name' => $privacy_name,
				        'nric' => $privacy_nric_number,
				        'date' => $privacy_date,
				    ],

				    // Acknowledgement
				    'acknowledgement' => [
				        'name' => $acknowledgement_name,
				        'nric' => $acknowledgement_nric_number,
				        'date' => $acknowledgement_privacy_date,
				    ],

				    'application' => [
						'signature' => $signature_image_uploaded,
						'date' => $application_signature_date
					],
				];

		$array_other_details = json_encode($array_other_details, JSON_UNESCAPED_UNICODE) ;

		//get old record for record
		$old_record = '';
		$mysqli_record = $mysqli->query("select employment_details from staff_employment where employment_id = '".$page."' limit 1");
		if ($mysqli_record->num_rows > 0 ){
			$old_record = $mysqli_record->fetch_array(MYSQLI_ASSOC)['employment_details'];
		}else{
			$old_record = '-';
		}
			
		
		// reset dob
		$personal_dob = date('Y-m-d', strtotime(str_replace('/', '-', $personal_dob))) ;
		

		if ($mysqli->query("UPDATE staff_employment SET
							".$query_trash."
							employment_user_id = '".$incharge_person."',
							employment_position = '".$positionApplySelect."',
							employment_call = '".$personal_name."',
							employment_name = '".$personal_name."',
							employment_nric = '".$nric."',
							employment_age = '".$personal_age."',
							employment_dob = '".$personal_dob."',
							employment_sex = '".$personal_gender."',
							employment_religion = '".$personal_religion."',
							employment_nationality = '".$personal_nationality."',
							employment_marital = '".$personal_marital."',
							employment_mobile = '".$personal_mobile."',
							employment_tel = '".$personal_home_tel."',
							employment_address = '".$personal_permanent_address."',
							employment_email = '".$personal_email."',
							employment_details = '".$array_other_details."',
							employment_status = '".$_POST['employment_status']."',
							employment_branch = '".$_SESSION['url_get_branch_admin']."',
							employment_modified = '".TODAYDATE."'
							WHERE employment_id = '".$page."'")){

			// check if user exists
			$mysqli_user = $mysqli->query("SELECT user_id FROM system_user
										   WHERE user_permission = 'employment' AND user_employment = '".$page."' LIMIT 1") ;
			$type_log = '';
			$descrition = $_SESSION['system_name'].'(username) ' ;

			if ( $mysqli_user->num_rows == 0 ){
				$mysqli->query("INSERT INTO system_user
								(user_permission, user_employment, user_date, user_trash) VALUES
								('employment', '".$page."', '".TODAYDATE."', '0')") ;
				$user_id  = $mysqli->insert_id ;
				$type_log = "insert";
				$descrition .= 'insert new application('.$user_id.')';
			}else{
				$row_user = $mysqli_user->fetch_assoc() ;
				$user_id  = $row_user['user_id'] ;
				$type_log = "update";
				$descrition .= 'update a application('.$user_id.')';				
			}		
			//save log 
			$record = array(
				"old_record" => $old_record,
				"new_record" => $array_other_details,
			);
			$record = jsonEncodeDecode('encode', $record) ;
			$mysqli->query("INSERT INTO system_log_employment
						(log_table, log_action, log_page_id, log_page_name, log_user_id, log_description, log_record, log_date) VALUES
						('employment', '".$type_log."', '200', 'AF-".$page."', '".$_SESSION["system_id"]."', '".$descrition."', '".$record."', NOW())");

			// update user 
			$mysqli->query("UPDATE system_user SET
							user_email    = '".$personal_email."',
							user_call     = '".$personal_name."',
							user_fullname = '".$personal_name."',
							user_modified = '".TODAYDATE."'
							WHERE user_id = '".$user_id."'") ;



			//////////////////////////////////////////////////////////////
			////////////////////upload image and resume///////////////////
			//////////////////////////////////////////////////////////////
			/*
			$create_image = reCreateImage('Employment', $page, $page, '', $personal_image, $personal_image_type, $_FILES['image']['tmp_name']) ;
			// Image uploads when exists
			if ($create_image['result'] && is_array($create_image['crop']) && count($create_image['result']) > 0){
				$resizeObj = new resize($create_image['original']) ; // Initialise load image
				foreach($create_image['crop'] as $value){
					// Resize image (options: exact, portrait, landscape, auto, crop)
					$resizeObj -> resizeImage($value['width'], $value['height'], $value['type']) ;
					$resizeObj -> saveImage($value['source'], 70) ; // Save image	
				}
				
				$file_upload = array('path' => PATH.'uploads/Employment/',
									 'file' => $create_image['image']) ;
				$file_upload = jsonEncodeDecode('encode', $file_upload) ;
				
				// update database
				if ($mysqli->query("UPDATE staff_employment SET
									employment_file = '".$file_upload."'
									WHERE employment_id = '".$page."'")){

				}
			}	


			//upload resume
			if ($resume_attached != '' && $resume_attached_tmp != '' && $resume_attached_type == 'application/pdf') {
				$newResumeFile = time().'-'.$resume_attached;
				$resume_attached_path = $_SERVER["DOCUMENT_ROOT"].'/uploads/Employment_Resume/';
				$boolean_upload_resume = move_uploaded_file($resume_attached_tmp, $resume_attached_path.$newResumeFile);

				if ($boolean_upload_resume) {
					$mysqli->query("UPDATE staff_employment SET employment_resume = '".$newResumeFile."' WHERE employment_id = '".$page."'");
				}
			}*/
	}

	// refresh page
	header("Location:?page_mode=edit&page=".$page."&success=1&select_worker=Local") ;
	exit ;
}

// start header here
include 'requires/page_header.php' ;

if ( $hide_title == false ){
	include 'requires/page_top.php' ;
}

// decode other variable
$array_other_details  = jsonEncodeDecode('decode', $row_page['employment_details']) ;
//$user_profile = jsonEncodeDecode('decode', $row_page['employment_file']) ;

// Flat values
$positionApplyText = $array_other_details['positionApplyText'];
$expectedSalary = $array_other_details['expectedSalary'];
$noticePeroid = $array_other_details['noticePeriod'];
$referralName = $array_other_details['referralName'];
$personal_name = $array_other_details['personal_name'];
$personal_name_chinese = $array_other_details['personal_name_chinese'];
$personal_name_nickname = $array_other_details['personal_name_nickname'];
$personal_dob = $array_other_details['personal_dob'];
$personal_age = $array_other_details['personal_age'];
$personal_email = $array_other_details['personal_email'];
$personal_nationality = $array_other_details['personal_nationality'];
$personal_religion = $array_other_details['personal_religion'];
$personal_mobile = $array_other_details['personal_mobile'];
$personal_home_tel = $array_other_details['personal_home_tel'];
$personal_gender = $array_other_details['personal_gender'];
$personal_marital_status = $array_other_details['personal_marital_status'];
$personal_lisence = $array_other_details['personal_lisence'];
$personal_lisence_class = $array_other_details['personal_lisence_class'];
$personal_permanent_address = $array_other_details['personal_permanent_address'];
$personal_residential_address = $array_other_details['personal_residential_address'];

// Arrays
$array_family_member = $array_other_details['family_members'];
$array_education_level = $array_other_details['education_levels'];
$array_professional_qualification = $array_other_details['professional_qualifications'];
$array_reference = $array_other_details['references'];
$array_subsequent_employment = $array_other_details['subsequent_employments'];

// Language proficiency
$spoken_english = $array_other_details['language_proficiency']['spoken_english'];
$written_english = $array_other_details['language_proficiency']['written_english'];
$spoken_mandarin = $array_other_details['language_proficiency']['spoken_mandarin'];
$written_mandarin = $array_other_details['language_proficiency']['written_mandarin'];
$spoken_bm = $array_other_details['language_proficiency']['spoken_bm'];
$written_bm = $array_other_details['language_proficiency']['written_bm'];
$language_other_1 = $array_other_details['language_proficiency']['language_other_1']; 
$spoken_other1 = $array_other_details['language_proficiency']['spoken_other1'];
$written_other1 = $array_other_details['language_proficiency']['written_other1'];
$language_other_2 = $array_other_details['language_proficiency']['language_other_2'];
$spoken_other2 = $array_other_details['language_proficiency']['spoken_other2'];
$written_other2 = $array_other_details['language_proficiency']['written_other2'];

// Current employment
$currentCompanyName = $array_other_details['current_employment']['company_name'];
$currentCompanyPosition = $array_other_details['current_employment']['position'];
$currentCompanyAddress = $array_other_details['current_employment']['address'];
$currentCompanyJoinDate = $array_other_details['current_employment']['join_date'];
$currentCompanyLeftDate = $array_other_details['current_employment']['left_date'];
$currentCompanySalary = $array_other_details['current_employment']['salary'];
$currentCompanyAllowance = $array_other_details['current_employment']['allowance'];
$currentCompanyReason = $array_other_details['current_employment']['leave_reason'];

// Habits
$gambling = $array_other_details['habits']['gambling'];
$smoking = $array_other_details['habits']['smoking'];
$drug = $array_other_details['habits']['drug'];
$drinking = $array_other_details['habits']['drinking'];

// Conditions
$disability = $array_other_details['conditions']['disability'];
$disability_detail = $array_other_details['conditions']['disability_detail'];
$medication = $array_other_details['conditions']['medication'];
$medication_detail = $array_other_details['conditions']['medication_detail'];
$pregnancy = $array_other_details['conditions']['pregnancy'];
$pregnancy_detail = $array_other_details['conditions']['pregnancy_detail'];
$dismissed = $array_other_details['conditions']['dismissed'];
$dismissed_detail = $array_other_details['conditions']['dismissed_detail'];
$court = $array_other_details['conditions']['court'];
$court_detail = $array_other_details['conditions']['court_detail'];
$finance = $array_other_details['conditions']['finance'];
$finance_detail = $array_other_details['conditions']['finance_detail'];
$applied = $array_other_details['conditions']['applied'];
$applied_detail = $array_other_details['conditions']['applied_detail'];
$dispute = $array_other_details['conditions']['dispute'];
$dispute_detail = $array_other_details['conditions']['dispute_detail'];
$other_job = $array_other_details['conditions']['other_job'];
$other_job_detail = $array_other_details['conditions']['other_job_detail'];

// Relocation
$willingToTransferWithrelocation = $array_other_details['relocation']['with'];
$willingToTransferWithoutrelocation = $array_other_details['relocation']['without'];

// Other
$vehicle = $array_other_details['vehicle'];
$overtime = $array_other_details['overtime'];
$attract = $array_other_details['attract'];
$career_plan = $array_other_details['career_plan'];

if ($row_page['employment_branch'] != $_SESSION['url_get_branch_admin']) {

	echo '
	<script>
	$(document).ready(function(){
		alert("Sorry, You don\'t have permission to access other branch\'s application forms.") ;
		window.open("hr-employment.php?page_mode=all&select_worker=Local&type='.strtolower($row_page['employment_status']).'","_self");
	}) ;
	</script>' ;
}

if ( $hide_title == true && $_GET['success'] == '1' ){
	echo '
	<script>
	$(document).ready(function(){
		alert("Thank you, you data has been submited.") ;
	}) ;
	</script>' ;
}
?>

<div class="warper container-fluid">
    <div class="row">
        <div class="col-md-12" style="position:inherit;">
                        <?php/* echo $letter_head['header'] ;*/?>
            <div class="panel panel-default">
                <div class="panel-heading"></div>
                <div class="panel-body">
                    <?php 
                    if ( $hide_title == false ){ 
                        $submit_link = 'hr-employment.php?page_mode=edit&page='.$_GET['page'].'&type=edit&select_worker=Local' ;
                    }else{
                        $submit_link = 'hr-application.php?page_mode=edit&page='.$_GET['page'].'&type=edit&select_worker=Local' ;
                    }
                    ?>

                    <form method="post" class="form-horizontal" id="quotationForm" enctype="multipart/form-data"
                        action="<?= $submit_link ?>" novalidate="novalidate">
                        <div class="container">
                            <table border="0" cellpadding="0" cellspacing="0" class="employment_table"
                                style="width:100%; padding:0; margin:0 auto;border-collapse: collapse; font-size: 16px;">
                                <tr>
                                    <td colspan="4">
                                        <?php if ( $hide_title == false ){ ?><div class="page-header">
                                            <h1><?= $lang['EMPLOYMENT APPLICATION FORM']?> <small><?= $lang['edit']?></small><a
                                                    href="online-form.php?branch=<?php echo $_SESSION['url_get_branch_admin']; ?>"
                                                    class="btn btn-purple" style="float:right; background-color:#5e5bd0 ;color:white">Online
                                                    Form</a></h1>
                                            </div>
                                        <?php } ?>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="4">&nbsp;</td>
                                </tr>
                                <tr>
                                    <td colspan="4">
                                        <table style="width:100%;" border="0" cellpadding="0" cellspacing="0">
                                            <tr>
                                                <td
                                                    style="width:100%;font-size:20px; padding:2px 0; text-align:center;background-color:#5e5bd0 ;color: white;">
                                                    <strong><?= $lang['EMPLOYMENT APPLICATION FORM']?></strong>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="4">&nbsp;</td>
                                </tr>
                                <tr>
                                    <td colspan="4" style="font-weight:bold; font-size:16px;">
                                        <table style="width: 100%;">
                                            <tr>
                                                <td style="width: 30%;">
                                                    <?= $lang['POSITION APPLIED FOR'] ?> :
                                                </td>
                                                <td>
                                                    <input value="<?=$positionApplyText?>" type="hidden" name="positionApplyText"
                                                        id="positionApplyText" />
                                                    <?php
                                                $mysqli_query = "SELECT a.job_position_id, b.job_position_desc FROM setting_job_position a
                                                LEFT JOIN setting_job_position_translation b ON ( a.job_position_id = b.job_position_id )
                                                WHERE a.deleted_at IS NULL AND b.lang = 'en' AND a.job_position_show_al = 'Show'
                                                ORDER BY b.job_position_desc ASC";

                                                $mysqli_position = $mysqli->query($mysqli_query);
                                                if ($mysqli_position->num_rows > 0) {
                                                    echo '
                                                    <select id="positionApplySelect" name="positionApplySelect" style="width: 100%;height: 100%">
                                                    <option value="">' . $lang['select'] . '</option>';
                                                    while ($row_position = $mysqli_position->fetch_array(MYSQLI_ASSOC)) {
														echo '<option value="'.$row_position['job_position_id'].'" '.(($row_position['job_position_id'] == $row_page['employment_position']) ? 'selected' : '').'>' . dataFilter($row_position['job_position_desc']) . '</option>';
                                                    }
                                                    echo '</select>';
                                                }
                                                ?>
                                                    <script>
                                                    const select = document.getElementById('positionApplySelect');
                                                    const input = document.getElementById('positionApplyText');
                                                    if (select && input) {
                                                        select.addEventListener('change', function() {
                                                            const selectedOption = this.options[this
                                                                .selectedIndex];
                                                            input.value = this.value ? selectedOption.text : '';
                                                        });
                                                    }
                                                    </script>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>

                                <tr>
                                    <td colspan="4" style="font-weight:bold; font-size:16px;">
                                        <table style="width: 100%;">
                                            <tr>
                                                <td style="width: 30%;"><?= $lang['EXPECTED SALARY'] ?> :</td>
                                                <td><input value="<?=$expectedSalary?>" name="expectedSalary" type="number" step="0.01" min="0"
                                                        placeholder="0.00" style="width: 100%;" /></td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>

                                <tr>
                                    <td colspan="4" style="font-weight:bold; font-size:16px;">
                                        <table style="width: 100%;">
                                            <tr>
                                                <td style="width: 30%;"><?= $lang['NOTICE PERIOD'] ?> :</td>
                                                <td><input value="<?=$noticePeroid?>" name="noticePeroid" type="number" min="0"
                                                        placeholder="<?= $lang['Days'] ?>" style="width: 100%;" /></td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>

                                <tr>
                                    <td colspan="4" style="font-weight:bold; font-size:16px;">
                                        <table style="width: 100%;">
                                            <tr>
                                                <td style="width: 30%;"><?= $lang['REFERRAL NAME (IF APPLICABLE)'] ?> :
                                                </td>
                                                <td><input value="<?=$referralName?>" name="referralName" type="text" style="width: 100%;" /></td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="4" style="font-weight:bold; font-size:16px;">
                                        <table style="width: 100%;">
                                            <tr>
                                                <td style="width: 30%;">NRIC (ONLY NUMBER) :
                                                </td>
                                                <td>
                                                	<input value="<?=$row_page['employment_nric']?>" name="nric" type="text" style="width: 100%;" />
                                                	<small style="color: gray;">without dash or space</small>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="4">&nbsp;</td>
                                </tr>
                                <tr>
                                    <td colspan="4">&nbsp;</td>
                                </tr>
                                <tr>
                                    <td>

                                        <div class="panel panel-primary" style="border: 2px solid #5e5bd0;">
                                            <div class="panel-heading"
                                                style="font-size:16px; background-color: #5e5bd0;color: white;">
                                                <?= $lang['PERSONAL INFORMATION'] ?>
                                            </div>
                                            <div class="panel-body"
                                                style="padding: 0;font-size: 16px;font-weight: bold;">

                                                <table class="table table-bordered" style="margin: 0;padding: 0;">

                                                    <!-- Full Name -->
                                                    <tr>
                                                        <td colspan="4">
                                                            <table style="width: 100%;">
                                                                <tr>
                                                                    <td colspan="2">
                                                                        <?= $lang['FULL NAME (AS PER NRIC)'] ?> :
                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td colspan="2"><input value="<?=$personal_name?>" name="personal_name"
                                                                            type="text" style="width: 100%;"></td>
                                                                </tr>
                                                            </table>
                                                        </td>
                                                    </tr>

                                                    <!-- Chinese & Nickname -->
                                                    <tr>
                                                        <td colspan="4">
                                                            <table style="width: 100%;">
                                                                <tr>
                                                                    <td>
                                                                        <?= $lang['NAME IN CHINESE CHARACTER (IF APPLICABLE)'] ?>
                                                                        :
                                                                    </td>
                                                                    <td>
                                                                        <?= $lang['NICKNAME'] ?> :
                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td><input value="<?=$personal_name_chinese?>" name="personal_name_chinese" type="text"
                                                                            style="width: 100%;"></td>
                                                                    <td><input value="<?=$personal_name_nickname?>" name="personal_name_nickname" type="text"
                                                                            style="width: 100%;"></td>
                                                                </tr>
                                                            </table>
                                                        </td>
                                                    </tr>

                                                    <!-- DOB, Age, Email -->
                                                    <tr>
                                                        <td colspan="4">
                                                            <table style="width: 100%;">
                                                                <tr>
                                                                    <td>
                                                                        <?= $lang['DATE OF BIRTH'] ?> :
                                                                    </td>
                                                                    <td>
                                                                        <?= $lang['AGE'] ?> :
                                                                    </td>
                                                                    <td style="width: 50%;">
                                                                        <?= $lang['EMAIL ADDRESS'] ?> :
                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td><input value="<?=$personal_dob?>" name="personal_dob"
                                                                            class="datetimepicker" type="text"
                                                                            style="width: 100%;"></td>
                                                                    <td><input value="<?=$personal_age?>" name="personal_age" type="number"
                                                                            style="width: 100%;"></td>
                                                                    <td><input value="<?=$personal_email?>" type="email" name="personal_email"
                                                                            style="width: 100%;" /></td>
                                                                </tr>
                                                            </table>
                                                        </td>
                                                    </tr>

                                                    <!-- Nationality & Religion -->
                                                    <tr>
                                                        <td colspan="4">
                                                            <table style="width: 100%;">
                                                                <tr>
                                                                    <td>
                                                                        <?= $lang['NATIONALITY'] ?> :
                                                                    </td>
                                                                    <td>
                                                                        <?= $lang['RELIGION'] ?> :
                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td><input value="<?=$personal_nationality?>" type="text" name="personal_nationality"
                                                                            style="width: 100%;" /></td>
                                                                    <td><input value="<?=$personal_religion?>" type="text" name="personal_religion"
                                                                            style="width: 100%;" /></td>
                                                                </tr>
                                                            </table>
                                                        </td>
                                                    </tr>

                                                    <!-- Mobile & Home Tel -->
                                                    <tr>
                                                        <td colspan="4">
                                                            <table style="width: 100%;">
                                                                <tr>
                                                                    <td>
                                                                        <?= $lang['MOBILE NO.'] ?> :
                                                                    </td>
                                                                    <td>
                                                                        <?= $lang['HOME TELEPHONE'] ?> :
                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td><input value="<?=$personal_mobile?>" type="text" name="personal_mobile"
                                                                            style="width: 100%;" /></td>
                                                                    <td><input value="<?=$personal_home_tel?>" type="text" name="personal_home_tel"
                                                                            style="width: 100%;" /></td>
                                                                </tr>
                                                            </table>
                                                        </td>
                                                    </tr>

                                                    <!-- Gender, Marital, License -->
                                                    <tr>
                                                        <td colspan="4">
                                                            <table style="width: 100%;">
                                                                <tr>
                                                                    <td style="width: 25%;">
                                                                        <?= $lang['GENDER'] ?> :
                                                                    </td>
                                                                    <td style="width: 25%;">
                                                                        <?= $lang['MARITAL STATUS'] ?> :
                                                                    </td>
                                                                    <td style="width: 50%;">
                                                                        <?= $lang['DRIVING LISENCE'] ?> :
                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td style="vertical-align: top;">
                                                                        <label><input type="radio" <?=($personal_gender=="male")?"checked":""?>
                                                                                name="personal_gender" value="male" />
                                                                            <?= $lang['MALE'] ?></label><br />
                                                                        <label><input type="radio" <?=($personal_gender=="female")?"checked":""?>
                                                                                name="personal_gender" value="female" />
                                                                            <?= $lang['FEMALE'] ?></label>
                                                                    </td>
                                                                    <td style="vertical-align: top;">
                                                                        <label><input type="radio" <?=($personal_marital_status=="single")?"checked":""?>
                                                                                name="personal_marital_status"
                                                                                value="single" />
                                                                            <?= $lang['SINGLE'] ?></label><br />
                                                                        <label><input type="radio" <?=($personal_marital_status=="married")?"checked":""?>
                                                                                name="personal_marital_status"
                                                                                value="married" />
                                                                            <?= $lang['MARRIED'] ?></label><br />
                                                                        <label><input type="radio" <?=($personal_marital_status=="divorced")?"checked":""?>
                                                                                name="personal_marital_status"
                                                                                value="divorced" />
                                                                            <?= $lang['DIVORCED'] ?></label><br />
                                                                        <label><input type="radio" <?=($personal_marital_status=="windowed")?"checked":""?>
                                                                                name="personal_marital_status"
                                                                                value="windowed" />
                                                                            <?= $lang['WINDOWED'] ?></label><br />
                                                                        <label><input type="radio" <?=($personal_marital_status=="seperated")?"checked":""?>
                                                                                name="personal_marital_status"
                                                                                value="seperated" />
                                                                            <?= $lang['SEPERATED'] ?></label>
                                                                    </td>
                                                                    <td style="vertical-align: top;">
                                                                        <div
                                                                            style="display: flex; align-items: center; gap: 10px; margin-bottom: 8px; margin-top: 8px;">
                                                                            <input type="radio" name="personal_lisence" <?=($personal_lisence=="yes")?"checked":""?> 
                                                                                id="radio_yes" value="yes" />
                                                                            <label for="radio_yes"
                                                                                style="margin: 0;"><?= $lang['YES'] ?></label>
                                                                            <span
                                                                                id="personal_lisence_class_title"><?= $lang['CLASS'] ?>:</span>
                                                                            <input type="text" value="<?=$personal_lisence_class?>" 
                                                                                name="personal_lisence_class"
                                                                                id="personal_lisence_class"
                                                                                style="height: 18px; font-size: 16px;">
                                                                        </div>
                                                                        <div
                                                                            style="display: flex; align-items: center; gap: 10px;">
                                                                            <input type="radio" name="personal_lisence" <?=($personal_lisence=="no")?"checked":""?> 
                                                                                id="radio_no" value="no" />
                                                                            <label for="radio_no"
                                                                                style="margin: 0;"><?= $lang['NO'] ?></label>
                                                                        </div>
                                                                    </td>
                                                                </tr>
                                                            </table>

                                                            <script>
                                                            const yesRadio = document.getElementById('radio_yes');
                                                            const noRadio = document.getElementById('radio_no');
                                                            const classInput = document.getElementById(
                                                                'personal_lisence_class');
                                                            const classTitle = document.getElementById(
                                                                'personal_lisence_class_title');

                                                            function toggleClassInput() {
                                                                if (yesRadio.checked) {
                                                                    classInput.style.display = 'inline-block';
                                                                    classTitle.style.display = 'inline-block';
                                                                } else {
                                                                    classInput.style.display = 'none';
                                                                    classTitle.style.display = 'none';
                                                                    classInput.value = '';
                                                                }
                                                            }

                                                            yesRadio.addEventListener('change', toggleClassInput);
                                                            noRadio.addEventListener('change', toggleClassInput);
                                                            toggleClassInput();
                                                            </script>
                                                        </td>
                                                    </tr>

                                                    <!-- Permanent Address -->
                                                    <tr>
                                                        <td colspan="4">
                                                            <table style="width: 100%;">
                                                                <tr>
                                                                    <td>
                                                                        <?= $lang['PERMANENT ADDRESS'] ?> :
                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td><input type="text" value="<?=$personal_permanent_address?>" 
                                                                            name="personal_permanent_address"
                                                                            style="width: 100%;" /></td>
                                                                </tr>
                                                            </table>
                                                        </td>
                                                    </tr>

                                                    <!-- Residential Address -->
                                                    <tr>
                                                        <td colspan="4">
                                                            <table style="width: 100%;">
                                                                <tr>
                                                                    <td>
                                                                        <?= $lang['RESIDENTIAL ADDRESS'] ?> :
                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td><input type="text" value="<?=$personal_residential_address?>"
                                                                            name="personal_residential_address"
                                                                            style="width: 100%;" /></td>
                                                                </tr>
                                                            </table>
                                                        </td>
                                                    </tr>

                                                </table>
                                            </div>
                                        </div>
                                    </td>
                                </tr>


                                <tr>
                                    <td colspan="4">&nbsp;</td>
                                </tr>
                                <tr>
                                    <td colspan="4">&nbsp;</td>
                                </tr>
                                <tr>
                                    <td>

                                        <div class="panel panel-primary" style="border: 2px solid #5e5bd0;">
                                            <div class="panel-heading"
                                                style="font-size:16px; background-color: #5e5bd0;color: white;">
                                                <?=$lang['FAMILY PARTICULARS']?>
                                            </div>
                                            <div class="panel-body" style="padding: 0;">

                                                <table border="0" cellpadding="0" cellspacing="0" width="100%"
                                                    style="font-size:16px;margin:0;border-bottom: 1px solid #000;border-right: 1px solid #000;">
                                                    <tr>
                                                        <th
                                                            style="padding:5px;border-top:1px solid #000;border-left:1px solid #000;">
                                                            <?= $lang['NAME']?></th>
                                                        <th
                                                            style="padding:5px;border-top:1px solid #000;border-left:1px solid #000;">
                                                            <?=$lang['RELATIONSHIP']?></th>
                                                        <th
                                                            style="padding:5px;border-top:1px solid #000;border-left:1px solid #000;">
                                                            <?=$lang['AGE']?></th>
                                                        <th
                                                            style="padding:5px;border-top:1px solid #000;border-left:1px solid #000;">
                                                            <?= $lang['OCCUPATION']?></th>
                                                        <th
                                                            style="padding:5px;border-top:1px solid #000;border-left:1px solid #000;">
                                                            <?= $lang['COMPANY NAME']?></th>
                                                    </tr>
                                                    <tr>
                                                        <td
                                                            style="border-top:1px solid #000;border-left:1px solid #000;">
                                                            <input type="text" name="family_member_name[0]" value="<?=$array_family_member[0]['name']?>"
                                                                style="margin:0;" />
                                                        </td>
                                                        <td
                                                            style="border-top:1px solid #000;border-left:1px solid #000;">
                                                            <input type="text" name="family_member_relationship[0]" value="<?=$array_family_member[0]['relationship']?>"
                                                                style="margin:0;" />
                                                        </td>
                                                        <td
                                                            style="border-top:1px solid #000;border-left:1px solid #000;">
                                                            <input type="text" name="family_member_age[0]" value="<?=$array_family_member[0]['age']?>"
                                                                style="margin:0;" />
                                                        </td>
                                                        <td
                                                            style="border-top:1px solid #000;border-left:1px solid #000;">
                                                            <input type="text" name="family_member_occupation[0]" value="<?=$array_family_member[0]['occupation']?>"
                                                                style="margin:0;" />
                                                        </td>
                                                        <td
                                                            style="border-top:1px solid #000;border-left:1px solid #000;">
                                                            <input type="text" name="family_member_company[0]" value="<?=$array_family_member[0]['company']?>"
                                                                style="margin:0;" />
                                                        </td>
                                                    </tr>

                                                    <tr>
                                                        <td
                                                            style="border-top:1px solid #000;border-left:1px solid #000;">
                                                            <input type="text" name="family_member_name[1]" value="<?=$array_family_member[1]['name']?>"
                                                                style="margin:0;" />
                                                        </td>
                                                        <td
                                                            style="border-top:1px solid #000;border-left:1px solid #000;">
                                                            <input type="text" name="family_member_relationship[1]" value="<?=$array_family_member[1]['relationship']?>"
                                                                style="margin:0;" />
                                                        </td>
                                                        <td
                                                            style="border-top:1px solid #000;border-left:1px solid #000;">
                                                            <input type="text" name="family_member_age[1]" value="<?=$array_family_member[1]['age']?>"
                                                                style="margin:0;" />
                                                        </td>
                                                        <td
                                                            style="border-top:1px solid #000;border-left:1px solid #000;">
                                                            <input type="text" name="family_member_occupation[1]" value="<?=$array_family_member[1]['occupation']?>"
                                                                style="margin:0;" />
                                                        </td>
                                                        <td
                                                            style="border-top:1px solid #000;border-left:1px solid #000;">
                                                            <input type="text" name="family_member_company[1]" value="<?=$array_family_member[1]['company']?>"
                                                                style="margin:0;" />
                                                        </td>
                                                    </tr>

                                                    <tr>
                                                        <td
                                                            style="border-top:1px solid #000;border-left:1px solid #000;">
                                                            <input type="text" name="family_member_name[2]" value="<?=$array_family_member[2]['name']?>"
                                                                style="margin:0;" />
                                                        </td>
                                                        <td
                                                            style="border-top:1px solid #000;border-left:1px solid #000;">
                                                            <input type="text" name="family_member_relationship[2]" value="<?=$array_family_member[2]['relationship']?>"
                                                                style="margin:0;" />
                                                        </td>
                                                        <td
                                                            style="border-top:1px solid #000;border-left:1px solid #000;">
                                                            <input type="text" name="family_member_age[2]" value="<?=$array_family_member[2]['age']?>"
                                                                style="margin:0;" />
                                                        </td>
                                                        <td
                                                            style="border-top:1px solid #000;border-left:1px solid #000;">
                                                            <input type="text" name="family_member_occupation[2]" value="<?=$array_family_member[2]['occupation']?>"
                                                                style="margin:0;" />
                                                        </td>
                                                        <td
                                                            style="border-top:1px solid #000;border-left:1px solid #000;">
                                                            <input type="text" name="family_member_company[2]" value="<?=$array_family_member[2]['company']?>"
                                                                style="margin:0;" />
                                                        </td>
                                                    </tr>

                                                    <tr>
                                                        <td
                                                            style="border-top:1px solid #000;border-left:1px solid #000;">
                                                            <input type="text" name="family_member_name[3]" value="<?=$array_family_member[3]['name']?>"
                                                                style="margin:0;" />
                                                        </td>
                                                        <td
                                                            style="border-top:1px solid #000;border-left:1px solid #000;">
                                                            <input type="text" name="family_member_relationship[3]" value="<?=$array_family_member[3]['relationship']?>"
                                                                style="margin:0;" />
                                                        </td>
                                                        <td
                                                            style="border-top:1px solid #000;border-left:1px solid #000;">
                                                            <input type="text" name="family_member_age[3]" value="<?=$array_family_member[3]['age']?>"
                                                                style="margin:0;" />
                                                        </td>
                                                        <td
                                                            style="border-top:1px solid #000;border-left:1px solid #000;">
                                                            <input type="text" name="family_member_occupation[3]" value="<?=$array_family_member[3]['occupation']?>"
                                                                style="margin:0;" />
                                                        </td>
                                                        <td
                                                            style="border-top:1px solid #000;border-left:1px solid #000;">
                                                            <input type="text" name="family_member_company[3]" value="<?=$array_family_member[3]['company']?>"
                                                                style="margin:0;" />
                                                        </td>
                                                    </tr>

                                                    <tr>
                                                        <td
                                                            style="border-top:1px solid #000;border-left:1px solid #000;">
                                                            <input type="text" name="family_member_name[4]" value="<?=$array_family_member[4]['name']?>"
                                                                style="margin:0;" />
                                                        </td>
                                                        <td
                                                            style="border-top:1px solid #000;border-left:1px solid #000;">
                                                            <input type="text" name="family_member_relationship[4]" value="<?=$array_family_member[4]['relationship']?>"
                                                                style="margin:0;" />
                                                        </td>
                                                        <td
                                                            style="border-top:1px solid #000;border-left:1px solid #000;">
                                                            <input type="text" name="family_member_age[4]" value="<?=$array_family_member[4]['age']?>"
                                                                style="margin:0;" />
                                                        </td>
                                                        <td
                                                            style="border-top:1px solid #000;border-left:1px solid #000;">
                                                            <input type="text" name="family_member_occupation[4]" value="<?=$array_family_member[4]['occupation']?>"
                                                                style="margin:0;" />
                                                        </td>
                                                        <td
                                                            style="border-top:1px solid #000;border-left:1px solid #000;">
                                                            <input type="text" name="family_member_company[4]" value="<?=$array_family_member[4]['company']?>"
                                                                style="margin:0;" />
                                                        </td>
                                                    </tr>

                                                    <tr>
                                                        <td
                                                            style="border-top:1px solid #000;border-left:1px solid #000;">
                                                            <input type="text" name="family_member_name[5]" value="<?=$array_family_member[5]['name']?>"
                                                                style="margin:0;" />
                                                        </td>
                                                        <td
                                                            style="border-top:1px solid #000;border-left:1px solid #000;">
                                                            <input type="text" name="family_member_relationship[5]" value="<?=$array_family_member[5]['relationship']?>"
                                                                style="margin:0;" />
                                                        </td>
                                                        <td
                                                            style="border-top:1px solid #000;border-left:1px solid #000;">
                                                            <input type="text" name="family_member_age[5]" value="<?=$array_family_member[5]['age']?>"
                                                                style="margin:0;" />
                                                        </td>
                                                        <td
                                                            style="border-top:1px solid #000;border-left:1px solid #000;">
                                                            <input type="text" name="family_member_occupation[5]" value="<?=$array_family_member[5]['occupation']?>"
                                                                style="margin:0;" />
                                                        </td>
                                                        <td
                                                            style="border-top:1px solid #000;border-left:1px solid #000;">
                                                            <input type="text" name="family_member_company[5]" value="<?=$array_family_member[5]['company']?>"
                                                                style="margin:0;" />
                                                        </td>
                                                    </tr>

                                                    <tr>
                                                        <td
                                                            style="border-top:1px solid #000;border-left:1px solid #000;">
                                                            <input type="text" name="family_member_name[6]" value="<?=$array_family_member[6]['name']?>"
                                                                style="margin:0;" />
                                                        </td>
                                                        <td
                                                            style="border-top:1px solid #000;border-left:1px solid #000;">
                                                            <input type="text" name="family_member_relationship[6]" value="<?=$array_family_member[6]['relationship']?>"
                                                                style="margin:0;" />
                                                        </td>
                                                        <td
                                                            style="border-top:1px solid #000;border-left:1px solid #000;">
                                                            <input type="text" name="family_member_age[6]" value="<?=$array_family_member[6]['age']?>"
                                                                style="margin:0;" />
                                                        </td>
                                                        <td
                                                            style="border-top:1px solid #000;border-left:1px solid #000;">
                                                            <input type="text" name="family_member_occupation[6]" value="<?=$array_family_member[6]['occupation']?>"
                                                                style="margin:0;" />
                                                        </td>
                                                        <td
                                                            style="border-top:1px solid #000;border-left:1px solid #000;">
                                                            <input type="text" name="family_member_company[6]" value="<?=$array_family_member[6]['company']?>"
                                                                style="margin:0;" />
                                                        </td>
                                                    </tr>

                                                    <tr>
                                                        <td
                                                            style="border-top:1px solid #000;border-left:1px solid #000;">
                                                            <input type="text" name="family_member_name[7]" value="<?=$array_family_member[7]['name']?>"
                                                                style="margin:0;" />
                                                        </td>
                                                        <td
                                                            style="border-top:1px solid #000;border-left:1px solid #000;">
                                                            <input type="text" name="family_member_relationship[7]" value="<?=$array_family_member[7]['relationship']?>"
                                                                style="margin:0;" />
                                                        </td>
                                                        <td
                                                            style="border-top:1px solid #000;border-left:1px solid #000;">
                                                            <input type="text" name="family_member_age[7]" value="<?=$array_family_member[7]['age']?>"
                                                                style="margin:0;" />
                                                        </td>
                                                        <td
                                                            style="border-top:1px solid #000;border-left:1px solid #000;">
                                                            <input type="text" name="family_member_occupation[7]" value="<?=$array_family_member[7]['occupation']?>"
                                                                style="margin:0;" />
                                                        </td>
                                                        <td
                                                            style="border-top:1px solid #000;border-left:1px solid #000;">
                                                            <input type="text" name="family_member_company[7]" value="<?=$array_family_member[7]['company']?>"
                                                                style="margin:0;" />
                                                        </td>
                                                    </tr>

                                                </table>
                                            </div>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="4">&nbsp;</td>
                                </tr>
                                <tr>
                                    <td colspan="4">&nbsp;</td>
                                </tr>
                                <tr>
                                    <td>

                                        <div class="panel panel-primary" style="border: 2px solid #5e5bd0;">
                                            <div class="panel-heading"
                                                style="font-size:16px; background-color: #5e5bd0;color: white;">
                                                <?= $lang['EDUCATIONAL LEVEL']?>
                                            </div>
                                            <div class="panel-body" style="padding: 0;">
                                                <table border="0" cellpadding="0" cellspacing="0" width="100%"
                                                    style="font-size:16px;border-bottom: 1px solid #000;border-right: 1px solid #000;">
                                                    <tr>
                                                        <th rowspan="2"
                                                            style="padding:5px;border-top:1px solid #000;border-left:1px solid #000;">
                                                            <?=$lang['QUALIFICATIONS']?></th>
                                                        <th rowspan="2"
                                                            style="padding:5px;border-top:1px solid #000;border-left:1px solid #000;">
                                                            <?= $lang['NAME OF SCHOOL / COLLEGE / UNIVERSITY']?></th>
                                                        <th width="130px"
                                                            style="padding:5px;border-top:1px solid #000;border-left:1px solid #000;text-align: center;">
                                                            <?=$lang['START']?>
                                                        </th>
                                                        <th width="130px"
                                                            style="padding:5px;border-top:1px solid #000;border-left:1px solid #000;text-align: center;">
                                                            <?=$lang['FINISH']?>
                                                        </th>
                                                        <th width="160px" rowspan="2"
                                                            style="padding:5px;border-top:1px solid #000;border-left:1px solid #000;">
                                                            <?=$lang['GRADE']?></th>
                                                    </tr>
                                                    <tr>
                                                        <th width="130px"
                                                            style="padding:5px;border-top:1px solid #000;border-left:1px solid #000;text-align: center;">
                                                            <?=$lang['(month/year)']?>
                                                        </th>
                                                        <th width="130px"
                                                            style="padding:5px;border-top:1px solid #000;border-left:1px solid #000;text-align: center;">
                                                            <?=$lang['(month/year)']?>
                                                        </th>
                                                    </tr>
                                                    <?php for ($i=0; $i<5; $i++){ ?>
                                                    <tr>
                                                        <td
                                                            style="border-top:1px solid #000;border-left:1px solid #000;">
                                                            <select name="education_qualification[<?=$i?>]"
                                                                style="max-width:470px;margin:0px;border:0px;">
                                                                <option value=""><?= $lang['select'] ?></option>
                                                                <option value="qua_below_pmr" <?=($array_education_level[$i]['qualification']=="qua_below_pmr")?'selected':''?>>Below PMR</option>
                                                                <option value="qua_pmr_pt3" <?=($array_education_level[$i]['qualification']=="qua_pmr_pt3")?'selected':''?>>PMR / PT3</option>
                                                                <option value="qua_spm" <?=($array_education_level[$i]['qualification']=="qua_spm")?'selected':''?>>SPM</option>
                                                                <option value="qua_certificate_skm_svm" <?=($array_education_level[$i]['qualification']=="qua_certificate_skm_svm")?'selected':''?>>Certificate/ SKM
                                                                    / SVM</option>
                                                                <option value="qua_alevel_uec" <?=($array_education_level[$i]['qualification']=="qua_alevel_uec")?'selected':''?>>A-Level / UEC</option>
                                                                <option value="qua_diploma" <?=($array_education_level[$i]['qualification']=="qua_diploma")?'selected':''?>>Diploma</option>
                                                                <option value="qua_degree" <?=($array_education_level[$i]['qualification']=="qua_degree")?'selected':''?>>Degree</option>
                                                                <option value="qua_master_degree" <?=($array_education_level[$i]['qualification']=="qua_master_degree")?'selected':''?>>Master Degree</option>
                                                                <option value="qua_phd" <?=($array_education_level[$i]['qualification']=="qua_phd")?'selected':''?>>PHD</option>
                                                            </select>
                                                        </td>

                                                        <td
                                                            style="border-top:1px solid #000;border-left:1px solid #000;">
                                                            <input type="text" name="education_name_school[<?=$i?>]" value="<?=$array_education_level[$i]['schoolName']?>"
                                                                style="margin:0;" />
                                                        </td>

                                                        <td
                                                            style="border-top:1px solid #000;border-left:1px solid #000;">
                                                            <input type="text" name="education_start_year[<?=$i?>]" value="<?=$array_education_level[$i]['startYear']?>"
                                                                style="margin:0;" />
                                                        </td>

                                                        <td
                                                            style="border-top:1px solid #000;border-left:1px solid #000;">
                                                            <input type="text" name="education_finish_year[<?=$i?>]" value="<?=$array_education_level[$i]['finishYear']?>"
                                                                style="margin:0;" />
                                                        </td>

                                                        <td
                                                            style="border-top:1px solid #000;border-left:1px solid #000;">
                                                            <input type="text" name="education_grade[<?=$i?>]" value="<?=$array_education_level[$i]['grade']?>"
                                                                style="margin:0;" />
                                                        </td>
                                                    </tr>
                                                	<?php } ?>
                                                </table>
                                            </div>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="4">&nbsp;</td>
                                </tr>
                                <tr>
                                    <td colspan="4">&nbsp;</td>
                                </tr>
                                <tr>
                                    <td>
                                        <div class="panel panel-primary" style="border: 2px solid #5e5bd0;">
                                            <div class="panel-heading"
                                                style="font-size:16px; background-color: #5e5bd0;color: white;">
                                                <?= $lang['PROFESSIONAL QUALIFICATIONS (MEMBERSHIPS / TECHNICAL / PROFESSIONAL / OCCUPATION TRAINING)']?>
                                            </div>
                                            <div class="panel-body" style="padding: 0;">
                                                <table border="0" cellpadding="0" cellspacing="0" width="100%"
                                                    style="font-size:16px;border-bottom: 1px solid #000;border-right: 1px solid #000;">
                                                    <tr>
                                                        <th rowspan="2"
                                                            style="padding:5px;border-top:1px solid #000;border-left:1px solid #000;">
                                                            <?=$lang['PROFESSIONAL QUALIFICATION']?></th>
                                                        <th rowspan="2"
                                                            style="padding:5px;border-top:1px solid #000;border-left:1px solid #000;">
                                                            <?= $lang['ACCREDITED BY']?></th>
                                                        <th width="130px"
                                                            style="padding:5px;border-top:1px solid #000;border-left:1px solid #000;text-align: center;">
                                                            <?= $lang['START']?></th>
                                                        <th width="130px"
                                                            style="padding:5px;border-top:1px solid #000;border-left:1px solid #000;text-align: center;">
                                                            <?= $lang['FINISH']?></th>
                                                    </tr>
                                                    <tr>
                                                        <th width="130px"
                                                            style="padding:5px;border-top:1px solid #000;border-left:1px solid #000;text-align: center;">
                                                            <?= $lang['(month/year)']?>
                                                        </th>
                                                        <th width="130px"
                                                            style="padding:5px;border-top:1px solid #000;border-left:1px solid #000;text-align: center;">
                                                            <?= $lang['(month/year)']?>
                                                        </th>
                                                    </tr>
                                                    <?php for ($i=0; $i<5; $i++){ ?>
                                                    <tr>
                                                        <td
                                                            style="border-top:1px solid #000;border-left:1px solid #000;">
                                                            <input type="text" name="professional_qualification[<?=$i?>]" value="<?=$array_professional_qualification[$i]['qualification']?>"
                                                                style="margin:0;" />
                                                        </td>
                                                        <td
                                                            style="border-top:1px solid #000;border-left:1px solid #000;">
                                                            <input type="text" name="professional_accredited_by[<?=$i?>]" value="<?=$array_professional_qualification[$i]['accredited']?>"
                                                                style="margin:0;" />
                                                        </td>
                                                        <td
                                                            style="border-top:1px solid #000;border-left:1px solid #000;">
                                                            <input type="text"
                                                                name="professional_qualification_start_year[<?=$i?>]" value="<?=$array_professional_qualification[$i]['startYear']?>"
                                                                style="margin:0;" />
                                                        </td>
                                                        <td
                                                            style="border-top:1px solid #000;border-left:1px solid #000;">
                                                            <input type="text"
                                                                name="professional_qualification_finish_year[<?=$i?>]" value="<?=$array_professional_qualification[$i]['finishYear']?>"
                                                                style="margin:0;" />
                                                        </td>
                                                    </tr>
                                                	<?php }?>
                                                </table>
                                            </div>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="4">&nbsp;</td>
                                </tr>
                                <tr>
                                    <td colspan="4">&nbsp;</td>
                                </tr>
                                <tr>
                                    <td colspan="4">
                                        <div class="panel panel-primary" style="border: 2px solid #5e5bd0;">
                                            <div class="panel-heading"
                                                style="font-size:16px; background-color: #5e5bd0;color: white;">
                                                <?=$lang['LANGUAGE PROFICIENCY']?>
                                            </div>
                                            <div class="panel-body" style="padding: 0;">

                                                <table border="1" cellspacing="0" cellpadding="5"
                                                    style="border-collapse: collapse; width: 100%; text-align: center; font-size:16px;">
                                                    <thead>
                                                        <tr>
                                                            <th style="padding:5px;border-top:1px solid #000;border-left:1px solid #000;"
                                                                rowspan="2"><?=$lang['LANGUAGE PROFICIENCY']?></th>
                                                            <th style="padding:5px;border-top:1px solid #000;border-left:1px solid #000;"
                                                                colspan="3"><?=$lang['SPOKEN']?></th>
                                                            <th style="padding:5px;border-top:1px solid #000;border-left:1px solid #000;"
                                                                colspan="3"><?=$lang['WRITTEN']?></th>
                                                        </tr>
                                                        <tr>
                                                            <th
                                                                style="padding:5px;border-top:1px solid #000;border-left:1px solid #000;">
                                                                <?=$lang['GOOD']?></th>
                                                            <th
                                                                style="padding:5px;border-top:1px solid #000;border-left:1px solid #000;">
                                                                <?=$lang['AVERAGE']?></th>
                                                            <th
                                                                style="padding:5px;border-top:1px solid #000;border-left:1px solid #000;">
                                                                <?=$lang['POOR']?></th>
                                                            <th
                                                                style="padding:5px;border-top:1px solid #000;border-left:1px solid #000;">
                                                                <?=$lang['GOOD']?></th>
                                                            <th
                                                                style="padding:5px;border-top:1px solid #000;border-left:1px solid #000;">
                                                                <?=$lang['AVERAGE']?></th>
                                                            <th
                                                                style="padding:5px;border-top:1px solid #000;border-left:1px solid #000;">
                                                                <?=$lang['POOR']?></th>
                                                        </tr>
                                                    </thead>
                                                    <tbody>
                                                        <!-- ENGLISH -->
                                                        <tr>
                                                            <td
                                                                style="padding:5px;border-top:1px solid #000;border-left:1px solid #000;">
                                                                <?=$lang['ENGLISH']?></td>
                                                            <td><input style="margin:5px;" type="radio" <?=($spoken_english=="good")?"checked":""?>
                                                                    name="spoken_english" value="good"></td>
                                                            <td><input style="margin:5px;" type="radio" <?=($spoken_english=="average")?"checked":""?>
                                                                    name="spoken_english" value="average"></td>
                                                            <td><input style="margin:5px;" type="radio" <?=($spoken_english=="poor")?"checked":""?>
                                                                    name="spoken_english" value="poor"></td>
                                                            <td><input style="margin:5px;" type="radio" <?=($written_english=="good")?"checked":""?>
                                                                    name="written_english" value="good"></td>
                                                            <td><input style="margin:5px;" type="radio" <?=($written_english=="average")?"checked":""?>
                                                                    name="written_english" value="average"></td>
                                                            <td><input style="margin:5px;" type="radio" <?=($written_english=="poor")?"checked":""?>
                                                                    name="written_english" value="poor"></td>
                                                        </tr>

                                                        <!-- MANDARIN -->
                                                        <tr>
                                                            <td
                                                                style="padding:5px;border-top:1px solid #000;border-left:1px solid #000;">
                                                                <?=$lang['MANDARIN']?></td>
                                                            <td><input style="margin:5px;" type="radio" <?=($spoken_mandarin=="good")?"checked":""?>
                                                                    name="spoken_mandarin" value="good"></td>
                                                            <td><input style="margin:5px;" type="radio" <?=($spoken_mandarin=="average")?"checked":""?>
                                                                    name="spoken_mandarin" value="average"></td>
                                                            <td><input style="margin:5px;" type="radio" <?=($spoken_mandarin=="poor")?"checked":""?>
                                                                    name="spoken_mandarin" value="poor"></td>
                                                            <td><input style="margin:5px;" type="radio" <?=($written_mandarin=="good")?"checked":""?>
                                                                    name="written_mandarin" value="good"></td>
                                                            <td><input style="margin:5px;" type="radio" <?=($written_mandarin=="average")?"checked":""?>
                                                                    name="written_mandarin" value="average"></td>
                                                            <td><input style="margin:5px;" type="radio" <?=($written_mandarin=="poor")?"checked":""?>
                                                                    name="written_mandarin" value="poor"></td>
                                                        </tr>

                                                        <!-- BAHASA MALAYSIA -->
                                                        <tr>
                                                            <td
                                                                style="padding:5px;border-top:1px solid #000;border-left:1px solid #000;">
                                                                <?=$lang['BAHASA MALAYSIA']?></td>
                                                            <td><input style="margin:5px;" type="radio" name="spoken_bm" <?=($spoken_bm=="good")?"checked":""?>
                                                                    value="good"></td>
                                                            <td><input style="margin:5px;" type="radio" name="spoken_bm"  <?=($spoken_bm=="average")?"checked":""?>
                                                                    value="average"></td>
                                                            <td><input style="margin:5px;" type="radio" name="spoken_bm" <?=($spoken_bm=="poor")?"checked":""?>
                                                                    value="poor"></td>
                                                            <td><input style="margin:5px;" type="radio"  <?=($written_bm=="good")?"checked":""?>
                                                                    name="written_bm" value="good"></td>
                                                            <td><input style="margin:5px;" type="radio"  <?=($written_bm=="average")?"checked":""?>
                                                                    name="written_bm" value="average"></td>
                                                            <td><input style="margin:5px;" type="radio"  <?=($written_bm=="poor")?"checked":""?>
                                                                    name="written_bm" value="poor"></td>
                                                        </tr>

                                                        <!-- OTHERS 1 -->
                                                        <tr>
                                                            <td
                                                                style="border-top:1px solid #000;border-left:1px solid #000;">
                                                                <input type="text" placeholder="Other" value="<?=$language_other_1?>"
                                                                    name="language_other_1" style="margin: 0;">
                                                            </td>
                                                            <td><input style="margin:5px;" type="radio" <?=($spoken_other1=="good")?"checked":""?>
                                                                    name="spoken_other1" value="good"></td>
                                                            <td><input style="margin:5px;" type="radio" <?=($spoken_other1=="average")?"checked":""?>
                                                                    name="spoken_other1" value="average"></td>
                                                            <td><input style="margin:5px;" type="radio" <?=($spoken_other1=="poor")?"checked":""?>
                                                                    name="spoken_other1" value="poor"></td>
                                                            <td><input style="margin:5px;" type="radio" <?=($written_other1=="good")?"checked":""?>
                                                                    name="written_other1" value="good"></td>
                                                            <td><input style="margin:5px;" type="radio" <?=($written_other1=="average")?"checked":""?>
                                                                    name="written_other1" value="average"></td>
                                                            <td><input style="margin:5px;" type="radio" <?=($written_other1=="poor")?"checked":""?>
                                                                    name="written_other1" value="poor"></td>
                                                        </tr>

                                                        <!-- OTHERS 2 -->
                                                        <tr>
                                                            <td
                                                                style="border-top:1px solid #000;border-left:1px solid #000;">
                                                                <input type="text" placeholder="Other" value="<?=$language_other_2?>"
                                                                    name="language_other_2" style="margin: 0;">
                                                            </td>
                                                            <td><input style="margin:5px;" type="radio" <?=($spoken_other2=="good")?"checked":""?>
                                                                    name="spoken_other2" value="good"></td>
                                                            <td><input style="margin:5px;" type="radio" <?=($spoken_other2=="average")?"checked":""?>
                                                                    name="spoken_other2" value="average"></td>
                                                            <td><input style="margin:5px;" type="radio" <?=($spoken_other2=="poor")?"checked":""?>
                                                                    name="spoken_other2" value="poor"></td>
                                                            <td><input style="margin:5px;" type="radio" <?=($written_other2=="good")?"checked":""?>
                                                                    name="written_other2" value="good"></td>
                                                            <td><input style="margin:5px;" type="radio" <?=($written_other2=="average")?"checked":""?>
                                                                    name="written_other2" value="average"></td>
                                                            <td><input style="margin:5px;" type="radio" <?=($written_other2=="poor")?"checked":""?>
                                                                    name="written_other2" value="poor"></td>
                                                        </tr>
                                                    </tbody>
                                                </table>
                                            </div>
                                        </div>

                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="4">&nbsp;</td>
                                </tr>
                                <tr>
                                    <td colspan="4">&nbsp;</td>
                                </tr>
                                <tr>
                                    <td>
                                        <div class="panel panel-primary" style="border: 2px solid #5e5bd0;">
                                            <div class="panel-heading"
                                                style="font-size:16px; background-color: #5e5bd0;color: white;">
                                                <?=$lang['REFERENCE DETAIL']?>
                                            </div>
                                            <div class="panel-body" style="padding: 0;">

                                                <p style="margin: 5px;">
                                                    <?=$lang['LIST AT LEAST TWO (2) FORMER SUPERVISOR, HR MANAGER AND/OR COLLEAGUE.']?>
                                                <p>
                                                <table border="0" cellpadding="0" cellspacing="0" width="100%"
                                                    style="font-size:16px;border-bottom: 1px solid #000;border-right: 1px solid #000;">
                                                    <tr>
                                                        <th
                                                            style="padding:5px;border-top:1px solid #000;border-left:1px solid #000;">
                                                            <?= $lang['Name']?></th>
                                                        <th
                                                            style="padding:5px;border-top:1px solid #000;border-left:1px solid #000;">
                                                            <?= $lang['Position company']?></th>
                                                        <th
                                                            style="padding:5px;border-top:1px solid #000;border-left:1px solid #000;">
                                                            <?= $lang['Contacts no']?></th>
                                                        <th
                                                            style="padding:5px;border-top:1px solid #000;border-left:1px solid #000;">
                                                            <?= $lang['Years known']?></th>
                                                    </tr>
                                                    <tr>
                                                        <td
                                                            style="border-top:1px solid #000;border-left:1px solid #000;">
                                                            <input type="text" name="references_name[0]" value="<?=$array_reference[0]['name']?>"
                                                                style="margin:0;" />
                                                        </td>
                                                        <td
                                                            style="border-top:1px solid #000;border-left:1px solid #000;">
                                                            <input type="text" name="references_position[0]" value="<?=$array_reference[0]['position']?>"
                                                                style="margin:0;" />
                                                        </td>
                                                        <td
                                                            style="border-top:1px solid #000;border-left:1px solid #000;">
                                                            <input type="text" name="references_contacts[0]" value="<?=$array_reference[0]['contact']?>"
                                                                style="margin:0;" />
                                                        </td>
                                                        <td
                                                            style="border-top:1px solid #000;border-left:1px solid #000;">
                                                            <input type="text" name="references_years[0]" value="<?=$array_reference[0]['year']?>"
                                                                style="margin:0;" />
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td
                                                            style="border-top:1px solid #000;border-left:1px solid #000;">
                                                            <input type="text" name="references_name[1]" value="<?=$array_reference[1]['name']?>"
                                                                style="margin:0;" />
                                                        </td>
                                                        <td
                                                            style="border-top:1px solid #000;border-left:1px solid #000;">
                                                            <input type="text" name="references_position[1]" value="<?=$array_reference[1]['position']?>"
                                                                style="margin:0;" />
                                                        </td>
                                                        <td
                                                            style="border-top:1px solid #000;border-left:1px solid #000;">
                                                            <input type="text" name="references_contacts[1]" value="<?=$array_reference[1]['contact']?>"
                                                                style="margin:0;" />
                                                        </td>
                                                        <td
                                                            style="border-top:1px solid #000;border-left:1px solid #000;">
                                                            <input type="text" name="references_years[1]" value="<?=$array_reference[1]['year']?>"
                                                                style="margin:0;" />
                                                        </td>
                                                    </tr>
                                                </table>
                                            </div>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="4">&nbsp;</td>
                                </tr>
                                <tr>
                                    <td colspan="4">&nbsp;</td>
                                </tr>
                                <tr>
                                    <td>
                                        <div class="panel panel-primary" style="border: 2px solid #5e5bd0;">
                                            <div class="panel-heading"
                                                style="font-size:16px; background-color: #5e5bd0;color: white;">
                                                <?= $lang['EMPLOYMENT HISTORY']?>
                                            </div>
                                            <div class="panel-body"
                                                style="padding: 0; font-weight: bold; font-size: 16px;">
                                                <div class="form-group">
                                                    <div class="row" style="margin-top: 10px;">
                                                        <div class="col-sm-6">
                                                            <?=$lang['CURRENT COMPANY :']?>
                                                        </div>
                                                        <div class="col-sm-6">
                                                            <?=$lang['CURRENT POSITION :']?>
                                                        </div>
                                                    </div>
                                                    <div class="row">
                                                        <div class="col-sm-6">
                                                            <input name="current_company_name" type="text" value="<?=$currentCompanyName?>">
                                                        </div>

                                                        <div class="col-sm-6">
                                                            <input name="current_position_name" type="text" value="<?=$currentCompanyPosition?>">
                                                        </div>
                                                    </div>
                                                </div>
                                                <br />
                                                <div class="form-group row">
                                                    <div class="row">
                                                        <div class="col-sm-12">
                                                            <?=$lang['FULL ADDRESS :']?>
                                                        </div>
                                                    </div>
                                                    <div class="row">
                                                        <div class="col-sm-12">
                                                            <input name="current_company_full_address" type="text" value="<?=$currentCompanyAddress?>">
                                                        </div>
                                                    </div>
                                                </div>
                                                <br />
                                                <div class="form-group">
                                                    <div class="row">
                                                        <div class="col-sm-6">
                                                            <?=$lang['DATE JOIN :']?>
                                                        </div>
                                                        <div class="col-sm-6">
                                                            <?=$lang['DATE LEFT :']?>
                                                        </div>
                                                    </div>
                                                    <div class="row">
                                                        <div class="col-sm-6">
                                                            <input name="current_company_join_date" type="text" value="<?=$currentCompanyJoinDate?>"
                                                                class="datetimepicker">
                                                        </div>
                                                        <div class="col-sm-6">
                                                            <input name="current_company_left_date" type="text" value="<?=$currentCompanyLeftDate?>"
                                                                class="datetimepicker">
                                                        </div>
                                                    </div>
                                                </div>
                                                <br />
                                                <div class="form-group">
                                                    <div class="row">
                                                        <div class="col-sm-6">
                                                            <?=$lang['BASIC SALARY :']?>
                                                        </div>
                                                        <div class="col-sm-6">
                                                            <?=$lang['FIX AllOWANCE :']?>
                                                        </div>
                                                    </div>
                                                    <div class="row">
                                                        <div class="col-sm-6">
                                                            <input name="current_company_basic_salary" type="number" value="<?=$currentCompanySalary?>"
                                                                step="0.01" min="0" placeholder="0.00">
                                                        </div>
                                                        <div class="col-sm-6">
                                                            <input name="current_company_fix_allowance" type="number" value="<?=$currentCompanyAllowance?>"
                                                                step="0.01" min="0" placeholder="0.00">
                                                        </div>
                                                    </div>
                                                </div>
                                                <br />
                                                <div class="form-group row">
                                                    <div class="row">
                                                        <div class="col-sm-12">
                                                            <?=$lang['REASON FOR LEAVING :']?>
                                                        </div>
                                                    </div>
                                                    <div class="row">
                                                        <div class="col-sm-12">
                                                            <input name="current_company_leave_reason" type="text" value="<?=$currentCompanyReason?>">
                                                        </div>
                                                    </div>
                                                </div>
                                                <br />
                                            </div>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="4">&nbsp;</td>
                                </tr>
                                <tr>
                                    <td colspan="4">&nbsp;</td>
                                </tr>
                                <tr>
                                    <td>
                                        <div class="panel panel-primary" style="border: 2px solid #5e5bd0;">
                                            <div class="panel-heading"
                                                style="font-size:16px; background-color: #5e5bd0;color: white;">
                                                <?=$lang['SUBSEQUENT EMPLOYMENT HISTORY']?>
                                            </div>
                                            <div class="panel-body" style="padding: 0; font-weight: bold; font-size: 16px;">
                                                <table width="100%" style="border-collapse: collapse;">
                                                	<?php for($i=0; $i<3; $i++){ ?>
                                                    <tr>
                                                        <th colspan="4" style="padding:10px 5px; text-align:center; font-weight:bold;">
                                                            <?=$lang['Employment Record']?> #<?=$i+1?></th>
                                                    </tr>
                                                    <tr>
                                                        <td style="padding:5px;"><?=$lang['Company:']?></td>
                                                        <td><input name="subsequent_company_name[<?=$i?>]" type="text" value="<?=$array_subsequent_employment[$i]['name']?>"
                                                                style="width:100%;"></td>
                                                        <td style="padding:5px;"><?=$lang['Position:']?></td>
                                                        <td><input name="subsequent_position_name[<?=$i?>]" type="text" value="<?=$array_subsequent_employment[$i]['position']?>"
                                                                style="width:100%;"></td>
                                                    </tr>
                                                    <tr>
                                                        <td style="padding:5px;"><?=$lang['Date Join:']?></td>
                                                        <td><input name="subsequent_company_join_date[<?=$i?>]" type="text" value="<?=$array_subsequent_employment[$i]['joinDate']?>"
                                                                class="datetimepicker" style="width:100%;"></td>
                                                        <td style="padding:5px;"><?=$lang['Date Left:']?></td>
                                                        <td><input name="subsequent_company_left_date[<?=$i?>]" type="text" value="<?=$array_subsequent_employment[$i]['leftDate']?>"
                                                                class="datetimepicker" style="width:100%;"></td>
                                                    </tr>
                                                    <tr>
                                                        <td style="padding:5px;"><?=$lang['Basic Salary:']?></td>
                                                        <td><input name="subsequent_company_basic_salary[<?=$i?>]" value="<?=$array_subsequent_employment[$i]['salary']?>"
                                                                type="number" step="0.01" min="0" placeholder="0.00"
                                                                style="width:100%;"></td>
                                                        <td style="padding:5px;"><?=$lang['Fix Allowance:']?></td>
                                                        <td><input name="subsequent_company_fix_allowance[<?=$i?>]" value="<?=$array_subsequent_employment[$i]['allowance']?>"
                                                                type="number" step="0.01" min="0" placeholder="0.00"
                                                                style="width:100%;"></td>
                                                    </tr>
                                                    <tr>
                                                        <td style="padding:5px;"><?=$lang['Reason for Leaving:']?></td>
                                                        <td colspan="3"><input name="subsequent_company_leave_reason[<?=$i?>]" value="<?=$array_subsequent_employment[$i]['reason']?>"
                                                                type="text" style="width:100%;"></td>
                                                    </tr>
                                                	<?php } ?>
                                                </table>
                                            </div>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="4">&nbsp;</td>
                                </tr>
                                <tr>
                                    <td colspan="4">&nbsp;</td>
                                </tr>
                                <tr>
                                    <td>
                                        <div class="panel panel-primary" style="border: 2px solid #5e5bd0;">
                                            <div class="panel-heading"
                                                style="font-size:16px; background-color: #5e5bd0;color: white;">
                                                <?=$lang['OTHER INFORMATION']?>
                                            </div>
                                            <div class="panel-body"
                                                style="padding: 0; font-weight: bold; font-size: 16px;">

                                                <p style="margin:10px">
                                                    <?=$lang['WHAT IS YOUR INVOLVEMENT IN THE FOLLOWING ACTIVITY :']?>
                                                </p>
                                                <table border="1" cellspacing="0" cellpadding="5"
                                                    style="border-collapse: collapse; width: 100%; text-align: center;">
                                                    <thead>
                                                        <tr>
                                                            <th style="padding:5px;border:1px solid #000;"></th>
                                                            <th
                                                                style="padding:5px;border-top:1px solid #000;border-left:1px solid #000;">
                                                                <?=$lang['NEVER']?></th>
                                                            <th
                                                                style="padding:5px;border-top:1px solid #000;border-left:1px solid #000;">
                                                                <?=$lang['OCCASIONALLY']?></th>
                                                            <th
                                                                style="padding:5px;border-top:1px solid #000;border-left:1px solid #000;">
                                                                <?=$lang['AVERAGE']?></th>
                                                            <th
                                                                style="padding:5px;border-top:1px solid #000;border-left:1px solid #000;">
                                                                <?=$lang['REGULARLY']?></th>
                                                            <th
                                                                style="padding:5px;border-top:1px solid #000;border-left:1px solid #000;">
                                                                <?=$lang['HABITUAL']?></th>
                                                        </tr>
                                                    </thead>
                                                    <tbody>
                                                        <tr>
                                                            <td
                                                                style="padding:5px;border-top:1px solid #000;border-left:1px solid #000;">
                                                                <?=$lang['GAMBLING']?></td>
                                                            <td><input style="margin:5px;" type="radio" name="gambling" <?=($gambling=="never")?"checked":""?>
                                                                    value="never"></td>
                                                            <td><input style="margin:5px;" type="radio" name="gambling" <?=($gambling=="occasionally")?"checked":""?>
                                                                    value="occasionally"></td>
                                                            <td><input style="margin:5px;" type="radio" name="gambling" <?=($gambling=="average")?"checked":""?>
                                                                    value="average"></td>
                                                            <td><input style="margin:5px;" type="radio" name="gambling" <?=($gambling=="regularly")?"checked":""?>
                                                                    value="regularly"></td>
                                                            <td><input style="margin:5px;" type="radio" name="gambling" <?=($gambling=="habitual")?"checked":""?>
                                                                    value="habitual"></td>
                                                        </tr>
                                                        <tr>
                                                            <td
                                                                style="padding:5px;border-top:1px solid #000;border-left:1px solid #000;">
                                                                <?=$lang['DRINKING']?></td>
                                                            <td><input style="margin:5px;" type="radio" name="drinking" <?=($drinking=="never")?"checked":""?>
                                                                    value="never"></td>
                                                            <td><input style="margin:5px;" type="radio" name="drinking" <?=($drinking=="occasionally")?"checked":""?>
                                                                    value="occasionally"></td>
                                                            <td><input style="margin:5px;" type="radio" name="drinking" <?=($drinking=="average")?"checked":""?>
                                                                    value="average"></td>
                                                            <td><input style="margin:5px;" type="radio" name="drinking" <?=($drinking=="regularly")?"checked":""?>
                                                                    value="regularly"></td>
                                                            <td><input style="margin:5px;" type="radio" name="drinking" <?=($drinking=="habitual")?"checked":""?>
                                                                    value="habitual"></td>
                                                        </tr>
                                                        <tr>
                                                            <td
                                                                style="padding:5px;border-top:1px solid #000;border-left:1px solid #000;">
                                                                <?=$lang['SMOKING']?></td>
                                                            <td><input style="margin:5px;" type="radio" name="smoking" <?=($smoking=="never")?"checked":""?>
                                                                    value="never"></td>
                                                            <td><input style="margin:5px;" type="radio" name="smoking" <?=($smoking=="occasionally")?"checked":""?>
                                                                    value="occasionally"></td>
                                                            <td><input style="margin:5px;" type="radio" name="smoking" <?=($smoking=="average")?"checked":""?>
                                                                    value="average"></td>
                                                            <td><input style="margin:5px;" type="radio" name="smoking" <?=($smoking=="regularly")?"checked":""?>
                                                                    value="regularly"></td>
                                                            <td><input style="margin:5px;" type="radio" name="smoking" <?=($smoking=="habitual")?"checked":""?>
                                                                    value="habitual"></td>
                                                        </tr>
                                                        <tr>
                                                            <td
                                                                style="padding:5px;border-top:1px solid #000;border-left:1px solid #000;">
                                                                <?=$lang['DRUG TAKING']?></td>
                                                            <td><input style="margin:5px;" type="radio" name="drug" <?=($drug=="never")?"checked":""?>
                                                                    value="never"></td>
                                                            <td><input style="margin:5px;" type="radio" name="drug" <?=($drug=="occasionally")?"checked":""?>
                                                                    value="occasionally"></td>
                                                            <td><input style="margin:5px;" type="radio" name="drug" <?=($drug=="average")?"checked":""?>
                                                                    value="average"></td>
                                                            <td><input style="margin:5px;" type="radio" name="drug" <?=($drug=="regularly")?"checked":""?>
                                                                    value="regularly"></td>
                                                            <td><input style="margin:5px;" type="radio" name="drug" <?=($drug=="habitual")?"checked":""?>
                                                                    value="habitual"></td>
                                                        </tr>
                                                    </tbody>
                                                </table>
                                                <br />
                                                <br />
                                                <table cellpadding="5" cellspacing="5" width="100%"
                                                    style="border-collapse: collapse;">

                                                    <!--question 1-->
                                                    <tr>
                                                        <td style="padding:5px;" colspan="2">
                                                            <?=$lang['1) DID YOU SUFFER FROM ANY PHYSICAL DISABILITY, CHRONIC AILMENT HANDICAP, ALLERGIES OR SERIOUS ILLNESS?']?>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                        	<input style="margin:5px;" type="radio" class="toggleDetail" name="disability" value="yes" <?=($disability=="yes")?"checked":""?>>
                                                        </td>
                                                        <td style="padding:5px;">
                                                            <?=$lang['IF YES, PLEASE GIVE DETAILS:']?>
                                                            <input type="text" id="disability_detail" name="disability_detail" value="<?=$disability_detail?>" style="display: none;">
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                        	<input style="margin:5px;" type="radio" name="disability" <?=($disability=="no")?"checked":""?> value="no"></td>
                                                        <td style="padding:5px;">
                                                        	<?=$lang['NO']?>
                                                        </td>
                                                    </tr>

                                                    <!-- Question 2 -->
                                                    <tr>
                                                        <td style="padding:5px;" colspan="2">
                                                            <?=$lang['2) ARE YOU TAKING ANY LONG-TERM MEDICATION FOR DIABETIC, ASTHMA, ETC.?']?>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td><input style="margin:5px;" type="radio" name="medication" <?=($medication=="yes")?"checked":""?>
                                                                value="yes"  class="toggleDetail"></td>
                                                        <td style="padding:5px;">
                                                            <?=$lang['IF YES, PLEASE GIVE DETAILS:']?>
                                                            <input type="text"
                                                                id="medication_detail" name="medication_detail" value="<?=$medication_detail?>"
                                                                style="width: 70%; display: none;">
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                        	<input style="margin:5px;" type="radio" name="medication" <?=($medication=="no")?"checked":""?> value="no">
                                                        </td>
                                                        <td style="padding:5px;">
                                                        	<?=$lang['NO']?>
                                                        </td>
                                                    </tr>

                                                    <!-- Question 3 -->
                                                    <tr>
                                                        <td style="padding:5px;" colspan="2">
                                                            <?=$lang['3) PREGNANCY BEFORE JOINING (CURRENTLY / PLANNING IN COMING FEW THREE (3) MONTHS)?']?>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td><input style="margin:5px;" type="radio" name="pregnancy" <?=($pregnancy=="yes")?"checked":""?>
                                                                value="yes" class="toggleDetail"></td>
                                                        <td style="padding:5px;">
                                                            <?=$lang['IF YES, PLEASE GIVE DETAILS:']?><input type="text"
                                                                id="pregnancy_detail" name="pregnancy_detail" value="<?=$pregnancy_detail?>"
                                                                style="width: 70%; display: none;"></td>
                                                    </tr>
                                                    <tr>
                                                        <td><input style="margin:5px;" type="radio" name="pregnancy" <?=($pregnancy=="no")?"checked":""?>
                                                                value="no"></td>
                                                        <td style="padding:5px;"><?=$lang['NO']?></td>
                                                    </tr>

                                                    <!-- Question 4 -->
                                                    <tr>
                                                        <td style="padding:5px;" colspan="2">
                                                            <?=$lang['4) ARE YOU WILLING TO TRANSFER TO A NEW DEPARTMENT OR COMPANY IF THE OPPORTUNITY ARISES?']?>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td style="padding:5px;" colspan="2">
                                                            <div style="margin-top: 10px;">
                                                                <strong>A. WITH RELOCATION:</strong><br>
                                                                <label><input style="margin:5px;" type="radio" <?=($willingToTransferWithrelocation=="yes")?"checked":""?>
                                                                        name="relocation" value="yes">
                                                                    <?=$lang['YES']?></label><br>
                                                                <label><input style="margin:5px;" type="radio" <?=($willingToTransferWithrelocation=="no")?"checked":""?>
                                                                        name="relocation" value="no">
                                                                    <?=$lang['NO']?></label>
                                                            </div>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td style="padding:5px;" colspan="2">
                                                            <div style="margin-top: 10px;">
                                                                <strong>B. WITHOUT RELOCATION:</strong><br>
                                                                <label><input style="margin:5px;" type="radio" <?=($willingToTransferWithoutrelocation=="yes")?"checked":""?>
                                                                        name="without_relocation" value="yes">
                                                                    YES</label><br>
                                                                <label><input style="margin:5px;" type="radio" <?=($willingToTransferWithoutrelocation=="no")?"checked":""?>
                                                                        name="without_relocation" value="no">
                                                                    <?=$lang['NO']?></label>
                                                            </div>
                                                        </td>
                                                    </tr>

                                                    <!-- Question 5 -->
                                                    <tr>
                                                        <td style="padding:5px;" colspan="2">
                                                            <?=$lang['5) HAVE YOU EVER BEEN DISMISSED, DISCHARGED, OR LAID OFF FROM ANY EMPLOYMENT?']?>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td style="width: 40px;"><input style="margin:5px;" value="yes" <?=($dismissed=="yes")?"checked":""?>
                                                                type="radio" name="dismissed" class="toggleDetail"></td>
                                                        <td style="padding:5px;">
                                                            <?=$lang['IF YES, PLEASE GIVE DETAILS:']?><input type="text"
                                                                id="dismissed_detail" name="dismissed_detail" value="<?=$dismissed_detail?>"
                                                                style="width: 70%; display: none;"></td>
                                                    </tr>
                                                    <tr>
                                                        <td><input type="radio" style="margin:5px;" value="no" <?=($dismissed=="no")?"checked":""?>
                                                                name="dismissed"></td>
                                                        <td style="padding:5px;"><?=$lang['NO']?></td>
                                                    </tr>

                                                    <!-- Question 6 -->
                                                    <tr>
                                                        <td style="padding:5px;" colspan="2">
                                                            <?=$lang['6) HAVE YOU EVER BEEN CHARGED IN A COURT LAW?']?>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td><input type="radio" style="margin:5px;" name="court" <?=($court=="yes")?"checked":""?>
                                                                value="yes" class="toggleDetail"></td>
                                                        <td style="padding:5px;">
                                                            <?=$lang['IF YES, PLEASE GIVE DETAILS:']?><input type="text"
                                                                id="court_detail" name="court_detail" value="<?=$court_detail?>" 
                                                                style="width: 70%; display: none;"></td>
                                                    </tr>
                                                    <tr>
                                                        <td><input type="radio" style="margin:5px;" value="no" <?=($court=="no")?"checked":""?>
                                                                name="court"></td>
                                                        <td style="padding:5px;"><?=$lang['NO']?></td>
                                                    </tr>

                                                    <!-- Question 7 -->
                                                    <tr>
                                                        <td style="padding:5px;" colspan="2">
                                                            <?=$lang['7) HAVE YOU BEEN DECLARED BANKRUPTCY?']?></td>
                                                    </tr>
                                                    <tr>
                                                        <td><input value="yes" style="margin:5px;" type="radio" <?=($bankruptcy=="yes")?"checked":""?>
                                                                name="bankruptcy"></td>
                                                        <td style="padding:5px;"><?=$lang['YES']?></td>
                                                    </tr>
                                                    <tr>
                                                        <td><input value="no" style="margin:5px;" type="radio" <?=($bankruptcy=="no")?"checked":""?>
                                                                name="bankruptcy"></td>
                                                        <td style="padding:5px;"><?=$lang['NO']?></td>
                                                    </tr>

                                                    <!-- Question 8 -->
                                                    <tr>
                                                        <td style="padding:5px;" colspan="2">
                                                            <?=$lang['8) ARE YOU CURRENTLY EXPERIENCING ANY FINANCIAL DIFFICULTIES?']?>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td><input type="radio" style="margin:5px;" value="yes" <?=($finance=="yes")?"checked":""?>
                                                                name="finance" class="toggleDetail"></td>
                                                        <td style="padding:5px;">
                                                            <?=$lang['IF YES, PLEASE GIVE DETAILS:']?><input type="text"
                                                                id="finance_detail" name="finance_detail" value="<?=$finance_detail?>"
                                                                style="width: 70%; display: none;"></td>
                                                    </tr>
                                                    <tr>
                                                        <td><input style="margin:5px;" type="radio" name="finance" <?=($finance=="no")?"checked":""?>
                                                                value="no"></td>
                                                        <td style="padding:5px;">NO</td>
                                                    </tr>

                                                    <!-- Question 9 -->
                                                    <tr>
                                                        <td style="padding:5px;" colspan="2">
                                                            <?=$lang['9) HAVE YOU APPLIED TO OUR COMPANY BEFORE?']?>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td><input type="radio" style="margin:5px;" value="yes" <?=($applied=="yes")?"checked":""?>
                                                                name="applied" class="toggleDetail"></td>
                                                        <td style="padding:5px;">
                                                            <?=$lang['IF YES, PLEASE GIVE DETAILS:']?><input type="text"
                                                                id="applied_detail" name="applied_detail" value="<?=$applied_detail?>"
                                                                style="width: 70%; display: none;"></td>
                                                    </tr>
                                                    <tr>
                                                        <td><input style="margin:5px;" type="radio" name="applied" <?=($applied=="no")?"checked":""?>
                                                                value="no"></td>
                                                        <td style="padding:5px;"><?=$lang['NO']?></td>
                                                    </tr>

                                                    <!-- Question 10 -->
                                                    <tr>
                                                        <td style="padding:5px;" colspan="2">
                                                            <?=$lang['10) HAVE YOU BEEN INVOLVED IN A TRADE DISPUTE REFERRED TO LABOUR COURT?']?>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td><input style="margin:5px;" type="radio" value="yes" <?=($dispute=="yes")?"checked":""?>
                                                                name="dispute" class="toggleDetail"></td>
                                                        <td style="padding:5px;">
                                                            <?=$lang['IF YES, PLEASE GIVE DETAILS:']?><input type="text"
                                                                id="dispute_detail" name="dispute_detail" value="<?=$dispute_detail?>" 
                                                                style="width: 70%; display: none;"></td>
                                                    </tr>
                                                    <tr>
                                                        <td><input style="margin:5px;" type="radio" name="dispute" <?=($dispute=="no")?"checked":""?>
                                                                value="no"></td>
                                                        <td style="padding:5px;"><?=$lang['NO']?></td>
                                                    </tr>

                                                    <!-- Question 11 -->
                                                    <tr>
                                                        <td style="padding:5px;" colspan="2">
                                                            <?=$lang['11) DO YOU OWN A CAR AND/OR MOTORCYCLE WITH VALID LICENSE?']?>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td><input style="margin:5px;" type="radio" name="vehicle" <?=($vehicle=="yes")?"checked":""?>
                                                                value="yes"></td>
                                                        <td style="padding:5px;"><?=$lang['YES']?></td>
                                                    </tr>
                                                    <tr>
                                                        <td><input style="margin:5px;" type="radio" name="vehicle" <?=($vehicle=="no")?"checked":""?>
                                                                value="no"></td>
                                                        <td style="padding:5px;"><?=$lang['NO']?></td>
                                                    </tr>

                                                    <!-- Question 12 -->
                                                    <tr>
                                                        <td style="padding:5px;" colspan="2">
                                                            <?=$lang['12) ARE YOU WILLING TO WORK OVERTIME?']?></td>
                                                    </tr>
                                                    <tr>
                                                        <td><input style="margin:5px;" type="radio" name="overtime" <?=($overtime=="yes")?"checked":""?>
                                                                value="yes"></td>
                                                        <td style="padding:5px;"><?=$lang['YES']?></td>
                                                    </tr>
                                                    <tr>
                                                        <td><input style="margin:5px;" type="radio" name="overtime" <?=($overtime=="no")?"checked":""?>
                                                                value="no"></td>
                                                        <td style="padding:5px;"><?=$lang['NO']?></td>
                                                    </tr>

                                                    <!-- Question 13 -->
                                                    <tr>
                                                        <td style="padding:5px;" colspan="2">
                                                            <?=$lang['13) DO YOU HAVE ANY OTHER SIDE JOB OR BUSINESS?']?>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td><input style="margin:5px;" type="radio" name="other_job" <?=($other_job=="yes")?"checked":""?>
                                                                value="yes" class="toggleDetail"></td>
                                                        <td style="padding:5px;">
                                                            <?=$lang['IF YES, PLEASE GIVE DETAILS:']?> <input
                                                                type="text" id="other_job_detail" name="other_job_detail" value="<?=$other_job_detail?>"
                                                                style="width: 70%; display: none;"></td>
                                                    </tr>
                                                    <tr>
                                                        <td><input style="margin:5px;" type="radio" name="other_job" <?=($overtime=="no")?"checked":""?>
                                                                value="no"></td>
                                                        <td style="padding:5px;"><?=$lang['NO']?></td>
                                                    </tr>

                                                    <!-- Question 14 -->
                                                    <tr>
                                                        <td style="padding:5px;" colspan="2">
                                                            <?=$lang['14) WHAT ATTRACTED YOU TO THIS CAREER OPPORTUNITY?']?>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td colspan="2" style="padding:0;">
                                                            <input type="text" name="attract" value="<?=$attract?>"
                                                                style="margin:0; width: 100%;">
                                                        </td>
                                                    </tr>

                                                    <!-- Question 15 -->
                                                    <tr>
                                                        <td style="padding:5px;" colspan="2">
                                                            <?=$lang['15) WHAT ARE YOUR CAREER GOALS IN 5 YEARS, AND HOW TO ACHIEVE THEM?']?>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td colspan="2" style="padding:0;">
                                                            <input type="text" name="career_plan" value="<?=$career_plan?>"
                                                                style="margin:0; width: 100%;">
                                                        </td>
                                                    </tr>


                                                </table>
                                            </div>
                                        </div>
                                        <script>
											window.addEventListener('load', () => {
											    const radios = document.querySelectorAll('input[type="radio"].toggleDetail');

											    radios.forEach(radio => {
											        const detailInput = document.getElementById(`${radio.name}_detail`);

											        const toggleDisplay = () => {
											            if (detailInput) {
											                detailInput.style.display = radio.checked ? '' : 'none';
											            }
											        };

											        // Set initial display based on whether radio is checked
											        toggleDisplay();

											        // Set event listener to update on change
											        radio.addEventListener('change', toggleDisplay);
											    });
											});
										</script>
                                    </td>
                                </tr>

                                <tr>
                                    <td colspan="4">&nbsp;</td>
                                </tr>
                                <tr>
                                    <td colspan="4">&nbsp;</td>
                                </tr>
                            </table>
                        </div>
                        <br />


                        <!-- hidden input here -->
                        <table class="employment_table" border="0" cellpadding="0" cellspacing="0"
                            style="width:100%; padding:0; margin:0 auto;">
                            <tr>
                                <td colspan="4">&nbsp;</td>
                            </tr>
                            <tr>
                                <td colspan="4" style="border-bottom:1px solid #000;">&nbsp;</td>
                            </tr>
                            <tr>
                                <td colspan="4">&nbsp;</td>
                            </tr>
                            <tr>
                                <td colspan="4">
                                    <?php
                                    // check permission
            if ( permissionCheck($row_user, 'application-form-new') ){
                ?>
                                    <button id="apform_submit_btn" type="submit" class="btn btn-purple"
                                        style="float:right; background-color:#5e5bd0 ;color:white"><?= $lang['submit']?></button>
                                    <?php
            }
            ?>
                                    <input type="hidden" name="page_status" value="edit" />
                                    <input type="hidden" name="hide" value="1">
                                    <input type="hidden" name="hide_select_worker" value="Local">
                                    <input type="hidden" name="employment_status" value="pending">
                                </td>
                            </tr>
                            <tr>
                                <td colspan="4">&nbsp;</td>
                            </tr>
                            <tr>
                                <td colspan="4">&nbsp;</td>
                            </tr>
                        </table>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

<script>
$("#apform_submit_btn").click(function(event) {
    event.preventDefault();
    if (confirm("Please make sure you have inserted all the details?") == true) {
        $("#quotationForm").submit();
    }
});
</script>