require(['config'], function() {
	require([
		'jquery',
		'jquery.bootstrap.fileUpload', //파일 업로드가 있는 페이지에서 로딩 
		'check'
	], function($) {

	});
});

let NTICE_INFO_NTICE = '/api/ntice/info-ntice';

function itp_fn_NOTICE_INFO_POPUP(parentPopFn, args, returnType) {
	
	fn_ajax_call(NTICE_INFO_NTICE, args, function(result) {
		
		$('#ITP_FORM_NOTICE_INFO_POPUP_NTICE_NO').val(result.nticeNo);
		$('#ITP_FORM_NOTICE_INFO_POPUP_TARGET_CD').val(result.targetCd);
		$('#ITP_FORM_NOTICE_INFO_POPUP_FILE_NO').val(result.fileNo); //파일번호 셋팅

		// 브랜드그룹 셋팅
		$('#ITP_FORM_NOTICE_INFO_POPUP_NTICE_TITL').val(result.nticeTitl);
		$('#ITP_FORM_NOTICE_INFO_POPUP_NTICE_DESC').val(result.nticeDesc);
		$('#ITP_FORM_NOTICE_INFO_POPUP_FROM_TO').html(result.notiStDay+' ~ '+result.notiEdDay); 
		$('#ITP_FORM_NOTICE_INFO_POPUP_AFFL_SHOP_NM').html(result.afflShopNm);
		$('#ITP_FORM_NOTICE_INFO_POPUP_BRAND_NM').html(result.brandNm);

		setFileUploadInfoPopup();
		
		formReadonly('#ITP_FORM_NOTICE_INFO_POPUP .form-control');
		 	
	}, 'GET');
	
	$('#ITP_NOTICE_INFO_POPUP').one('shown.bs.modal', function(e) {		
		itp_fn_fire_window_resize();
	}).one('hidden.bs.modal', function(e) {
		$('#ITP_NOTICE_INFO_POPUP').remove();
	}).modal('show');
	
};
 

function setFileUploadInfoPopup() {
	//파일업로드(등록/수정화면) 
	const option={
		url: DOMAIN + '/api/file/upload',
		inputName: 'uploadFile',
		folderName: 'notice',
		fileNumber:  $('#ITP_FORM_NOTICE_INFO_POPUP_FILE_NO').val(),
		fileInput: '#ITP_FORM_NOTICE_INFO_POPUP_FILE_NO',
		fileTypes: ITP_UPLOAD_DEFAULTS.fileTypes,
		viewCode: 'R',
		formMethod: 'post',
		multiFile: true,
		multiUpload: false,
		maxSize: 100,
		maxFiles: 5,
		showThumb: false,
		thumbWidth: 0,
  		thumbHeight: 0,
		debug: true, 
		screen_id: 'ITP_FORM_NOTICE_INFO_POPUP',
		showYn: false, 
	};
	console.log("option ==> ",option)
	$('#ITP_FORM_NOTICE_INFO_POPUP_UPLOAD').empty(); 
	$('#ITP_FORM_NOTICE_INFO_POPUP_UPLOAD').bootstrapFileUpload(option);

	setTimeout(function() {
		$('#ITP_FORM_NOTICE_INFO_POPUP_UPLOAD_FORM').hide(); 
	},20);

}