<script type="text/javascript">
	$(document).ready(function(){
		console.log('tab bank details loaded..');
	});

	function btnEditBank(elem) {
		var b64 	= $(elem).data('content');
		var json 	= JSON.parse(atob(b64));

		// console.log(json);
		$('#mdl-bank-id').val(json.id); 
		$('#mdl-bankdetail-bank_id').val(json.bank_id);
		$('#mdl-bankdetail-branch').val(json.branch);
		$('#mdl-bankdetail-acc_no').val(json.acc_no);
		$('#mdl-bankdetail-status').val(json.status);
	}

	function btnRemoveBank(id) {
		toastConfirm('Are you sure you want to remove this record', function () {
			_removeBank(id);
		});
	}

	function _removeBank(id) {
		var frmData = new FormData();
		frmData.append('id',id);

		$.ajax({
            url:"<?php echo base_url('hr/StaffProfile/removeBank/'); ?>",
            type:'post',
            dataType:'json', //return type value
            data:frmData,
            processData: false,
            contentType: false,
            success:function(data){
                iziToast.success({
                    title: '',
                    message:'success'
                });
                window.location.replace("<?php echo base_url('hr/StaffProfile/staffDetail/'.$this->uri->segment(4)); ?>");            
            },error:function(){
                iziToast.error({
                    title: '',
                    message: '500 internal server error'
                });
            }
        });
	}
</script>