<?php 
require('includes/header_pemohon.php');
$type = fetch_postget_val("type", $_POST, $_GET);
$active = fetch_postget_val("active", $_POST, $_GET);
$program = fetch_postget_val("program", $_POST, $_GET);
$dun = fetch_postget_val("dun", $_POST, $_GET);
$id_oku = fetch_postget_val("id_oku", $_POST, $_GET);
$no_oku = fetch_postget_val("no_oku", $_POST, $_GET);
$dateTimeNow = dateTimeNow();

$myID = $my_details->usr_id_sys;

$indicator_Query = "SELECT A.*
				  FROM m_pemohon A
				  WHERE A.id_pemohon = ?";
$PDO_stmt = $PDO->prepare($indicator_Query);
$PDO_stmt->bindValue(1, $myID, PDO::PARAM_INT);
$PDO_stmt->execute();
$pemohon_List = $PDO_stmt->fetch(PDO::FETCH_ASSOC);

if($program == 0)
{
	$program = $pemohon_List['id_program'];
}

$statusmohon = $pemohon_List['id_statusmohon']; 

$indicator_Query = "SELECT A.*
				  FROM i_program A
				  WHERE A.id_program = ?";
$PDO_stmt = $PDO->prepare($indicator_Query);
$PDO_stmt->bindValue(1, $program, PDO::PARAM_INT);
$PDO_stmt->execute();
$program_List = $PDO_stmt->fetch(PDO::FETCH_ASSOC);
?>	
<style>
.dropzone .dz-preview .dz-image img{
  width: 120px;
  height: 120px;
}
</style>
<!--begin::Content-->
<div class="content d-flex flex-column flex-column-fluid" id="kt_content">
	<!--begin::Subheader-->
	<div class="subheader py-2 py-lg-4 subheader-solid" id="kt_subheader">
		<div class="container-fluid d-flex align-items-center justify-content-between flex-wrap flex-sm-nowrap">
			<!--begin::Info-->
			<div class="d-flex align-items-center flex-wrap mr-2">
				<!--begin::Page Title-->
				<h5 class="text-dark font-weight-bold mt-2 mb-2 mr-5">Borang Permohonan Dalam Talian</h5>
				<!--end::Page Title-->
				
				<!--begin::Actions-->
				<div class="subheader-separator subheader-separator-ver mt-2 mb-2 ml-4 mr-4 bg-gray-200"></div>
				<?=$program_List['desk_program']?>
			</div>
			<!--end::Info-->
		</div>
	</div>
	<!--end::Subheader-->
	<!--begin::Entry-->
	<div class="d-flex flex-column-fluid">
		<!--begin::Container-->
		<div class="container">
			<!--begin::Dashboard--> 
			<!--begin::Row-->
			<div class="row">
				<div class="col-lg-12">
					<!--begin::List Widget 11-->
					<div class="card card-custom card-stretch gutter-b">
						<!--begin::Body-->
						<?php
							echo '<div class="card-body pt-0">';
							
								$define_prog = $pemohon_List['id_program'];
								if($type == 1 || $pemohon_List['id_program'] == 0)
								{
									$define_prog = $program;									
								}
										
								if($type == 1 || $define_prog > 0)
								{
									$id_pemohon = $pemohon_List['id_pemohon'];
									$id_program = $define_prog;
									$readonly = 1;
									if(in_array($pemohon_List['id_statusmohon'], array(0,1,2,4)) || $id_program == 5 || $id_program == 6 || in_array($pemohon_List['id_aktifmohon'], array(7,9,10)))
									{
										$readonly = 0;
									}
									
									$need_akuan = 0;									
									if($pemohon_List['id_statusmohon'] < 2)
									{
										$need_akuan = 1;
									}
									require('borang_common_layout.php');
								}		
								else
								{
									$notes = 'Tiada program aktif untuk pemohon. Sila membuat pilihan program <a href="index_pemohon.php">di Laman Utama</a>';
								}
								echo $notes;
							echo '</div>';
						?>
						<!--end::Body-->
					</div>
					<!--end::List Widget 11-->
				</div>
			</div>
		</div>
		<!--end::Container-->
	</div>
	<!--end::Entry-->
</div>
<!--end::Content-->
					
	
<?php 
require('includes/footer.php'); 

if(count($actionJS) > 0)
{
	echo '<script type="text/javascript">';
		foreach($actionJS as $jsKey => $jsItem)
		{
			echo '$(\'#'.$jsKey.'\').change(function(){

				if($(\'#'.$jsKey.'\').val() == '.$jsItem['value'].' || $(\'#'.$jsKey.'\').val() == 0){';
					foreach($jsItem['item'] as $jsKey2 => $jsItem2)
					{
						echo '$(\'#'.$jsItem2.'_div\').hide();';
					}
			echo '}else{';
					foreach($jsItem['item'] as $jsKey2 => $jsItem2)
					{
						echo '$(\'#'.$jsItem2.'_div\').show();';
					}
			echo '}
			});';
		}
	echo '</script>'; 
}

if(count($datatableJS) > 0)
{
	echo '<script type="text/javascript">';
		foreach($datatableJS as $jsKey => $jsItem)
		{
			echo '
			function getData_'.$jsItem['id_borangitem'].'()
			{
				return {
					sqlOnly: 0,
					borangItem: '.$jsItem['id_borangitem'].',
					program: '.$program.',
					pemohon_borang: $(\'#id_pemohon_borang\').val(),
				};
			}
			function reloadTable_'.$jsItem['id_borangitem'].'()
			{
				console.log(\'reloadTable_'.$jsItem['id_borangitem'].'\');
				reinitTable("'.$jsItem['input_name'].'", "general-borang_dt_ajax.php", getData_'.$jsItem['id_borangitem'].'(), 1, 0);
			}
			';
		}
		echo '';
	echo '</script>'; 
}

if(count($dropzoneJS) > 0)
{
	echo '<script type="text/javascript">';
		echo 'var uploadPath = "upload_pemohon";';
		foreach($dropzoneJS as $jsKey => $jsItem)
		{
			echo 'var myDZ_'.$jsItem['input_name'].' = new Dropzone("div#'.$jsItem['input_name'].'", {
				acceptedFiles: "image/jpg,image/jpeg,image/png,image/bmp,application/pdf",
				//maxFiles: 1,
				maxFilesize: 2,//max file size in MB,
				url: "general-photo_upload.php",
				paramName: "uploadfile",
				dictDefaultMessage : \'<span style="font-style:italic"><h1>Drop files to upload</h1><h3>(or click)</h3></span>\',
				init: function() {
					$.get("general-photo_upload.php", {peranan:"'.$my_details->user_level.'", uploadId:$(\'#id_pemohon_borang\').val(), generalName:"banner.jpg", uploadFolder:uploadPath}, function(data) {
						$.each(data, function(key,value){
							var mockFile = { name: value.name, size: value.size };				
							myDZ_'.$jsItem['input_name'].'.emit("addedfile", mockFile);
							if(value.name.trim().endsWith(".pdf"))
							{
								myDZ_'.$jsItem['input_name'].'.emit("thumbnail", mockFile, uploadPath + "/pdf.jpg");
							}
							else
							{
								myDZ_'.$jsItem['input_name'].'.emit("thumbnail", mockFile, uploadPath + "/" + $(\'#id_pemohon_borang\').val() + "/" + value.name);
							}
							myDZ_'.$jsItem['input_name'].'.emit("complete", mockFile);
							myDZ_'.$jsItem['input_name'].'.files.push(mockFile);
						});
					});
				}
			});';

			echo '
			myDZ_'.$jsItem['input_name'].'.on("error", function(file, errorMessage) {
				alert("ERROR " + errorMessage);
				myDZ_'.$jsItem['input_name'].'.removeFile(file);
			});

			myDZ_'.$jsItem['input_name'].'.on("success", function(file, photoPath) {
				file.previewElement.querySelector("[data-dz-name]").innerHTML = photoPath;
				console.log(photoPath);
				console.log(photoPath.trim().endsWith(".pdf"));
				if(photoPath.trim().endsWith(".pdf"))
				{
					myDZ_'.$jsItem['input_name'].'.emit("thumbnail", file, uploadPath + "/pdf.jpg");
				}
				else
				{
					myDZ_'.$jsItem['input_name'].'.emit("thumbnail", file, uploadPath + "/" + $(\'#id_pemohon_borang\').val() + "/" + photoPath);
				}
			});

			myDZ_'.$jsItem['input_name'].'.on("sending", function(file, xhr, formData){
				formData.append("uploadId", $(\'#id_pemohon_borang\').val());
				//formData.append("generalName", "banner.jpg");
				formData.append("uploadFolder", uploadPath);
				//myDropzone.removeAllFiles(); //remove all 1st
			});
				
			myDZ_'.$jsItem['input_name'].'.on("dictRemoveFileConfirmation", function(file, xhr, formData){
				formData.append("uploadId", $(\'#id_pemohon_borang\').val());
			});

			myDZ_'.$jsItem['input_name'].'.on("addedfile", function(file) {
				var deleted = false;
				if(deleted == false)
				{
					file.previewElement.addEventListener("click", function() {
						var filesrc = uploadPath + "/" + $(\'#id_pemohon_borang\').val() + "/" + file.previewElement.querySelector(\'[data-dz-name]\').innerHTML.trim();
						if(filesrc.endsWith(".pdf"))
						{
							window.open(filesrc);
						}
						else
						{
							loadMyModal(\'general-photo_view.php?src="\' + filesrc + \'"\', \'#large_photo-modal\');
						}
					});
					
					// Create the remove button
					var removeButton = Dropzone.createElement(\'<a class="btn btn-xs red"><i class="fa fa-trash-o"></i>Remove Image</a>\');

					// Listen to the click event
					removeButton.addEventListener("click", function(e) {
						e.preventDefault();
						e.stopPropagation();

						var deleteFileName = file.previewElement.querySelector(\'[data-dz-name]\').innerHTML;
						x = confirm("Are you sure to delete " + deleteFileName + "?");
						if(!x)  return false;
						var name = deleteFileName;                
						$.ajax({
							type: "POST",
							url: "general-photo_delete.php",
							data: "uploadId=" + $(\'#id_pemohon_borang\').val() + "&filename="+name+ "&uploadFolder=" + uploadPath,
							dataType: "html"
						});
						myDZ_'.$jsItem['input_name'].'.removeFile(file);
						$(\'#file_count_'.$jsItem['input_name'].'\').val(Number($(\'#file_count_'.$jsItem['input_name'].'\').val()) - 1);
					});

					file.previewElement.appendChild(removeButton);
					$(\'#file_count_'.$jsItem['input_name'].'\').val(Number($(\'#file_count_'.$jsItem['input_name'].'\').val()) + 1);
				}
				
			});';
		}
		
	echo '</script>'; 
}
?>

<script src="includes/js/custom-wizard-1.js"></script>	
<script>
function checkUncheckCB(callerId, btnId)
{
	if( $("#" + callerId).is(':checked')) {
        $( "#" + btnId ).prop( "disabled", false );
    }
	else
	{
		$( "#" + btnId ).prop( "disabled", true );
	}
}

var statusmohon = "<?=$statusmohon?>";

if(statusmohon > 2)
{
	$('#borang_dun').prop('disabled', true);
}

$('#borang_kpbaru').change(function(){
	var info = processKP($('#borang_kpbaru').val());
	$('#borang_tkh_lahir').datepicker( "setDate", info[0]);
	$('#borang_jantina').val(info[1]);
	$('#borang_jantina').trigger('change');
	$('#borang_tkh_lahir').prop('disabled', true);
	$('#borang_jantina').prop('disabled', true);
});
$('#borang_kpbaru').trigger('change');

$('#borang_kpbaru_pasangan').change(function(){
	var info = processKP($('#borang_kpbaru_pasangan').val());
	$('#borang_tkh_lahir_pasangan').datepicker( "setDate", info[0]);
	//$('#borang_jantina_pasangan').val(info[1]);
	$('#borang_jantina_pasangan').trigger('change');
	$('#borang_tkh_lahir_pasangan').prop('disabled', true);
	//$('#borang_jantina_pasangan').prop('disabled', true);
});
$('#borang_kpbaru_pasangan').trigger('change');

$("#borang_poskod").change(function(){ 
	if($("#borang_poskod").val() > 0)
	{
		var element = $(this).find('option:selected'); 
		var cTag1 = element.attr("cTag1"); 
		var cTag2 = element.attr("cTag2"); 

		$('#borang_bandar').val(cTag1); 
		$('#borang_negeri').val(cTag2); 
		$('#borang_negeri').trigger('change');
		$('#borang_bandar').prop('disabled', true);
		$('#borang_negeri').prop('disabled', true);
	}
}); 
$('#borang_poskod').trigger('change');

$("#borang_poskod_pasangan").change(function(){ 
	if($("#borang_poskod_pasangan").val() > 0)
	{
		var element = $(this).find('option:selected'); 
		var cTag1 = element.attr("cTag1"); 
		var cTag2 = element.attr("cTag2"); 

		$('#borang_bandar_pasangan').val(cTag1); 
		$('#borang_negeri_pasangan').val(cTag2); 
		$('#borang_negeri_pasangan').trigger('change');
		$('#borang_bandar_pasangan').prop('disabled', true);
		$('#borang_negeri_pasangan').prop('disabled', true);
	}
}); 
$('#borang_poskod_pasangan').trigger('change');

$("#borang_poskod_waris").change(function(){ 
	if($("#borang_poskod_waris").val() > 0)
	{
		var element = $(this).find('option:selected'); 
		var cTag1 = element.attr("cTag1"); 
		var cTag2 = element.attr("cTag2"); 

		$('#borang_bandar_waris').val(cTag1); 
		$('#borang_negeri_waris').val(cTag2); 
		$('#borang_negeri_waris').trigger('change');
		$('#borang_bandar_waris').prop('disabled', true);
		$('#borang_negeri_waris').prop('disabled', true);
	}
}); 
$('#borang_poskod_waris').trigger('change');

$('#borang_carabayar').change(function(){
	var element = $(this).find('option:selected'); 
	var cTag1 = element.attr("cTag1"); 
	var cTag2 = element.attr("cTag2"); 
	$("#borang_no_akaun").prop('minLength', cTag1);
	$("#borang_no_akaun").prop('maxLength', cTag2);
	var form = $(this).closest('form');
	var form_id = form.attr('id').replace("borangForm_", "");
	//console.log(form.attr('id'));
	//console.log(form_id);
	if($('#borang_carabayar').val() == 1)//tunai
	{
		$('#formValidator_' + form_id).val('[["borang_carabayar","Cara Pembayaran","dd"],["borang_sbbtunai","Sebab Tunai","dd"],["borang_byrkepada","Bayar Kepada","dd"]]');
		$('#borang_bank_div').hide();
		$('#borang_no_akaun_div').hide();
		$('#borang_sbbtunai_div').show();
		$('#borang_byrkepada_div').show();
		$('#borang_jenisakaun_div').hide();
		$('#borang_bank').val(0);
		$('#borang_bank').trigger('change');
		$('#borang_jenisakaun').val(0);
		$('#borang_jenisakaun').trigger('change');
		$('#borang_no_akaun').val('');
	}
	else if($('#borang_carabayar').val() == 2)//eft
	{
		$('#formValidator_' + form_id).val('[["borang_carabayar","Cara Pembayaran","dd"],["borang_bank","Bank","dd"],["borang_no_akaun","No Akaun","tb"],["borang_jenisakaun","Jenis Akaun","dd"]]');
		$('#borang_bank_div').show();
		$('#borang_no_akaun_div').show();
		$('#borang_sbbtunai_div').hide();
		$('#borang_byrkepada_div').hide();
		$('#borang_jenisakaun_div').show();
		$('#borang_sbbtunai').val(0);
		$('#borang_sbbtunai').trigger('change');
		$('#borang_byrkepada').val(0);
		$('#borang_byrkepada').trigger('change');
	}
	else
	{
		$('#borang_bank_div').hide();
		$('#borang_no_akaun_div').hide();
		$('#borang_sbbtunai_div').hide();
		$('#borang_jenisakaun_div').hide();
		$('#borang_byrkepada_div').hide();
	}
});
$('#borang_carabayar').trigger('change');									

var idprogram = "<?= $program ?>";	
$('#borang_byrkepada').change(function(){
	var element = $(this).find('option:selected'); 
	var form = $(this).closest('form');
	var form_id = form.attr('id').replace("borangForm_", "");
	var nextDiv = Number(form_id) + 1;
	var nextDiv_Validator = JSON.parse($('#formValidator_' + nextDiv).val());
	
	//clear the added validator, will be handle at bottom
	var defaultValidator = [];
	for (let num = 0; num < nextDiv_Validator.length; num++) {
		if(nextDiv_Validator[num][0] != 'borang_bank_waris' && nextDiv_Validator[num][0] != 'borang_no_akaun_waris' && nextDiv_Validator[num][0] != 'borang_kpbaru_waris')
		{
			defaultValidator.push(nextDiv_Validator[num]);
		}
	}
	
	if($('#borang_byrkepada').val() != 2)//sendiri
	{
		$('#borang_bank_waris_div').hide();
		$('#borang_no_akaun_waris_div').hide();
	}
	else if($('#borang_byrkepada').val() == 2)//waris
	{
		//$('#formValidator_' + form_id).val('[["borang_bank_waris","Bank Waris","dd"],["borang_no_akaun_waris","No Akaun Waris","tb"]]');
		defaultValidator.push(JSON.parse('["borang_bank_waris","Bank Waris","dd"]'));
		defaultValidator.push(JSON.parse('["borang_no_akaun_waris","No Akaun Waris","tb"]'));
																	   
		$('#borang_bank_waris_div').show();
		$('#borang_no_akaun_waris_div').show();
	}
	else
	{
		$('#borang_bank_waris_div').hide();
		$('#borang_no_akaun_waris_div').hide();
	}
	
	console.log(idprogram);
	console.log($('#borang_byrkepada').val());
	if(idprogram != 1 || (idprogram == 1 && $('#borang_byrkepada').val() == 2)) //ibu tunggai & bayar kepada waris
	{
	console.log('need check kp');
		defaultValidator.push(JSON.parse('["borang_kpbaru_waris","No Kp Baru Waris","kp_waris"]'));			
	}
	else
	{
	console.log('no need check kp');
		defaultValidator.push(JSON.parse('["borang_kpbaru_waris","No Kp Baru Waris","kp"]'));			
	}
	$('#formValidator_' + nextDiv).val(JSON.stringify(defaultValidator));
});
$('#borang_byrkepada').trigger('change');							

$('#borang_jenisakaun').change(function(){
	var element = $(this).find('option:selected'); 
	var form = $(this).closest('form');
	var form_id = form.attr('id').replace("borangForm_", "");
	if($('#borang_jenisakaun').val() == 1)//sendiri
	{
		//$('#formValidator_' + form_id).val('');
		$('#borang_nama_kongsiakaun_div').hide();
		$('#borang_nama_kongsiakaun').val('');
	}
	else if($('#borang_jenisakaun').val() == 2)//kongsi
	{
		$('#formValidator_' + form_id).val('[["borang_nama_kongsiakaun","Nama Perkongsian Akaun","tb"]]');
		$('#borang_nama_kongsiakaun_div').show();
	}
	else
	{
		$('#borang_nama_kongsiakaun_div').hide();
		$('#borang_nama_kongsiakaun').val('');
	}
});
$('#borang_jenisakaun').trigger('change');			

$('#borang_warganegara').change(function(){
	var element = $(this).find('option:selected'); 
	var form = $(this).closest('form');
	var form_id = form.attr('id').replace("borangForm_", "");
	if($('#borang_warganegara').val() == 1)//warganegara
	{
		$('#formValidator_' + form_id).val('[["borang_warganegara","Warganegara Pasangan","dd"],["borang_kpbaru_pasangan","No Kp Baru Pasangan","kp"]]');
		$('#borang_kpbaru_pasangan_div').show();
		$('#borang_kplama_pasangan_div').hide();
		$('#borang_kplama_pasangan').val('');
	}
	else if($('#borang_warganegara').val() == 2)//bkn warganegara
	{
		$('#formValidator_' + form_id).val('[["borang_warganegara","Warganegara Pasangan","dd"],["borang_kplama_pasangan","No Kp Lama/Pasport Pasangan","tb"]]');
		$('#borang_kplama_pasangan_div').show();
		$('#borang_kpbaru_pasangan_div').hide();
		$('#borang_kpbaru_pasangan').val('');
	}
});
$('#borang_warganegara').trigger('change');

$('#borang_bank').change(function(){
	var element = $(this).find('option:selected'); 
	var cTag1 = element.attr("cTag1"); 
	var cTag2 = element.attr("cTag2"); 
	$('#borang_no_akaun').val('');
	$("#borang_no_akaun").prop('minLength', cTag1);
	$("#borang_no_akaun").prop('maxLength', cTag2);
});
$('#borang_bank').trigger('change');

$('#borang_bank_waris').change(function(){
	var element = $(this).find('option:selected'); 
	var cTag1 = element.attr("cTag1"); 
	var cTag2 = element.attr("cTag2"); 
	$('#borang_no_akaun_waris').val('');
	$("#borang_no_akaun_waris").prop('minLength', cTag1);
	$("#borang_no_akaun_waris").prop('maxLength', cTag2);
});
$('#borang_bank_waris').trigger('change');

function Copy_Add(){
	if(document.getElementById('borang_alamat').value.length > 0)
		document.getElementById('borang_alamat_waris').value = document.getElementById('borang_alamat').value;
	if(document.getElementById('borang_alamat2').value.length > 0)
		document.getElementById('borang_alamat_waris2').value = document.getElementById('borang_alamat2').value;
	if(document.getElementById('borang_alamat3').value.length > 0)
		document.getElementById('borang_alamat_waris3').value = document.getElementById('borang_alamat3').value;
		
    var $options = $("#borang_poskod > option").clone();
    $('#borang_poskod_waris').empty();
    $('#borang_poskod_waris').append($options);
    $('#borang_poskod_waris').val($('#borang_poskod').val());
	
    var $options = $("#borang_bandar > option").clone();
    $('#borang_bandar_waris').empty();
    $('#borang_bandar_waris').append($options);
    $('#borang_bandar_waris').val($('#borang_bandar').val());
	
    var $options = $("#borang_negeri > option").clone();
    $('#borang_negeri_waris').empty();
    $('#borang_negeri_waris').append($options);
    $('#borang_negeri_waris').val($('#borang_negeri').val());
}

function Copy_AddPas(){
	if(document.getElementById('borang_alamat').value.length > 0)
		document.getElementById('borang_alamat_pasangan').value = document.getElementById('borang_alamat').value;
	if(document.getElementById('borang_alamat2').value.length > 0)
		document.getElementById('borang_alamat_pasangan2').value = document.getElementById('borang_alamat2').value;
	if(document.getElementById('borang_alamat3').value.length > 0)
		document.getElementById('borang_alamat_pasangan3').value = document.getElementById('borang_alamat3').value;
		
    var $options = $("#borang_poskod > option").clone();
    $('#borang_poskod_pasangan').empty();
    $('#borang_poskod_pasangan').append($options);
    $('#borang_poskod_pasangan').val($('#borang_poskod').val());
	
    var $options = $("#borang_bandar > option").clone();
    $('#borang_bandar_pasangan').empty();
    $('#borang_bandar_pasangan').append($options);
    $('#borang_bandar_pasangan').val($('#borang_bandar').val());
	
    var $options = $("#borang_negeri > option").clone();
    $('#borang_negeri_pasangan').empty();
    $('#borang_negeri_pasangan').append($options);
    $('#borang_negeri_pasangan').val($('#borang_negeri').val());
}

function deleteBorangFunction(id, desk, table_name, reloadBtn)
{
	Swal.fire({
        title: "Pastikah Anda?",
        text: "Pastikah untuk menghapuskan '" + desk + "' ?",
        icon: "warning",
        showCancelButton: true,
        confirmButtonText: "Ya",
		cancelButtonText: "Tidak",
    }).then(function(result) {
		if (result.value) {
			$.ajax({
			   type: "POST",
			   url: "pub_borang-delete.php",
			   data: 'id=' + id + '&table=' + table_name,
			   
			   success: function(res){
					swal.fire({
						text: "Berjaya menghapuskan " + desk + ".",
						icon: "success",
						buttonsStyling: false,
						confirmButtonText: "OK!",
						customClass: {
							confirmButton: "btn font-weight-bold btn-light-primary"
						}
					}).then(function() {
						$('#' + reloadBtn).click();
					});
			   
			   }
		   });  //end ajax
		}
	});
}

$(document).ready(function(){ 

	$('.myDatePicker').datepicker({
		autoclose: true,
		clearBtn: true,
		format: "dd M yyyy",
		todayHighlight: true,
		orientation: "bottom left",
		templates: {
			leftArrow: '<i class="la la-angle-left"></i>',
			rightArrow: '<i class="la la-angle-right"></i>'
		}
	});
	
	var oriid = "<?=$myID?>";
	var oriprog = "<?=$program?>";
	$('#submitupdateBtn').click(function() {		
		swal.fire({
			text: "Pengemaskinian berjaya disimpan.",
			icon: "success",
			buttonsStyling: false,
			confirmButtonText: "OK!",
			customClass: {
				confirmButton: "btn font-weight-bold btn-light-primary"
			}
		}).then(function() {
			window.location.href = "index_pemohon.php";
			window.open("general-print_maklumat.php?id=" + oriid + "&program=" + oriprog);
		});		
	});
});		
</script>