
/* ##############################################################
	설  명 : [Modal] 접수 대기 상세 팝업
	작성일 : 2024. 10. 02.
	작성자 : NTsoft
	수정일 	        수정자 	 수정내용
	-------         -------- ---------------------------
	2024. 10. 02.	NTsoft 	 최초 생성
*/
let selectPromiseCompletedModal = {
    callback : null,
    reqParam : null,
    dataList : null,
    /* 모달 초기화 작업 */
    init : function () {
        $('#selectPromiseCompletedModal').remove();
        $('body').append( this.HtmlTemplate);
        //그리드 이벤트
        this.setEvent();
    },
    /* 그리드 이벤트 설정 */
    setEvent:function() {
        $('#selectPromiseCompletedModal .btnCancle').on("click", function(){
            selectPromiseCompletedModal.close();
        });
    },
    setData: function() {
        $('#selectPromiseCompletedModal #userName').text(this.reqParam.userName);
        $('#selectPromiseCompletedModal #waitingCount').text(this.reqParam.waitingCount || '0');
        $('#selectPromiseCompletedModal #reserveDate').text(`${this.reqParam.reserveDate}, ${this.reqParam.reserveTime}`);
        $('#selectPromiseCompletedModal #treatmentName').text(this.reqParam.treatmentName);
        $('#selectPromiseCompletedModal #treatmentProcedureName').text(this.reqParam.treatmentProcedureName);
        $('#selectPromiseCompletedModal #status').text(fn_setReserveStatus(this.reqParam.status));
    },
    /* 데이터 선택 */
    setSelect:function(selectNumber) {
        let checkedData = dataList[selectNumber];
        if(dataList==null||checkedData==undefined){
            return ;
        }

        if( selectPromiseCompletedModal.callback )  {
            selectPromiseCompletedModal.callback(checkedData);
        }
        selectPromiseCompletedModal.close();
    },
    // 상세 조회
    search:function(state) {

    },
    /*
     * 팝업
     * callback : 콜백함수, reqParam: 팝업파라미터
     */
    popup:function(callback, reqParam) {
        // 초기화 후 열기
        selectPromiseCompletedModal.init();

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

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

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

		setTimeout(function(){
			$('#selectPromiseCompletedModal').remove();
		},500);
    },
    HtmlTemplate : `
    <div class="modal promise_completed_modal fade" id="selectPromiseCompletedModal" 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">
                    <div class="text_box">
                        <p>진료 대기 고객</p>
                        <p class="blue" id="waitingCount"></p>
                        <p>진료 접수가 완료되었습니다.<br/>진료 안내까지 잠시만 기다려주세요.</p>
                    </div>
                    <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>
    `
};