<script type="text/javascript">
	
	function populateEmpDetail(elem) {
		var json = JSON.parse(atob($(elem).data('content')));
		console.log(json);

		$('#idEditJoiningGroup').val(json.profiling_id);
		$('#reasonEditJoiningGroup').val(json.reason_id);
		$('#positionEditJoiningGroup').val(json.position_id);
		$('#posInfoEditJoiningGroup').val(json.position_information);
		$('#empGradeJoiningGroup').val(json.employee_grade);
		$('#empReportingToJoiningGroup').val(json.user_reporting_id);
		$('#branchJoiningGroup').val(json.branch_id);
		$('#personnelAreaJoiningGroup').val(json.personnel_area_id);
		$('#personalAreaJoiningGroup').val(json.personal_subarea_id);
		$('#empGroupJoiningGroup').val(json.employee_group_id);
		$('#contractElementJoiningGroup').val(json.contract_element_id);
		$('#empSubgroupJoiningGroup').val(json.employee_subgroup_id);
		$('#empStatusJoiningGroup').val(json.is_active);
		$('#businessEntityJoiningGroup').val(json.business_entity_id);
	}

	function openModal() {
		$modal_id = $('#select-action').find(':selected').data('modal');
		$($modal_id).modal('show');
		$('#mdlAction').modal('hide');
	}

	function removeActionEmploymentDetail(elem) {
		var id = $(elem).data('id');
		iziToast.question({
	        title: '',
	        timeout:20000,
	        close: false,
	        toastOnce: true,
	        message: 'Are you sure you want to remove this record? ',
	        position:"center",
	        buttons: [
	                    ['<button><b>YES</b></button>', function (instance, toast) {
	                      	_removeActionEmployment(id);
	                        instance.hide(toast, {
	                            transitionOut: 'fadeOutUp'
	                        });
	                    }],
	                    ["<button>No</button>", function (instance, toast) {
	                        instance.hide(toast, {
	                            transitionOut: 'fadeOutUp'
	                        });
	                        iziToast.warning({
	                            position: 'bottomRight',
	                            message: 'Operation cancelled.'
	                        });

	                    },true]
	                ]
        });
	}

	function _removeActionEmployment(id){
		var url = "<?php echo base_url('hr/StaffProfile/removeJoiningGroup'); ?>";
		var data = {
			id:id
		}
		ajxRequest(url, 'POST', data, '<?php echo current_url(); ?>');
	}

	/* testing */
</script>