
/* ##############################################################
	설  명 : [Modal] 접수 대기 상세 팝업
	작성일 : 2024. 10. 02.
	작성자 : NTsoft
	수정일 	        수정자 	 수정내용
	-------         -------- ---------------------------
	2024. 10. 02.	NTsoft 	 최초 생성
*/
let selectPastReserveModal = {
    callback : null,
    reqParam : null,
    dataList : null,
    /* 모달 초기화 작업 */
    init : function () {
        $('#selectPastReserveModal').remove();
        $('body').append( this.HtmlTemplate);
        //그리드 이벤트
        this.setEvent();

    },
    /* 그리드 이벤트 설정 */
    setEvent:function() {
        $('#selectPastReserveModal .btnCancle').on("click", function(){
            selectPastReserveModal.close();
        });
    },
    setData: function() {
        $('#selectPastReserveModal #userName').text(this.reqParam.userName);
        $('#selectPastReserveModal #waitingCount').text(this.reqParam.waitingCount || '0');
        $('#selectPastReserveModal #reserveDate').text(`${this.reqParam.reserveDate}, ${this.reqParam.reserveTime}`);
        $('#selectPastReserveModal #treatmentName').text(this.reqParam.treatmentName);
        $('#selectPastReserveModal #treatmentProcedureName').text(this.reqParam.treatmentProcedureName);
        $('#selectPastReserveModal #status').text(fn_setReserveStatus(this.reqParam.status));
    },
    /* 데이터 선택 */
    setSelect:function(selectNumber) {
        let checkedData = dataList[selectNumber];
        if(dataList==null||checkedData==undefined){
            return ;
        }

        if( selectPastReserveModal.callback )  {
            selectPastReserveModal.callback(checkedData);
        }
        selectPastReserveModal.close();
    },
    // 상세 조회
    search:function(state) {
    },
    /*
     * 팝업
     * callback : 콜백함수, reqParam: 팝업파라미터
     */
    popup:function(callback, reqParam) {
        // 초기화 후 열기
        selectPastReserveModal.init();

        //콜백함수 지정.
        selectPastReserveModal.callback = callback;
        selectPastReserveModal.reqParam = reqParam;
        selectPastReserveModal.dataList = null;

        // 데이터 바인딩
        this.setData();
        setTimeout(function(){
            $('#selectPastReserveModal').modal('show')
        }, 200);

        selectPastReserveModal.search();
    },
    /*
     * 팝업 닫기
     */
    close:function() {
        $('#selectPastReserveModal').modal('hide');

		setTimeout(function(){
			$('#selectPastReserveModal').remove();
		},500);
    },
    HtmlTemplate : `
    <div class="modal past_promise_modal fade" id="selectPastReserveModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <p class="label">
                        안녕하세요 <span id="userName"></span>님!<br/>
                        방문해주셔서 감사합니다.
                    </p>
                </div>
    
                <div class="modal-body">
                    <ul>
                        <li class="first">
                            <p class="label">예약 일시</p>
                            <p id="reserveDate"></p>
                        </li>
                        <li>
                            <p class="label">예약 유형</p>
                            <p id="treatmentName"></p>
                        </li>
                        <li>
                            <p class="label">시술</p>
                            <p id="treatmentProcedureName"></p>
                        </li>
                        <li>
                            <p class="label">상태</p>
                            <p class="blue" id="status"></p>
                        </li>
                    </ul>
                </div>
    
                <div class="modal-footer">
                    <div class="btn_box">
                        <button class="close_btn btnCancle">닫기</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
    `
};