/* 페이징 관련 변수 */
let userReserveHistoryTotalCount   = 0;
let userReserveHistoryTotalPages   = 0;

/*aggird*/
let userReserveHistoryAgGridData = [];

let userReserveHistorySelectId = "";

/****************************************************************************
* 검색 날짜 설정
//(A:오늘, B:3일, C:7일, D:최근30일, E:최근90일, F:이번달, G:올해, H:지난주, I:지난달)
****************************************************************************/
function fn_userReserveHistorySetDate(param){
	if("A"==param){
		// 오늘
		let toDate = new Date();
		let year  = toDate.getFullYear();
		let month = toDate.getMonth() + 1;
		let day   = toDate.getDate();
		
		if(month < 10) month = "0" + month;
		if(day < 10) day = "0" + day;
		
		userReserveHistorySearchStartDate = year+'-'+month+'-'+day;
		userReserveHistorySearchEndDate   = year+'-'+month+'-'+day;
	}
	else if("B"==param){
		// 3일
		// 검색 종료일자
		let toDate = new Date();
		let year  = toDate.getFullYear();
		let month = toDate.getMonth() + 1;
		let day   = toDate.getDate();
		
		if(month < 10) month = "0" + month;
		if(day < 10) day = "0" + day;
		
		userReserveHistorySearchEndDate   = year+'-'+month+'-'+day;
		
		// 검색 시작일자
		toDate.setDate(toDate.getDate() - 3);
		year  = toDate.getFullYear();
		month = toDate.getMonth() + 1;
		day   = toDate.getDate();
		
		if(month < 10) month = "0" + month;
		if(day < 10) day = "0" + day;
		
		userReserveHistorySearchStartDate = year+'-'+month+'-'+day;
	}
	else if("C"==param){
		// 이번주
		// 검색 종료일자
		let toDate = new Date();
		let year  = toDate.getFullYear();
		let month = toDate.getMonth() + 1;
		let day   = toDate.getDate();
		
		if(month < 10) month = "0" + month;
		if(day < 10) day = "0" + day;
		
		userReserveHistorySearchEndDate   = year+'-'+month+'-'+day;
		
		// 검색 시작일자
		toDate.setDate(toDate.getDate() - 7);
		year  = toDate.getFullYear();
		month = toDate.getMonth() + 1;
		day   = toDate.getDate();
		
		if(month < 10) month = "0" + month;
		if(day < 10) day = "0" + day;
		
		userReserveHistorySearchStartDate = year+'-'+month+'-'+day;
	}
	else if("D"==param){
		// 최근30일
		let toDate = new Date();
		let year  = toDate.getFullYear();
		let month = toDate.getMonth() + 1;
		let day   = toDate.getDate();
		
		if(month < 10) month = "0" + month;
		if(day < 10) day = "0" + day;
		
		//최근30일
		toDate.setDate(toDate.getDate() - 30);
		startYear  = toDate.getFullYear();
		startMonth = toDate.getMonth() + 1;
		startDay   = toDate.getDate();
		
		if(startMonth < 10) startMonth = "0" + startMonth;
		if(startDay < 10) startDay = "0" + startDay;
		
		userReserveHistorySearchStartDate = startYear+'-'+startMonth+'-'+startDay;
		userReserveHistorySearchEndDate   = year+'-'+month+'-'+day;
		
	}
	else if("E"==param){
		// 최근90일
		// 검색 종료일자
		let toDate = new Date();
		let year  = toDate.getFullYear();
		let month = toDate.getMonth() + 1;
		let day   = toDate.getDate();
		
		if(month < 10) month = "0" + month;
		if(day < 10) day = "0" + day;
		
		userReserveHistorySearchEndDate   = year+'-'+month+'-'+day;
		
		// 검색 시작일자
		toDate.setDate(toDate.getDate() - 90);
		year  = toDate.getFullYear();
		month = toDate.getMonth() + 1;
		day   = toDate.getDate();
		
		if(month < 10) month = "0" + month;
		if(day < 10) day = "0" + day;
		
		userReserveHistorySearchStartDate = year+'-'+month+'-'+day;
	}
	else if("F"==param){
		//F:이번달
		// 검색 종료일자
		let toDate = new Date();
		let year  = toDate.getFullYear();
		let month = toDate.getMonth() + 1;
		let day   = toDate.getDate();
		
		if(month < 10) month = "0" + month;
		if(day < 10) day = "0" + day;
		
		userReserveHistorySearchEndDate   = year+'-'+month+'-'+day;
		
		// 검색 시작일자
		userReserveHistorySearchStartDate = year+'-'+month+'-01';
	}
	else if("G"==param){
		// G:올해
		// 검색 종료일자
		let toDate = new Date();
		let year  = toDate.getFullYear();
		let month = toDate.getMonth() + 1;
		let day   = toDate.getDate();
		
		if(month < 10) month = "0" + month;
		if(day < 10) day = "0" + day;
		
		userReserveHistorySearchEndDate   = year+'-'+month+'-'+day;
		
		// 검색 시작일자
		userReserveHistorySearchStartDate = year+'-01-01';
	}
	else if("H"==param){
		// H:지난주, I:지난달
		// 검색 종료일자
		let toDate = new Date();
		let year  = toDate.getFullYear();
		let month = toDate.getMonth() + 1;
		let day   = toDate.getDate();
		
		if(month < 10) month = "0" + month;
		if(day < 10) day = "0" + day;
		
		userReserveHistorySearchEndDate   = year+'-'+month+'-'+day;
		
		// 검색 시작일자
		userReserveHistorySearchStartDate = year+'-01-01';
	}
	else if("I"==param){
		// I:지난달
		// 검색 종료일자
		let toDate = new Date();
		let year  = toDate.getFullYear();
		let month = toDate.getMonth() + 1;
		let day   = toDate.getDate();
		
		if(month < 10) month = "0" + month;
		if(day < 10) day = "0" + day;
		
		userReserveHistorySearchEndDate   = year+'-'+month+'-'+day;
		
		// 검색 시작일자
		userReserveHistorySearchStartDate = year+'-01-01';
	}
	
	$("#userReserveHistorySearchStartDate").val(userReserveHistorySearchStartDate).trigger("change");
	$("#userReserveHistorySearchEndDate").val(userReserveHistorySearchEndDate).trigger("change");
}

/****************************************************************************
* 진료 콤보데이타 설정
****************************************************************************/
function fn_setTreatmentCombo(paramTarget, allYn, clickCallEvent){
	let target = paramTarget.next(".select_option_list");
	
	let comboData = fn_selectListTreatmentOption2();
	
	// 전체옵션 여부
	if('Y'==allYn){
		comboHTML = ' <li class="option_list_item">';
		comboHTML += '	<input type="hidden" name="comboId" value=""/>';
		comboHTML += '	<span>진료 전체</span>';
		comboHTML += '</li>';
	}
	
	for(let i = 0; i < comboData.length; i++){
		let muTreatmentId     = comboData[i].muTreatmentId;
		let treatmentName     = comboData[i].treatmentName;
		
		comboHTML += '<li class="option_list_item">';
		comboHTML += '	<input type="hidden" name="comboId" value="'+muTreatmentId+'"/>';
		comboHTML += '	<span>'+treatmentName+'</span>';
		comboHTML += '</li>';
	}
	target.html(comboHTML);
	
	target.find("li.option_list_item").click(function () {
		// 1. 선택값 셋팅
		let selectId    = $(this).find('input[name="comboId"]').val();
		let selectName  = $(this).find('span').text(); 
		
		$(this).parent().siblings("button").text(selectName);
		$(this).parent().siblings("input").val(selectId);
		
		if( clickCallEvent )  {
			clickCallEvent(selectId);
		}
	});
	
	// 초기화
	target.find("li:eq(0)").click();
}


/****************************************************************************
* 시술 콤보데이타 설정
****************************************************************************/
function fn_setTreatmentProcedureCombo(paramTarget, param, allYn, clickCallEvent){
	let target = paramTarget.next(".select_option_list");
	
	let comboData = fn_selectListTreatmentProcedureOption(param);
	
	let comboHTML = '';
	
	// 전체옵션 여부
	if('Y'==allYn){
		comboHTML = ' <li class="option_list_item">';
		comboHTML += '	<input type="hidden" name="comboId" value=""/>';
		comboHTML += '	<span>시술 전체</span>';
		comboHTML += '</li>';
	}
	
	for(let i = 0; i < comboData.length; i++){
		let muTreatmentProcedureId = comboData[i].muTreatmentProcedureId;
		let treatmentProcedureName = comboData[i].treatmentProcedureName;
		
		comboHTML += '<li class="option_list_item">';
		comboHTML += '	<input type="hidden" name="comboId" value="'+muTreatmentProcedureId+'"/>';
		comboHTML += '	<span>'+treatmentProcedureName+'</span>';
		comboHTML += '</li>';
	}
	target.html(comboHTML);
	
	target.find("li.option_list_item").click(function () {
		// 1. 선택값 셋팅
		let selectId    = $(this).find('input[name="comboId"]').val();
		let selectName  = $(this).find('span').text(); 
		
		$(this).parent().siblings("button").text(selectName);
		$(this).parent().siblings("input").val(selectId);
		
		if( clickCallEvent )  {
			clickCallEvent(selectId);
		}
	});
	
	// 초기화
	target.find("li:eq(0)").click();
}

/****************************************************************************
* 닥터/상담 콤보데이타 설정
****************************************************************************/
function fn_setReserveMemberCombo(paramTarget, param, allYn, clickCallEvent){
	let target = paramTarget.next(".select_option_list");
	
	let reserveSearchDate   = '';
	
	let comboData = fn_selectListReserveMemberOption(reserveSearchDate, param);
	
	let comboHTML = '';
	
	// 전체옵션 여부
	if('Y'==allYn){
		comboHTML = ' <li class="option_list_item">';
		comboHTML += '	<input type="hidden" name="comboId" value=""/>';
		comboHTML += '	<span>닥터/상담 전체</span>';
		comboHTML += '</li>';
	}
	
	for(let i = 0; i < comboData.length; i++){
		let muMemberId = comboData[i].muMemberId;
		let memberName = comboData[i].memberName;
		let typeName   = comboData[i].typeName;
		
		comboHTML += '<li class="option_list_item">';
		comboHTML += '	<input type="hidden" name="comboId" value="'+muMemberId+'"/>';
		comboHTML += '	<span>'+typeName+' '+memberName+'</span>';
		comboHTML += '</li>';
	}
	target.html(comboHTML);
	
	target.find("li.option_list_item").click(function () {
		// 1. 선택값 셋팅
		let selectId    = $(this).find('input[name="comboId"]').val();
		let selectName  = $(this).find('span').text();
		
		$(this).parent().siblings("button").text(selectName);
		$(this).parent().siblings("input").val(selectId);
		
		if( clickCallEvent )  {
			clickCallEvent(selectId);
		}
	});
	
	// 초기화
	target.find("li:eq(0)").click();
}

/****************************************************************************
* 고객 상세 - 고객 예약내역 리스트 조회 (List)
****************************************************************************/
function fn_selectListReserveUserHistory(){
	let formData = new FormData();
	formData.append("menuClass", menuClass);
	formData.append("sort", userReserveHistorySort);
	formData.append("dir", userReserveHistoryDir);
	formData.append("start", userReserveHistoryStart);
	formData.append("limit", userReserveHistoryLimit);
	formData.append("searchKeywordParam", userReserveHistorySearchKeywordParam);
	formData.append("searchStartDate", userReserveHistorySearchStartDate);
	formData.append("searchEndDate", userReserveHistorySearchEndDate);
	formData.append("searchDateType", userReserveHistorySearchDateType);
	formData.append("muTreatmentId", userReserveHistoryTreatmentId);
	formData.append("muTreatmentProcedureId", userReserveHistoryTreatmentProcedureId);
	formData.append("reserveMemberId", userReserveHistoryReserveMemberId);
	formData.append("muUserId", muUserId);

	$.ajax({
		url: encodeURI('/webreserve/selectListReserveUserHistory.do'),
		data: formData,
		dataType: "json",
		processData: false,
		contentType: false,
		type: 'POST',
		async: true,
		success: function(data){
			if('0'==data.msgCode){
				// 페이징 처리
				userReserveHistoryTotalCount  = data.totalCount;
				//$("#txt_userReserveHistoryTotalCount").text(userReserveHistoryTotalCount);

				userReserveHistoryTotalPages = Math.ceil(userReserveHistoryTotalCount/userReserveHistoryLimit);
				
				// 리스트 조회
				userReserveHistoryAgGridData = data.rows;
				userReserveHistoryGridOptions.api.setRowData(userReserveHistoryAgGridData);
				
				if(0<data.rows.length){
					//페이징 처리
					window.pagObj = $('#userReserveHistoryPagination').twbsPagination({
						startPage    : ((userReserveHistoryStart/userReserveHistoryLimit)+1),
						totalPages   : (userReserveHistoryTotalPages==0)?1:userReserveHistoryTotalPages,
						visiblePages : 10,
						initiateStartPageClick: false,
						prev         : '<img src="/image/web/page_navigation_arrow.svg" alt="prev"/>',
						next         : '<img src="/image/web/page_navigation_arrow.svg" alt="next"/>',
						first        : '',
						last         : '',
						onPageClick: function (event, page) {
							fn_userReserveHistoryPagination(page);
						}
					}).on('page', function (event, page) {
						//console.info(page + ' (from event listening)');
					});
				}
				else{
					
				}
			}
			else{
				modalEvent.danger("조회 오류", data.msgDesc);
			}
		},
		error : function(xhr, status, error) {
			modalEvent.danger("조회 오류", "조회 중 오류가 발생하였습니다. 잠시후 다시시도하십시오.");
		},
		beforeSend:function(){
			// 로딩열기
			userReserveHistoryGridOptions.api.showLoadingOverlay();
		},
		complete:function(){
			
		}
	});
}

/****************************************************************************
* 검색하기
****************************************************************************/
function fn_userReserveHistorySearch(param){
	if("A"!=param && "Y"!=selectUseYn){
		modalEvent.warning("", "조회 권한이 없습니다.");
		return false;
	}
	
	fn_userReserveHistoryPaginReset();

	userReserveHistorySearchKeywordParam = $("#userReserveHistorySearchKeyword").val();
	
	userReserveHistorySearchDateType  = $("#userReserveHistorySearchDateType").val();
	userReserveHistorySearchStartDate = $("#userReserveHistorySearchStartDate").val();
	userReserveHistorySearchEndDate   = $("#userReserveHistorySearchEndDate").val();
	
	userReserveHistoryTreatmentId           = $("#userReserveHistoryTreatmentId").val();
	userReserveHistoryTreatmentProcedureId  = $("#userReserveHistoryTreatmentProcedureId").val();
	userReserveHistoryReserveMemberId       = $("#userReserveHistoryReserveMemberId").val();
	
	fn_selectListReserveUserHistory();
}


/****************************************************************************
* 초기화하기
****************************************************************************/
function fn_userReserveHistoryReset(){
	// 기간검색 최근30일로 초기화
	$("#userReserveHistorySearchDateType").next(".select_option_list").find("li:eq(1)").click();

	fn_userReserveHistorySearch();
}

/****************************************************************************
* 페이징 처리
****************************************************************************/
function fn_userReserveHistoryPagination(param){
	userReserveHistoryStart = (parseInt(param)-1)*userReserveHistoryLimit;
	
	fn_selectListReserveUserHistory();
}

/****************************************************************************
* 페이징 리셋
****************************************************************************/
function fn_userReserveHistoryPaginReset(){

	userReserveHistoryStart        = 0;
	userReserveHistoryLimit        = 100;
	userReserveHistoryTotalCount   = 0;
	userReserveHistoryTotalPages   = 0;
	
	//페이징 초기화
	if($("#userReserveHistoryPagination").data("twbs-pagination")){
		$("#userReserveHistoryPagination").twbsPagination("destroy");
	}
}


/****************************************************************************
* 검색 엔터 이벤트
****************************************************************************/
function fn_userReserveHistoryEnter(e){
	if(e.which){
		// 파이어폭스
		if(13 == e.which) {
			//로그인 액션 스크립트
			fn_userReserveHistorySearch();
		}
	}
	else{
		// 윈도우, 사파리, 크롬
		if(13 == event.keyCode) {
			//로그인 액션 스크립트
			fn_userReserveHistorySearch();
		}
	}
}

/****************************************************************************
* 콤보 선택 이벤트
****************************************************************************/
function fn_setComboEvent(param, clickCallEvent, firstCheckYn){
	let target = param.next(".select_option_list");
		
	target.find("li.option_list_item").click(function () {
		// 1. 선택값 셋팅
		let selectId    = $(this).find('input[name="comboId"]').val();
		let selectName  = $(this).find('span').text(); 
		
		$(this).parent().siblings("button").text(selectName);
		$(this).parent().siblings("input").val(selectId);
		
		if( clickCallEvent )  {
			clickCallEvent(selectId);
		}
	});
	
	// 초기화
	if('Y' == firstCheckYn){
		target.find("li:eq(0)").click();
	}
}

/****************************************************************************
* 완료
****************************************************************************/
function fn_userReserveHistoryOk(){
	fn_userReserveHistoryReset();
}

function fn_userReserveHistoryCancel(){
	let pagingParam = "?menuClass="+menuClass;
	pagingParam    += "&sort="+userReserveHistorySort;
	pagingParam    += "&dir="+userReserveHistoryDir;
	pagingParam    += "&start="+userReserveHistoryStart;
	pagingParam    += "&limit="+userReserveHistoryLimit;
	pagingParam    += "&searchStartDate="+userReserveHistorySearchStartDate;
	pagingParam    += "&searchEndDate="+userReserveHistorySearchEndDate;
	pagingParam    += "&searchDateType="+userReserveHistorySearchDateType;
	pagingParam    += "&muTreatmentId="+userReserveHistoryTreatmentId;
	pagingParam    += "&muTreatmentProcedureId="+userReserveHistoryTreatmentProcedureId;
	pagingParam    += "&reserveMemberId="+userReserveHistoryReserveMemberId;
	pagingParam    += "&muUserId="+muUserId;
	
	fn_leftFormAction("/webreserve/selectListStockStautsIntro.do"+pagingParam);
}



/****************************************************************************
* 엑셀 다운 다운로드
****************************************************************************/
function fn_downloadUserReserveHistoryExcel(){
	if("Y"==downloadUseYn){
		// 수정가능
		let pagingParam = "?menuClass="+menuClass;
		pagingParam    += "&sort="+userReserveHistorySort;
		pagingParam    += "&dir="+userReserveHistoryDir;
		pagingParam    += "&start="+userReserveHistoryStart;
		pagingParam    += "&limit="+userReserveHistoryLimit;
		pagingParam    += "&searchStartDate="+userReserveHistorySearchStartDate;
		pagingParam    += "&searchEndDate="+userReserveHistorySearchEndDate;
		pagingParam    += "&searchDateType="+userReserveHistorySearchDateType;
		pagingParam    += "&muTreatmentId="+userReserveHistoryTreatmentId;
		pagingParam    += "&muTreatmentProcedureId="+userReserveHistoryTreatmentProcedureId;
		pagingParam    += "&reserveMemberId="+userReserveHistoryReserveMemberId;
		pagingParam    += "&muUserId="+muUserId;
		
		let url = encodeURI("/webreserve/downloadReserveUserHistoryExcel.do"+pagingParam);
		$("#userReserveHistorySelectListForm").prop("action",url);
		$("#userReserveHistorySelectListForm").submit();
	}
	else{
		modalEvent.warning("", "내려받기 권한이 없습니다.");
		return false;
	}
}

let userReserveHistoryColumnDefs = [
	/*{field: "checkbox", headerName:"", minWidth: columnWidth, maxWidth: columnWidth, headerCheckboxSelection: true, checkboxSelection: true},*/
	{field: "rowNum", headerName:"번호", minWidth:60,sortable: false, cellStyle:{textAlign: 'center'}},
	{field: "reserveDate", headerName:"예약날짜", minWidth: 100, maxWidth: 100},
	{field: "reserveTime", headerName:"예약시간", minWidth: 85, maxWidth: 85},
	{field: "treatmentName", headerName:"진료명", minWidth: 100, maxWidth: 150},
	{field: "treatmentProcedureName", headerName:"시술명", minWidth: 150},
	{field: "reserveMemberName", headerName:"닥터/상담자명", minWidth: 100, maxWidth: 150},
	{field: "memberName", headerName:"담당자명", minWidth: 100, maxWidth: 150},
	{field: "userEtc", headerName:"특이사항", minWidth: 250},
	{field: "etc", headerName:"예약메모",minWidth: 250},
	{field: "statusName", headerName:"상태", minWidth: 100, maxWidth: 120},
	{field: "chart", headerName:"차트", minWidth: 120, maxWidth: 120}
];
// let the grid know which columns and what data to use
let userReserveHistoryGridOptions = {
	suppressRowTransform: true,
	columnDefs: userReserveHistoryColumnDefs,
	defaultColDef: {		// 리스트 기본 설정
		flex: 1,
		sortable: true,		//정렬 여부
		resizable: true,	//리사이즈
		editable: false,	// 그리드에서 데이터 수정
		cellStyle:{textAlign:'left',fontSize:'14px',padding:'0'},
		//suppressSizeToFit:true,		//자동 맞춤
		//enableRowGroup: true,		// 그룹 묶음
		enablePivot: true,
		enableValue : true
	},
	//suppressMultiSort:true,  //단일솔트 true가 단일, false가 다중 shift + sort 시
	headerHeight : 41, // header 높이
	rowHeight : 41, // row 높이
	rowData : userReserveHistoryAgGridData,
	suppressRowClickSelection : true, // 로우 클릭시 체크박스 선택 true no, false yes
	localeText : {
		noRowsToShow : '조회 결과가 없습니다.'
	}, //데이터 없을 시 나오는 문구
	rowSelection : 'multiple', // row 다중 선택
	debug : false,
	onCellClicked: function(event){ //셀 클릭 이벤트
		//if(event.column.colId=='originalFileName'){
		//}
	},
	onSelectionChanged: function(event){ //체크박스 선택
		let selectRows = [];
		selectRows = event.api.getSelectedRows();
	},
	onSortChanged: function(event){
		 //정렬
		userReserveHistorySort = ''; //기존 정렬 초기화
		let columnArr = event.columnApi.getColumnState();
		if(0<columnArr.length){
			//sort index 순으로 재정렬
			columnArr.sort(function(a,b){
				return a.sortIndex - b.sortIndex;
			});
			
			let nullCnt = 0;
			for(let i=0; i<columnArr.length; i++){
				let gridSortModel = columnArr[i].colId;
				let gridSort = columnArr[i].sort;
				
				if(gridSort != null){
					userReserveHistoryStart = 0;
					userReserveHistorySort += gridSortModel+' '+ gridSort + ',';
				}
				else{
					nullCnt++;
					if(nullCnt == columnArr.length){
						userReserveHistorySort = '';
						userReserveHistoryDir = '';
						userReserveHistoryStart = 0;
					}
				}
			}
		}
		userReserveHistorySort = userReserveHistorySort.substring(0,userReserveHistorySort.lastIndexOf( ",")); //맨끝 콤마 지우기

		fn_userReserveHistorySearch();
	}
};

// lookup the container we want the Grid to use
let userReserveHistoryGridDiv = document.querySelector('#userReserveHistoryGrid');

// create the grid passing in the div to use together with the columns & data we want to use
new agGrid.Grid(userReserveHistoryGridDiv, userReserveHistoryGridOptions);


/****************************************************************************
* 페이지 init
****************************************************************************/
function fn_pageInit(){
	// 검색 기간 콤보 선택 이벤트
	let comboTarget = $("#userReserveHistorySearchDateType");
	fn_setComboEvent(comboTarget, function(value){
		fn_userReserveHistorySetDate(value);
	}, 'N');
	
	// 날짜 datepicker
	fn_searchDatePicker("#userReserveHistorySearchStartDate", "#userReserveHistorySearchEndDate");
	
	if(!userReserveHistorySearchStartDate&&!userReserveHistorySearchStartDate){
		// 기간검색 최근30일로 초기화
		$("#userReserveHistorySearchDateType").next(".select_option_list").find("li:eq(5)").click();
	}
	else{
		$("#userReserveHistorySearchStartDate").val(userReserveHistorySearchStartDate).trigger("change");;
		$("#userReserveHistorySearchEndDate").val(userReserveHistorySearchEndDate).trigger("change");
	}
	
	// 진료 콤보데이타 설정
	let comboTarget1 = $('#userReserveHistoryTreatmentId');
	fn_setTreatmentCombo(comboTarget1, 'Y', function(value){
		let selectId = value;
		
		// 진료시술 콤보 셋팅
		let comboTarget2 = $('#userReserveHistoryTreatmentProcedureId');
		fn_setTreatmentProcedureCombo(comboTarget2, selectId, 'Y', function(value){
			let selectId = value;
			
			// 닥터/상담 콤보 셋팅
			let comboTarget3 = $('#userReserveHistoryReserveMemberId');
			fn_setReserveMemberCombo(comboTarget3, selectId, 'Y', function(value){});
		});
	});
		
	
	
	fn_userReserveHistorySearch("A");
}

/****************************************************************************
* 페이지 event
****************************************************************************/
function fn_pageEvent(){
	// 검색 조회 버튼
	$("#btnSearchUserReserveHistory").click(function () {
		fn_userReserveHistorySearch();
	});
	
	// 예약 내역 Excel 다운로드 버튼
	$("#btnDownloadUserReserveHistoryExcel").click(function () {
		fn_downloadUserReserveHistoryExcel();
	});
}

$(function(){
	// 페이지 init
	fn_pageInit();
	
	// 페이지 event
	fn_pageEvent();
});