require(['config'], function() {
	require([
		'jquery'
	], function($) {

	});
});

var popPageObj = {
	init: function () {
		this.button();
		this.change();
	},
	parentPopFn: null,
	args: null,
	returnType: null,
	button: function() {
		$('#ITP_BTN_PO_REJECT_REASON_CLOSE_POP').on('click', function () {
			$('#ITP_BIZPOP_PO_REJECT_REASON').modal('hide'); // 팝업닫기
		});
		$('#ITP_BTN_PO_REJECT_REASON_CONFIRM_POP').on('click', function () {
			popPageObj.fnRjctRsnConfirm();
		});
	}, 
	change: function() {
	}, 	
	fnRjctRsnConfirm: function() {
		const formId = '#ITP_FORM_PO_REJECT_REASON_POPUP';
		itp_fn_form_clear_validate(null, formId);
		
		var vali_dsptRjctRsn = itp_fn_form_validate(formId, formId + '_DSPT_RJCT_RSN', ['empty'], undefined);
		
		if (vali_dsptRjctRsn) {		
			var dsptRjctRsn = $('#ITP_FORM_PO_REJECT_REASON_POPUP_DSPT_RJCT_RSN').val();	
			popPageObj.parentPopFn(dsptRjctRsn);
			$('#ITP_BIZPOP_PO_REJECT_REASON').modal('hide'); // 팝업닫기
		}
	} 
};

function itp_fn_BIZPOP_PO_REJECT_REASON(parentPopFn, args, returnType) {
	$('#ITP_BIZPOP_PO_REJECT_REASON').one('shown.bs.modal', function(e) {
		itp_fn_fire_window_resize();
	}).one('hidden.bs.modal', function(e) {
		$('#ITP_BIZPOP_PO_REJECT_REASON').remove();
	}).modal('show');

	popPageObj.parentPopFn = parentPopFn;
	popPageObj.args = args;
	popPageObj.returnType = returnType;
	popPageObj.init();
}
