/*개인정보처리방침팝업*/ function InitPrivacyPolicyPopup(pSeq) { /*팝업 오픈*/ popupLayerOpen('#popup-privacyPolicy'); /*스크롤 최상위로 이동.*/ $('div[id="popup-privacyPolicy"] [class="terms-box"] [class="division"]').scrollTop(0); var PST_SEQ = pSeq; btUtil.send('BRS_CM_PI_RetrievePstCluList', { baRq:'IN_PSET', baRs: 'OUT_PSET', IN_PSET: { CLU_NO: 'BT-P01' } }, function(data) { var findData; if( PST_SEQ ) { findData = data.OUT_PSET.find(function(cur) { return PST_SEQ == cur.PST_SEQ; }); } else { if(data.OUT_PSET.length > 1) { findData = data.OUT_PSET.reduce( function (previous, current) { return (previous.PST_SEQ * 1) > (current.PST_SEQ * 1) ? previous : current; }); } else { findData = data.OUT_PSET[0]; } } $('div[id="popup-privacyPolicy"] [class="agree_bx"]').empty().append(findData.CLU_CTS); var bindTag = ''; data.OUT_PSET.forEach(function(cur) { bindTag += '

' + cur.CLU_NM + ' ' + cur.CLU_VER_NM + '

'; }); $('div[id="popup-privacyPolicy"] [class="person-box"]').empty().append(bindTag); }); } // 개인정보처리방침 협력사 팝업 function getCooperateCompany(param) { btUtil.send('BRS_BT_WC_RetrieveCoopcoList', { baRs: 'OUT_RSET,BZPL_LIST', IN_PSET: { PARAM: param } }, function(data) { // 팝업삭제 $('#cooperateCompanyPopup').remove(); // 데이터 존재시 팝업 생성후 호출 if( data.OUT_RSET.length > 0 && data.BZPL_LIST.length > 0 ) { if(SYS_CD == 'BTMS_WEB') { var $popupTag = $(''); var bindTag = ''; data.BZPL_LIST.forEach(function(cur, idx) { bindTag += '' + ' ' + (idx + 1) + '' + ' ' + cur.BZPL_NM + '' + ''; }); $popupTag.find('tbody').empty().append(bindTag); $('.wrap').append($popupTag); popupLayerOpen('#cooperateCompanyPopup'); } else { var $popupTag = $(''); var bindTag = ''; data.BZPL_LIST.forEach(function(cur, idx) { bindTag += '' + ' ' + (idx + 1) + '' + ' ' + cur.BZPL_NM + '' + ''; }); $popupTag.find('tbody').empty().append(bindTag); $('.wrap').append($popupTag); popupLayerOpen('#cooperateCompanyPopup'); } } }); } function goPage(page) { switch(page) { case 'BT_WR_0220': if(USER_SESSION.FLGHT_BKN_USE_YN != 'Y') { Message.alert('항공예약서비스는 사용이 불가합니다.'); return; } break; case 'BT_WR_0230': if(USER_SESSION.HTL_BKN_USE_YN != 'Y') { Message.alert('호텔예약서비스는 사용이 불가합니다.'); return; } break; case 'BT_WR_0054': if(USER_SESSION.RC_BKN_USE_YN != 'Y') { Message.alert('렌터카예약서비스는 사용이 불가합니다.'); return; } break; case 'BT_WR_0050': if(USER_SESSION.VISA_BKN_USE_YN != 'Y') { Message.alert('비자예약서비스는 사용이 불가합니다.'); return; } break; case 'BT_WR_0040': if(USER_SESSION.ROAM_BKN_USE_YN != 'Y') { Message.alert('로밍예약서비스는 사용이 불가합니다.'); return; } break; case 'BT_WR_0190': if(USER_SESSION.TRVLR_INSU_USE_YN != 'Y') { Message.alert('보험예약서비스는 사용이 불가합니다.'); return; } break; } location.href = page; } function goFamilyPage(url) { if(url) window.open(url, '_blank'); } /************************************************************************************************************************************************************/ // OBT /************************************************************************************************************************************************************/ var obt = { url : { /* 간편예약화면 URL */ getSimpleBooking : function() { var category = { FLGHT_BKN_USE_YN : { name: 'flight' }, HTL_BKN_USE_YN : { name: 'hotel' }, RC_BKN_USE_YN : { name: 'car' }, ROAM_BKN_USE_YN : { name: 'roaming' }, TRVLR_INSU_USE_YN: { name: 'insurance' }, }; var categorys = []; for(var key in category) { if( USER_SESSION[key] == 'Y' ) categorys.push( category[key].name ); } var date = new Date().getTime(); return '/front/#/main?' + date + '&accessToken=' + ACCESS_TOKEN + '&isRequest=true&category=' + categorys.join('-') + '&requestBTMS=true'; }, /* Door to Door 항공예약변경팝업 URL */ getChangeFlightBooking: function(trId) { return '/front/#/flight/search?accessToken=' + ACCESS_TOKEN + '&trID=' + ( trId ? trId : '' ) + '&requestBTMS=true'; }, /* Door to Door 호텔예약변경팝업 URL */ getChangeHotelBooking : function(trId) { return '/front/#/hotel/search?accessToken=' + ACCESS_TOKEN + '&trID=' + ( trId ? trId : '' ) + '&requestBTMS=true'; }, /* 항공,호텔,렌터카예약화면 URL */ getSingleBooking : function(category, bookingCode) { var date = new Date().getTime(); return '/front/#/main?' + date + '&accessToken=' + ACCESS_TOKEN + '&category=' + category + '&bookingCode=' + ( bookingCode ? bookingCode : '' ) + '&requestBTMS=true'; //return '/front/#/main?accessToken=' + ACCESS_TOKEN + '&category=' + category + '&bookingCode=' + ( bookingCode ? bookingCode : '' ) + '&requestBTMS=true'; }, /* 항공,호텔,렌터카상세팝업화면 URL */ getBookingDetail : function(category, bookingCode, bookingItemCode) { var getParam = ''; if( bookingCode ) getParam += '&bookingCode=' + bookingCode; if( bookingItemCode ) getParam += '&bookingItemCode=' + bookingItemCode; var date = new Date().getTime(); return '/front/#/reservation/' + category + '?' + date + '&accessToken=' + ACCESS_TOKEN + getParam + '&requestBTMS=true&isChange=false'; } }, userKey: '', //USER_SESSION.BIZ_NO + '|' + USER_SESSION.BZPL_NO + '|' + '20000022', getLang : function() { if( typeof USER_SESSION === "undefined" || !USER_SESSION.LANG_CD ) return 'ko_KR'; return USER_SESSION.LANG_CD.toLowerCase() + '_KR'; }, send : function(pService, pParam, pAsnyc, pIsDisplayLoading) { var _this = this; var request = $.ajax({ url : '/api/' + pService, method : 'POST', dataType : 'json', async : pAsnyc, contentType: "application/json; charset=utf-8", data : JSON.stringify(pParam), beforeSend : function () { if (pIsDisplayLoading) { $('._progress_bar_').show(); } } }); request.fail(function(jqXHR, textStatus, errorThrown) { Message.alert(pService + ' 호출중 오류가 발생하였습니다.'); trace("요청 실패: ", jqXHR, textStatus, errorThrown); btUtil.hideProgress(); }); request.always(function () { if(pIsDisplayLoading) $('._progress_bar_').hide(); }); return request; }, getInfo : function() { var _this = this; _this.send('user/getInfo', { "condition": { "userTypeCode": "string" }, "currency" : "string", "locale" : _this.getLang(), "method" : "string", "trId" : "string", "userKey" : ACCESS_TOKEN }, false, false).success(function(data) { trace('OBT getInfo : ', data); if(data.isSucceed) { sessionStorage.getItem('OBT_USER_KEY') = data.result.userKey; } }); }, getRecommendCityForFlight: function(pCallback) { var _this = this; _this.send('flight/major/destinations', { "cache": true, "condition": { "compBizCode" : USER_SESSION.BIZ_NO, "itemCategoryCode": "IC01" }, "currency": "string", "locale" : _this.getLang(), "method" : "string", "trId" : "string", "userKey" : sessionStorage.getItem('OBT_USER_KEY') }, true, false).success(function(data) { pCallback(data.result.list); }); }, policy : function(pCallback) { var _this = this; _this.send('flight/travel/policy', { "condition": { "departureDate": moment().format('YYYY-MM-DD'), /* 출발일 */ "traveler" : { "compCode": USER_SESSION.BZPL_NO, /* 사업장번호 */ "userNo" : USER_SESSION.CUSTCO_ESMBR_NO /* 임직원번호 */ } }, "locale" : _this.getLang(), "userKey": sessionStorage.getItem('OBT_USER_KEY') }, false, false).success(function(data) { if( pCallback ) pCallback(data); }); }, getFlightList : function(DPRT_CTY_CD, ARR_CTY_CD, DPRT_DT, HC_DT, pCallback) { var _this = this; _this.send('flight/travel/policy', { "condition": { "departureDate": moment(DPRT_DT).format('YYYY-MM-DD'), /* 출발일 */ "traveler" : { "compCode": USER_SESSION.BZPL_NO, /* 사업장번호 */ "userNo" : USER_SESSION.CUSTCO_ESMBR_NO /* 임직원번호 */ } }, "locale" : _this.getLang(), "userKey": sessionStorage.getItem('OBT_USER_KEY') }, true, false).success(function(policyData) { trace('OBT policy Flight : ', policyData); if( policyData.isSucceed ) { _this.send('flight/list', { "cache" : true, "currency": "KRW", "locale" : _this.getLang(), "trId" : null, "userKey" : sessionStorage.getItem('OBT_USER_KEY'), "condition": { "cabinClassCode" : "Y", /* Y: 일반, C: 비지니스, F: 일등석 */ "controlCompCode" : USER_SESSION.COMP_CD, "corporateCompCode": USER_SESSION.BZPL_NO, "paxAdultCount" : 1, /* 성인수 */ "paxChildCount" : 0, /* 아동수 */ "paxInfantCount" : 0, /* 유아수 */ "tripTypeCode" : "RT", /* RT: 왕복 */ "itineraries" : [{ "departureDate" : moment(DPRT_DT).format('YYYY-MM-DD'), // 출발일 "destinationAirportCode": null, "destinationCityCode" : ARR_CTY_CD, // 도착도시 "isOpenFlight" : false, "originAirportCode" : null, "originCityCode" : DPRT_CTY_CD // 출발도시 }, { "departureDate" : moment(HC_DT).format('YYYY-MM-DD'), // 귀국일 "destinationCityCode" : DPRT_CTY_CD, // 출발도시 "isOpenFlight" : false, "originAirportCode" : null, "originCityCode" : ARR_CTY_CD, // 도착도시 "validPeriod" : "" }], "travelPolicy": policyData.result }, }, true, false).success(function(data) { if( data.isSucceed ) { if(pCallback) { pCallback(data, policyData); } } else { Message.alert(data.error); btUtil.hideProgress(); } }); } else { Message.alert(policyData.error); btUtil.hideProgress(); } }); }, getHotelList : function(DPRT_CTY_CD, ARR_CTY_CD, DPRT_DT, HC_DT, pCallback) { var _this = this; _this.send('hotel/travel/policy', { "condition": { "checkInDate" : moment(DPRT_DT).format('YYYY-MM-DD'), /* 체크인 */ "regionCode" : null, "cityCode" : ARR_CTY_CD, "traveler" : { "compCode": USER_SESSION.BZPL_NO, /* 사업장번호 */ "userNo" : USER_SESSION.CUSTCO_ESMBR_NO, // 20000022 /* 임직원번호 */ } }, "locale" : _this.getLang(), "currency": "KRW", "userKey" : sessionStorage.getItem('OBT_USER_KEY') }, true, false).success(function(data) { trace('OBT policy 호텔 : ', data); if(data.isSucceed) { _this.send('hotel/list', { "cache" : true, "locale" : _this.getLang(), "currency" : "KRW", "userKey" : sessionStorage.getItem('OBT_USER_KEY'), "condition": { "cityCode" : ARR_CTY_CD, "regionCode" : null, "hotelCode" : null, "checkInDate" : moment(DPRT_DT).format('YYYY-MM-DD'), "checkOutDate" : moment(HC_DT).format('YYYY-MM-DD'), "travelersPerRoom": [{ "adultNum" : 1, /* 성인수 */ "childNum" : 0, /* 아동수 */ "childAgeList": [], "paxList" : [{ "userNo": USER_SESSION.CUSTCO_ESMBR_NO /* 투숙하는 출장자 */ }] }], "limit": [ 0, 20 ], "sort" : null, "filter": { "hotelChainCodes": [], "isInterested" : false, "isDesignated" : null, "isBooked" : false }, "travelPolicy": data.result }, "trId": null }, true, false).success(function(data) { if( data.isSucceed ) { if(pCallback) { pCallback(data, data); } } else { Message.alert(data.error); btUtil.hideProgress(); } }); } else { Message.alert(data.error); btUtil.hideProgress(); } }); }, bookingRequest : function(pFlight, pHotel, pCallback) { var _this = this; for(var i=0; i2015001 으로 변경 vendorHotelCode: '$$', // 고정 vendorRoomCombinationId: 'NOT_ASSIGNED' // 고정 }, precodedRemarks: [], travelersPerRoom: [ { roomNo : 1, adultNum : 1, childNum : 0, childAgeList: [], paxList : [ { userNo : USER_SESSION.CUSTCO_ESMBR_NO, firstName : USER_SESSION.ENG_NM, paxTypeCode : 'ADT', lastName : USER_SESSION.ENG_LSTNM, localFullName: USER_SESSION.CUSTCO_ESMBR_NM, gender : USER_SESSION.SX_CD } ] } ], hotelRooms: [ { roomNo: 1, vendorAmount: 0, vendorTaxAmount: 0 } ], priceBreakdown: { dailyRates : DAILYRATES, isTaxIncluded : true, vendorAmount : 0, vendorCurrencyCode: 'USD', // 고정 vendorTaxAmount : 0 }, itemMemo: null } ] } }, false, false).success(function(data) { if(pCallback) { pCallback(data); } }); } }; obt.getLang = function() { var rtnLangCd = 'ko_KR'; if( typeof USER_SESSION !== "undefined" ) { if( USER_SESSION.LANG_CD ) { rtnLangCd = USER_SESSION.LANG_CD.toLowerCase() + '_KR'; } } return rtnLangCd ; }; obt.getInfo = function() { var _this = this; _this.send('user/getInfo', { "condition": { "userTypeCode": "string" }, "currency" : "string", "locale" : _this.getLang(), "method" : "string", "trId" : "string", "userKey" : ACCESS_TOKEN }, false, false).success(function(data) { trace('OBT getInfo : ', data); if(data.isSucceed) { sessionStorage.setItem('OBT_REQ_ACCESS_TOKEN', ACCESS_TOKEN); sessionStorage.setItem('OBT_USER_KEY', data.result.userKey); } }); }; /************************************************************************************************************************************************************/ // OBT END /************************************************************************************************************************************************************/ /************************************************************************************************************************************************************/ // OBT MOBILE용 구글플레이 보안취약으로 jquery1 -> jquery3 /************************************************************************************************************************************************************/ var obtMobile = { url : { /* 간편예약화면 URL */ getSimpleBooking : function() { var category = { FLGHT_BKN_USE_YN : { name: 'flight' }, HTL_BKN_USE_YN : { name: 'hotel' }, RC_BKN_USE_YN : { name: 'car' }, ROAM_BKN_USE_YN : { name: 'roaming' }, TRVLR_INSU_USE_YN: { name: 'insurance' }, }; var categorys = []; for(var key in category) { if( USER_SESSION[key] == 'Y' ) categorys.push( category[key].name ); } return '/front/#/main?accessToken=' + ACCESS_TOKEN + '&isRequest=true&category=' + categorys.join('-') + '&requestBTMS=true'; }, /* Door to Door 항공예약변경팝업 URL */ getChangeFlightBooking: function(trId) { return '/front/#/flight/search?accessToken=' + ACCESS_TOKEN + '&trID=' + ( trId ? trId : '' ) + '&requestBTMS=true'; }, /* Door to Door 호텔예약변경팝업 URL */ getChangeHotelBooking : function(trId) { return '/front/#/hotel/search?accessToken=' + ACCESS_TOKEN + '&trID=' + ( trId ? trId : '' ) + '&requestBTMS=true'; }, /* 항공,호텔,렌터카예약화면 URL */ getSingleBooking : function(category, bookingCode) { return '/front/#/main?accessToken=' + ACCESS_TOKEN + '&category=' + category + '&bookingCode=' + ( bookingCode ? bookingCode : '' ) + '&requestBTMS=true'; }, /* 항공,호텔,렌터카상세팝업화면 URL */ getBookingDetail : function(category, bookingCode, bookingItemCode) { var getParam = ''; if( bookingCode ) getParam += '&bookingCode=' + bookingCode; if( bookingItemCode ) getParam += '&bookingItemCode=' + bookingItemCode; return '/front/#/reservation/' + category + '?accessToken=' + ACCESS_TOKEN + getParam + '&requestBTMS=true&isChange=false'; } }, userKey: '', //USER_SESSION.BIZ_NO + '|' + USER_SESSION.BZPL_NO + '|' + '20000022', getLang : function() { if( typeof USER_SESSION === "undefined" || !USER_SESSION.LANG_CD ) return 'ko_KR'; return USER_SESSION.LANG_CD.toLowerCase() + '_KR'; }, send : function(pService, pParam, pAsnyc, pIsDisplayLoading) { var _this = this; var request = $.ajax({ url : '/api/' + pService, method : 'POST', dataType : 'json', async : pAsnyc, contentType: "application/json; charset=utf-8", data : JSON.stringify(pParam), beforeSend : function () { if (pIsDisplayLoading) { $('._progress_bar_').show(); } } }); request.fail(function(jqXHR, textStatus, errorThrown) { Message.alert(pService + ' 호출중 오류가 발생하였습니다.'); trace("요청 실패: ", jqXHR, textStatus, errorThrown); btUtil.hideProgress(); }); request.always(function () { if(pIsDisplayLoading) $('._progress_bar_').hide(); }); return request; }, getInfo : function() { var _this = this; _this.send('user/getInfo', { "condition": { "userTypeCode": "string" }, "currency" : "string", "locale" : _this.getLang(), "method" : "string", "trId" : "string", "userKey" : ACCESS_TOKEN }, false, false).done(function(data) { trace('OBT getInfo : ', data); if(data.isSucceed) { sessionStorage.getItem('OBT_USER_KEY') = data.result.userKey; } }); }, getRecommendCityForFlight: function(pCallback) { var _this = this; _this.send('flight/major/destinations', { "cache": true, "condition": { "compBizCode" : USER_SESSION.BIZ_NO, "itemCategoryCode": "IC01" }, "currency": "string", "locale" : _this.getLang(), "method" : "string", "trId" : "string", "userKey" : sessionStorage.getItem('OBT_USER_KEY') }, true, false).done(function(data) { pCallback(data.result.list); }); }, policy : function(pCallback) { var _this = this; _this.send('flight/travel/policy', { "condition": { "departureDate": moment().format('YYYY-MM-DD'), /* 출발일 */ "traveler" : { "compCode": USER_SESSION.BZPL_NO, /* 사업장번호 */ "userNo" : USER_SESSION.CUSTCO_ESMBR_NO /* 임직원번호 */ } }, "locale" : _this.getLang(), "userKey": sessionStorage.getItem('OBT_USER_KEY') }, false, false).done(function(data) { if( pCallback ) pCallback(data); }); }, getFlightList : function(DPRT_CTY_CD, ARR_CTY_CD, DPRT_DT, HC_DT, pCallback) { var _this = this; _this.send('flight/travel/policy', { "condition": { "departureDate": moment(DPRT_DT).format('YYYY-MM-DD'), /* 출발일 */ "traveler" : { "compCode": USER_SESSION.BZPL_NO, /* 사업장번호 */ "userNo" : USER_SESSION.CUSTCO_ESMBR_NO /* 임직원번호 */ } }, "locale" : _this.getLang(), "userKey": sessionStorage.getItem('OBT_USER_KEY') }, true, false).done(function(policyData) { trace('OBT policy Flight : ', policyData); if( policyData.isSucceed ) { _this.send('flight/list', { "cache" : true, "currency": "KRW", "locale" : _this.getLang(), "trId" : null, "userKey" : sessionStorage.getItem('OBT_USER_KEY'), "condition": { "cabinClassCode" : "Y", /* Y: 일반, C: 비지니스, F: 일등석 */ "controlCompCode" : USER_SESSION.COMP_CD, "corporateCompCode": USER_SESSION.BZPL_NO, "paxAdultCount" : 1, /* 성인수 */ "paxChildCount" : 0, /* 아동수 */ "paxInfantCount" : 0, /* 유아수 */ "tripTypeCode" : "RT", /* RT: 왕복 */ "itineraries" : [{ "departureDate" : moment(DPRT_DT).format('YYYY-MM-DD'), // 출발일 "destinationAirportCode": null, "destinationCityCode" : ARR_CTY_CD, // 도착도시 "isOpenFlight" : false, "originAirportCode" : null, "originCityCode" : DPRT_CTY_CD // 출발도시 }, { "departureDate" : moment(HC_DT).format('YYYY-MM-DD'), // 귀국일 "destinationCityCode" : DPRT_CTY_CD, // 출발도시 "isOpenFlight" : false, "originAirportCode" : null, "originCityCode" : ARR_CTY_CD, // 도착도시 "validPeriod" : "" }], "travelPolicy": policyData.result }, }, true, false).done(function(data) { if( data.isSucceed ) { if(pCallback) { pCallback(data, policyData); } } else { Message.alert(data.error); btUtil.hideProgress(); } }); } else { Message.alert(policyData.error); btUtil.hideProgress(); } }); }, getHotelList : function(DPRT_CTY_CD, ARR_CTY_CD, DPRT_DT, HC_DT, pCallback) { var _this = this; _this.send('hotel/travel/policy', { "condition": { "checkInDate" : moment(DPRT_DT).format('YYYY-MM-DD'), /* 체크인 */ "regionCode" : null, "cityCode" : ARR_CTY_CD, "traveler" : { "compCode": USER_SESSION.BZPL_NO, /* 사업장번호 */ "userNo" : USER_SESSION.CUSTCO_ESMBR_NO, // 20000022 /* 임직원번호 */ } }, "locale" : _this.getLang(), "currency": "KRW", "userKey" : sessionStorage.getItem('OBT_USER_KEY') }, true, false).done(function(data) { trace('OBT policy 호텔 : ', data); if(data.isSucceed) { _this.send('hotel/list', { "cache" : true, "locale" : _this.getLang(), "currency" : "KRW", "userKey" : sessionStorage.getItem('OBT_USER_KEY'), "condition": { "cityCode" : ARR_CTY_CD, "regionCode" : null, "hotelCode" : null, "checkInDate" : moment(DPRT_DT).format('YYYY-MM-DD'), "checkOutDate" : moment(HC_DT).format('YYYY-MM-DD'), "travelersPerRoom": [{ "adultNum" : 1, /* 성인수 */ "childNum" : 0, /* 아동수 */ "childAgeList": [], "paxList" : [{ "userNo": USER_SESSION.CUSTCO_ESMBR_NO /* 투숙하는 출장자 */ }] }], "limit": [ 0, 20 ], "sort" : null, "filter": { "hotelChainCodes": [], "isInterested" : false, "isDesignated" : null, "isBooked" : false }, "travelPolicy": data.result }, "trId": null }, true, false).done(function(data) { if( data.isSucceed ) { if(pCallback) { pCallback(data, data); } } else { Message.alert(data.error); btUtil.hideProgress(); } }); } else { Message.alert(data.error); btUtil.hideProgress(); } }); }, bookingRequest : function(pFlight, pHotel, pCallback) { var _this = this; for(var i=0; i2015001 으로 변경 vendorHotelCode: '$$', // 고정 vendorRoomCombinationId: 'NOT_ASSIGNED' // 고정 }, precodedRemarks: [], travelersPerRoom: [ { roomNo : 1, adultNum : 1, childNum : 0, childAgeList: [], paxList : [ { userNo : USER_SESSION.CUSTCO_ESMBR_NO, firstName : USER_SESSION.ENG_NM, paxTypeCode : 'ADT', lastName : USER_SESSION.ENG_LSTNM, localFullName: USER_SESSION.CUSTCO_ESMBR_NM, gender : USER_SESSION.SX_CD } ] } ], hotelRooms: [ { roomNo: 1, vendorAmount: 0, vendorTaxAmount: 0 } ], priceBreakdown: { dailyRates : DAILYRATES, isTaxIncluded : true, vendorAmount : 0, vendorCurrencyCode: 'USD', // 고정 vendorTaxAmount : 0 }, itemMemo: null } ] } }, false, false).done(function(data) { if(pCallback) { pCallback(data); } }); } }; obtMobile.getLang = function() { var rtnLangCd = 'ko_KR'; if( typeof USER_SESSION !== "undefined" ) { if( USER_SESSION.LANG_CD ) { rtnLangCd = USER_SESSION.LANG_CD.toLowerCase() + '_KR'; } } return rtnLangCd ; }; obtMobile.getInfo = function() { var _this = this; _this.send('user/getInfo', { "condition": { "userTypeCode": "string" }, "currency" : "string", "locale" : _this.getLang(), "method" : "string", "trId" : "string", "userKey" : ACCESS_TOKEN }, false, false).done(function(data) { trace('OBT getInfo : ', data); if(data.isSucceed) { sessionStorage.setItem('OBT_REQ_ACCESS_TOKEN', ACCESS_TOKEN); sessionStorage.setItem('OBT_USER_KEY', data.result.userKey); } }); }; /************************************************************************************************************************************************************/ // OBT MOBILE END /************************************************************************************************************************************************************/ var etc = { // c-item1 : 검정, c-item2 : 빨강, c-item3 : 파랑, c-item4 초록 getColorClassForSvcBknSts: function (pSvcTy, pBknSts) { var className = 'c-item3'; if(!pBknSts) return className; switch (pSvcTy) { case 'FLIGHT': case 'HTL': case 'RENT': if( pBknSts == 'BKS09' ) return 'c-item4'; else if( pBknSts == 'BKS02' || pBknSts == 'BKS03' || pBknSts == 'BKS99' || pBknSts == 'TST03' ) return 'c-item1'; else if( pBknSts == 'BKS04' || pBknSts == 'BKS08' || pBknSts == 'BKS14' || pBknSts == 'BKS15' ) return 'c-item2'; else return 'c-item3'; case 'VISA': // 예약요청 if( pBknSts == '10' ) { return 'c-item4'; } // 예약취소 else if( pBknSts == '11' ) return 'c-item2'; // 예약진행 if( pBknSts == '20' || pBknSts == '24' ) return 'c-item3'; else return 'c-item1'; case 'ROAM': // 예약요청 if( pBknSts == '10' || pBknSts == '12' ) return 'c-item4'; else if( pBknSts == '11' ) return 'c-item2'; else if( pBknSts == '20' || pBknSts == '24' ) return 'c-item3'; else return 'c-item1'; case 'INSU': if( pBknSts == '10' ) return 'c-item4'; else if( pBknSts == '11' || pBknSts == '12' ) return 'c-item2'; else return 'c-item1'; } }, /******************************************************************************/ // 케이웨더 아이콘아이디별 날씨 /******************************************************************************/ kweatherIconInfo: { 1 : '맑음', 2 : '구름조금', 3 : '구름많음', 4 : '흐림', 5 : '흐린 후 차차 갬', 6 : '맑은후 차차 흐려짐', 7 : '소나기', 8 : '오전 소나기', 9 : '오후 소나기', 10: '흐리고 비', 11: '오전 비', 12: '오후 비', 13: '차차 흐려져 비', 14: '차차 흐려져 오후 비', 15: '비온후 갬', 16: '오전 비온후 갬', 17: '오후 비 온후 갬', 18: '흐리고 눈', 19: '오전 눈', 20: '오후 눈', 21: '차차 흐려져 눈', 22: '차차 흐려져 오후 눈', 23: '눈 온후 갬', 24: '오전 눈 온후 갬', 25: '오후 눈 오후 갬', 26: '비또는 눈', 27: '오전 비 또는 눈', 28: '오후 비또는 눈', 29: '차차 흐려져 비 또는 눈', 30: '차차 흐려져 오후 비 또는 눈', 31: '눈 또는 비', 32: '오전 눈 또는 비', 33: '오후 눈 또는 비', 34: '차차 흐려져 눈 또는 비', 35: '차차 흐려져 오후 눈 또는 비', 36: '눈 또는 비 온후 갬', 37: '오전 비또는 눈 / 눈 또는 비 온후 갬', 38: '오후 비또는 눈 / 눈 또는 비 온후 갬', 39: '천둥번개', 40: '안개', }, kweatherWdInfo : { 0 : '바람없음', 2 : '북북동', 5 : '북동', 7 : '동북동', 9 : '동', 11 : '동남동', 14 : '남동', 16 : '남남동', 18 : '남', 20 : '남남서', 23 : '남서', 25 : '서남서', 27 : '서', 29 : '서북서', 32 : '북서', 34 : '북북서', 36 : '북' } }; btUtil.convertExpirationDate = function(pMMYY) { return ( '20' + pMMYY.substring(2, 4) + pMMYY.substring(0, 2) ); }; btUtil.verify = { email: /^[0-9a-zA-Z]([-_.]?[0-9a-zA-Z])*@[0-9a-zA-Z]([-_.]?[0-9a-zA-Z])*.[a-zA-Z]{2,3}$/i, }; var Message = { alert : function(msg, callback, title) { if( SYS_CD == 'BTMS_WEB' ) { alert(msg); if(callback) callback(); } else { if( $('#notiPopup').length <= 0 ) { $('.wrap').append(''); } // HTML 체크 if( /^/.test(msg) ) { $('#notiPopup [name="message"]').empty().append(msg); } else { $('#notiPopup [name="message"]').empty().append('
' + msg + '
'); } $('#notiPopup [name="notiConfirm"]').on('click', function() { if(callback) callback(); popupLayerClose($('#notiPopup .popup-close')); }); popupLayerOpen('#notiPopup'); } }, confirm: function(msg, callback) { var result = confirm(msg); if(result) { if(callback) callback(true); } else { if(callback) callback(false); } } }; /************************************************************************************************************************************************************/ // 컨트롤(신버전) /************************************************************************************************************************************************************/ function hideLayers() { $('[data-control-layer]').each(function() { var areaName = $(this).attr('data-area-name'); var controlName = $(this).attr('data-control-name'); var control = $('[data-area="' + areaName + '"] [name="' + controlName + '"]'); if( control.attr('data-combo-type') == 'S' && $(this).is(':visible') ) { control.val(control.attr('data-value')); } $(this).hide(); }); } /** * @function ControlManage2 * 컨트롤 제어 생성자함수 * @docauthor Redcap Tour * @author hsjeong */ function ControlManage2(pArea) { var _this = this; this.areas = {}; this.controls = {}; this.init = function() { var _this = this; $( pArea ? '[data-area="' + pArea + '"]' : '[data-area]' ).each(function() { var areaName = $(this).attr('data-area'); _this.areas[areaName] = {}; _this.areas[areaName]['controls'] = {}; $(this).find('[data-control]').each(function(idx, item) { _this.addControl(areaName, $(item).attr('name')); }); }); } trace('ControlManage2 : ', this.areas); this.init(); } /** * @function addControl * 관리할 컨트롤 추가 (동적으로 생성되는 컨트롤을 제어하기 위함) * @docauthor Redcap Tour * @author hsjeong */ ControlManage2.prototype.addControl = function(pAreaName, pControlName) { var _this = this; var controlType = $('[data-area="' + pAreaName + '"] [name="' + pControlName + '"]').attr('data-control'); var control = new Control({ selector : '[data-area="' + pAreaName + '"] [data-control="' + pControlName + '"]', obj : $('[data-area="' + pAreaName + '"] [name="' + pControlName + '"]'), areaName : pAreaName, controlName: pControlName, controlType: controlType, }); control.init(); control.bindEvent(); _this.areas[pAreaName]['controls'][pControlName] = control; }; /** * @function isValid * 관리되는 컨트롤들의 정합성 체크 * @docauthor Redcap Tour * @author hsjeong */ ControlManage2.prototype.isValid = function(pAreaName) { var _this = this; var rtnResult = { success: true }; if(pAreaName) { for( var controlName in _this.areas[pAreaName]['controls'] ) { var result = _this.areas[pAreaName]['controls'][controlName].isValid(); if(!result.success && rtnResult.success) { rtnResult = result; rtnResult.obj = _this.areas[pAreaName]['controls'][controlName].obj; } } } else { for( var areaName in _this.areas ) { for( var controlName in _this.areas[areaName]['controls'] ) { var result = _this.control(areaName, controlName).isValid(); if(!result.success && rtnResult.success) { rtnResult = result; rtnResult.obj = _this.control(areaName, controlName).obj; } } } } if(rtnResult.obj) rtnResult.obj.focus(); return rtnResult; }; /** * @function setValid * 컨트롤 정합성 성공/실패 설정 * @docauthor Redcap Tour * @author hsjeong */ ControlManage2.prototype.setValid = function(pAreaName, pValid) { var _this = this; var rtnResult = { success: true }; if(pAreaName) { for( var controlName in _this.areas[pAreaName]['controls'] ) { _this.areas[pAreaName]['controls'][controlName].setValid(pValid); } } else { for( var areaName in _this.areas ) { for( var controlName in _this.areas[areaName]['controls'] ) { _this.areas[pAreaName]['controls'][controlName].setValid(pValid); } } } return rtnResult; }; ControlManage2.prototype.clear = function(pAreaName) { var _this = this; if(pAreaName) { for( var controlName in _this.areas[pAreaName]['controls'] ) { _this.areas[pAreaName]['controls'][controlName].clear(); } } else { for( var areaName in _this.areas ) { for( var controlName in _this.areas[areaName]['controls'] ) { _this.control(areaName, controlName).clear(); } } } }; /** * @function control * 컨트롤 상세 정보를 반환 * @docauthor Redcap Tour * @author hsjeong */ ControlManage2.prototype.control = function(pAreaName, pControlName) { var _this = this; return _this.areas[pAreaName]['controls'][pControlName]; }; ControlManage2.prototype.getControl = function(pAreaName, pControlName) { if(this.areas[pAreaName]['controls'][pControlName]) return this.areas[pAreaName]['controls'][pControlName].obj; return {}; }; ControlManage2.prototype.setDatas = function(pAreaName, pData) { var _this = this; for(var controlName in _this.areas[pAreaName]['controls'] ) { _this.control(pAreaName, controlName).setData( pData[controlName] ); } }; ControlManage2.prototype.getDatas = function(pAreaName) { var _this = this; var rtnObj = {}; for( var key in _this.areas[pAreaName]['controls'] ) { rtnObj[key] = _this.areas[pAreaName]['controls'][key].getData(); } return rtnObj; }; function Control(pOptions) { this.selector = pOptions.selector; // jquery selector this.obj = pOptions.obj; // jquery object this.areaName = pOptions.areaName; // 영역명 this.controlName = pOptions.controlName; // 컨트롤명 this.controlType = pOptions.controlType; // control type ( text, time, hp, tel, card, number, price, hidden, textarea, combo, picker, radio, checkbox ) this.cleave; // 정합성체크 항목 this.rule = { required: { isUse: false, msg: '' }, // 필수여부 length : { isUse: false, msg: '', condition: 0 }, // byte길이체크 english : { isUse: true , msg: '' }, // 영문입력가능여부 number : { isUse: true , msg: '' }, // 숫자입력가능여부 special : { isUse: true , msg: '' }, // 특수문자입력가능여부 }; this.clear = function() { var _this = this; if(_this.controlType == 'picker') _this.setData(''); else _this.setData(''); _this.obj.closest('dl').removeClass('error'); }; this.getData = function() { var _this = this; if(_this.cleave) return _this.cleave.getRawValue(); switch(_this.controlType) { case 'radio': return $('[name="' + _this.controlName + '"]:checked').val(); case 'checkbox': if( _this.obj.is(':checked') ) { return _this.obj.val(); } else { if( _this.obj.val() == 'Y' ) return 'N'; else return ''; } default: return _this.obj.val(); } }; this.setData = function(pValue) { var _this = this; if( pValue && pValue.length > 0 && !_this.obj.prop('disabled') ) { _this.obj.nextAll('.btn-clear').show(); } else { _this.obj.nextAll('.btn-clear').hide(); } if(_this.cleave) { _this.cleave.setRawValue(pValue); _this.obj.trigger('change'); return; }; switch(_this.controlType) { case 'radio': $('[name="' + _this.controlName + '"][value="' + pValue + '"]').prop('checked', true); break; case 'checkbox': _this.obj.prop('checked', ( _this.obj.val() == pValue )); _this.obj.trigger('change'); break; default: _this.obj.val(pValue); break; } }; this.isValid = function() { var _this = this; var rtnResult = { success: true, msg : '' }; // 필수값 if(_this.rule.required.isUse) { if(!_this.getData()) { rtnResult.success = false; rtnResult.msg = _this.rule.required.msg; } } // 길이 if(_this.rule.length.isUse) { var byteLength = (function(s,b,i,c){ for(b=i=0;c=s.charCodeAt(i++);b+=c>>11?3:c>>7?2:1); return b })( _this.getData() ); if(byteLength > _this.rule.length.condition ) { rtnResult.success = false; rtnResult.msg = _this.rule.length.msg; } } // 영문 if(!_this.rule.english.isUse) { } // 숫자 if(!_this.rule.number.isUse ) { } // 특수문자 if(!_this.rule.special.isUse) { } // 입력값이 있을 경우 컨트롤 형식에 따른 입력 형식 체크 switch( _this.controlType ) { case 'picker' : if( _this.getData().length > 0 ) { if( _this.getData().length != 8 || !moment(_this.getData()).isValid() ) { rtnResult.success = false; rtnResult.msg = '날짜 형식이 잘 못되었습니다.'; } } break; case 'time' : if( _this.getData().length > 0 ) { if( _this.getData().length != 4 || !moment(_this.getData(), 'HHmm').isValid() ) { rtnResult.success = false; rtnResult.msg = '시간 형식이 잘 못되었습니다.'; } } break; case 'number' : break; case 'price' : break; case 'hp' : break; case 'tel' : break; case 'card' : if( _this.getData().length > 0 && _this.getData().length != 16 ) { rtnResult.success = false; rtnResult.msg = '카드번호 형식이 잘 못되었습니다.'; } break; case 'cardmmyy': if( _this.getData().length > 0 && _this.getData().length != 4 ) { rtnResult.success = false; rtnResult.msg = '카드 유효기간이 잘 못되었습니다.'; } break; } _this.setValid(rtnResult.success); return rtnResult; }; this.setValid = function(valid) { var _this = this; if(valid) _this.obj.closest('dl').removeClass('error'); else { _this.obj.closest('dl').addClass('error'); //_this.obj.focus(); } }; this.getPos = function() { var _this = this; var el = _this.obj.get(0); var rect = el.getBoundingClientRect(); var x = rect.left + window.scrollX; var y = rect.top + window.scrollY; return { x: y, y: x }; }; this.init = function() { var _this = this; if(this.cleave) this.cleave.destroy(); _this.obj.attr('autocomplete', 'off'); // 자동완성제거 _this.obj.off(); // 이벤트제거 _this.obj.nextAll('.btn-clear').remove(); // 초기화버튼제거 _this.obj.removeAttr('readonly'); // 키입력가능 // 추가 if( this.controlType != 'radio' && this.controlType != 'checkbox' && this.controlType != 'textarea' && this.controlType != 'hidden' && !_this.obj.prop('disabled') ) { _this.obj.after(''); } if(this.controlType == 'combo') { _this.obj.removeAttr('class'); if( _this.obj.attr('data-combo-type') != 'S' ) { _this.obj.addClass('select'); _this.obj.addClass('position'); } } if( this.controlType == 'picker' ) { _this.obj.removeAttr('class'); _this.obj.addClass('date'); _this.obj.addClass('position'); } // 컨트롤 타입에 맞는 마스크 설정 switch( this.controlType ) { case 'picker': this.cleave = new Cleave(this.obj, { date: true, delimiter: '-', datePattern: ['Y', 'm', 'd'] }); break; case 'month': this.cleave = new Cleave(this.obj, { date: true, delimiter: '-', datePattern: ['Y', 'm'] }); break; case 'time' : this.cleave = new Cleave(this.obj, { time: true, timePattern: ['h', 'm'] }); break; case 'number': this.cleave = new Cleave(this.obj, { numericOnly: true }); break; case 'price': this.cleave = new Cleave(this.obj, { numeral: true, numeralThousandsGroupStyle: 'thousand' }); break; case 'hp' : this.cleave = new Cleave(this.obj, { blocks: [3, 4, 4], delimiters: ['-', '-'] }); break; case 'tel' : break; case 'card' : this.cleave = new Cleave(this.obj, { delimiters: ['-', '-', '-'], blocks: [4, 4, 4, 4], numericOnly: true }); break; case 'cardmmyy': this.cleave = new Cleave(this.obj, { date: true, datePattern: ['m', 'y'] }); break; } }; this.bindEvent = function() { var _this = this; _this.obj.on('focusin', function() { hideLayers(); // 읽기전용이 아니고 값이 있을 경우 삭제 버튼 보이기 if( !_this.obj.is('readonly') && _this.obj.val().length > 0 ) { _this.obj.nextAll('.btn-clear').show(); } else { _this.obj.nextAll('.btn-clear').hide(); } }); _this.obj.on('keyup' , function() { if( !_this.obj.is('readonly') && _this.obj.val().length > 0 ) { _this.obj.nextAll('.btn-clear').show(); } else { _this.obj.nextAll('.btn-clear').hide(); } }); _this.obj.nextAll('.btn-clear').on('click', function() { // 필요한 컨트롤 : text, time, hp, tel, card, number, combo(검색) _this.setData(''); _this.obj.nextAll('.btn-clear').hide(); }); }; } ControlManage2.prototype.initCombo = function(pAreaName, pControlName, pUrl, pParam, pCVT, pAddData, pSnyc) { var _that = this; var item = $('[data-area="' + pAreaName + '"] [name="' + pControlName + '"]'); var controlType = item.attr('data-control'); var comboType = item.attr('data-combo-type'); var control = new Control({ selector : '[data-area="' + pAreaName + '"] [data-control="' + pControlName + '"]', obj : item, areaName : pAreaName, controlName: pControlName, controlType: controlType, }); // 프로퍼티 추가 control.comboType = comboType; // S (검색콤보) control.comboData = []; control.nodatatxt = ' 검색결과가 없습니다.'; control.inittxt = '검색어를 입력하세요.'; /******************************************************************************/ // 콤보레이어 /******************************************************************************/ control.getComboLayerTag = function() { return ''; }; /******************************************************************************/ // 콤보아이템 /******************************************************************************/ control.bindComboItem = function() { var _this = this; var comboItemTag = ''; _this.comboData.forEach(function(cur) { var code = cur[pCVT.code]; var value = cur[pCVT.value]; var text = cur[(pCVT.text ? pCVT.text : pCVT.value)]; comboItemTag += '
  • ' + text + '
  • '; }); _this.comboItems = $(comboItemTag); _this.comboLayer.find('ul').empty().append(_this.comboItems); // 콤보아이템 바인딩 _this.addComboItemEvent(); // 콤보아이템 이벤트 설정 // 첫번째 데이터 선택 if(_this.comboData.length > 0) { _this.setData(_this.comboData[0][pCVT.code]); } }; /******************************************************************************/ // 콤보아이템 이벤트 /******************************************************************************/ control.addComboItemEvent = function() { var _this = this; _this.comboItems.on('click', function() { _this.setData($(this).attr('data-code')); }); }; /******************************************************************************/ // 콤보아이템 검색 /******************************************************************************/ control.bindFilterComboItem = function(pFilterTxt, pIsShow) { var _this = this; // 콤보아이템 텍스트 초기화 (강조표시 초기화) _this.comboLayer.find('ul.list li.filter').each(function(idx, item) { $(item).removeClass('filter').find('a').empty().append( $(item).attr('data-text') ); }); // 선택초기화 _this.comboLayer.find('ul.list li.selected').removeClass('selected'); // 검색어가 존재할 경우 if(pFilterTxt) { // 전체 콤보아이템 숨김 _this.comboItems.hide(); // 검색어와 일치하는 콤보아이템을 할당 var _$comboItemsFilter = _this.comboLayer.find('ul.list li[data-text*="' + pFilterTxt + '"]'); if(_$comboItemsFilter.length > 0) { _$comboItemsFilter.each(function(idx, item) { var text = btUtil.replaceAll($(item).attr('data-text'), pFilterTxt, '' + pFilterTxt + ''); $(item).addClass('filter'); $(item).show(); $(item).find('a').empty().append(text); }); _this.comboLayer.find('.no-data').hide(); _this.comboLayer.find('ul.list').show(); } else { // 검색 결과가 없습니다. _this.comboLayer.find('.no-data').empty().append(_this.nodatatxt); _this.comboLayer.find('.no-data').show(); } } // 검색어가 존재하지 않을 경우 else { _this.comboLayer.find('ul.list').show(); _this.comboLayer.find('.no-data').hide(); _this.comboItems.show(); } // 검색결과 if( _this.comboLayer.find('ul.list li.filter').length > 0 ) { _this.comboLayer.find('ul.list li.filter:eq(0)').addClass('selected'); } else { _this.comboLayer.find('ul.list li.on:eq(0)').addClass('selected'); } if(pIsShow) _this.showLayer(); }; // 메서드 변경 control.init = function() { var _this = this; _this.obj.off(); // 이벤트제거 _this.obj.attr('autocomplete', 'off'); // 자동완성제거 _this.obj.removeAttr('readonly'); // 읽기전용제거 _this.obj.nextAll('.btn-clear').remove(); // 삭제버튼제거 _this.obj.removeClass('position'); // 클래스제거 _this.obj.nextAll('[data-control-layer]').remove(); // 레이어제거 // 검색이 가능한 콤보일 경우 if(comboType == 'S') { _this.obj.removeAttr('readonly'); _this.obj.after(''); } // 검색이 불가한 콤보일 경우 else { _this.obj.attr('readonly', 'readonly'); // 읽기전용 _this.obj.nextAll('.btn-clear').remove(); // 삭제버튼제거 _this.obj.removeClass('position'); // 클래스제거 } _this.width = _this.obj.width(); // 컨트롤 넓이 할당 _this.comboLayer = $(_this.getComboLayerTag()); // 콤보레이어 객체 할당 $('.wrap').append( _this.comboLayer ); // 콤보레이어 추가 _this.maxHeight = _this.comboLayer.find('ul').css('max-height').replace(/[^-\d\.]/g, '') * 1; // 콤보레이어 최대높이 할당 _this.setComboData(); // 콤보 데이터 설정 }; control.bindEvent = function() { var _this = this; // 콤보 포커싱 _this.obj.on('focusin', function() { hideLayers(); if( _this.comboType == 'S' ) _this.obj.val(''); _this.bindFilterComboItem('', true); }); // 콤보레이어 활성화시 키이동 클릭시 스크롤 방지 _this.obj.on('keydown', function(e) { switch(e.keyCode){ case 37: case 39: case 38: case 40: // Arrow keys // case 32: // e.preventDefault(); break; // Space } }); // 콤보 키이벤트 _this.obj.on('keyup' , function(e) { var isFilter = ( _this.comboLayer.find('ul.list li.filter').length > 0 ? true : false ); switch(e.keyCode) { case 27: // ESC _this.hideLayer(); break; case 38: // UP var $selectedComboItem = _this.comboLayer.find('ul.list li.selected'); var $selectedComboItemPrev = $selectedComboItem.prev(); if( isFilter ) { $selectedComboItemPrev = $selectedComboItem.prevAll('li.filter:eq(0)'); } if($selectedComboItemPrev.length > 0) { $selectedComboItem.removeClass('selected'); var topPos = $selectedComboItemPrev.addClass('selected').get(0).offsetTop; if(_this.comboLayer.find('ul').get(0).scrollTop > topPos) _this.comboLayer.find('ul').get(0).scrollTop = topPos; } break; case 40: // DOWN var comboHeight = _this.comboLayer.find('ul').height(); // 콤보높이 var comboItemHeight = _this.comboLayer.find('li:eq(0)').height(); // 콤보항목높이 var $selectedComboItem = _this.comboLayer.find('ul.list li.selected'); if( $selectedComboItem.length <= 0 ) { _this.comboLayer.find('li:eq(0)').addClass('selected'); return; } var $selectedComboItemNext = $selectedComboItem.next(); if( isFilter ) { $selectedComboItemNext = $selectedComboItem.nextAll('li.filter:eq(0)'); } if($selectedComboItemNext.length > 0) { $selectedComboItem.removeClass('selected'); var topPos = $selectedComboItemNext.addClass('selected').get(0).offsetTop; // 스크롤 존재시 if( _this.hasVerticalScrollBar() && _this.comboLayer.find('ul').get(0).scrollTop + comboHeight - comboItemHeight < topPos ) { _this.comboLayer.find('ul').get(0).scrollTop = topPos; } } break; case 13: // ENTER _this.setData(_this.comboLayer.find('ul.list li.selected').attr('data-code')); break; default: if(_this.comboType != 'S') return; _this.bindFilterComboItem( _this.obj.val(), true ); break; } }); _this.obj.nextAll('.btn-clear').on('click', function() { // 필요한 컨트롤 : text, time, hp, tel, card, number, combo(검색) _this.setData(''); _this.obj.nextAll('.btn-clear').hide(); }); }; control.setData = function(pValue) { var _this = this; pValue = (pValue ? pValue : ''); var findData = _this.comboData.find(function(cur) { return ( cur[pCVT.code] == pValue ); }); if(!findData) return; var code = findData[pCVT.code] var value = findData[pCVT.value] var text = findData[pCVT.text] ? findData[pCVT.text] : findData[pCVT.value]; _this.obj.attr('data-code' , code); _this.obj.attr('data-value', value); _this.obj.attr('data-text' , text); _this.obj.val(value); if(_this.comboItems) { _this.comboItems.removeClass('selected'); _this.comboItems.removeClass('on'); var highlightItem = _this.comboItems.find('strong'); if( highlightItem ) { var highlightItemText = highlightItem.closest('li').attr('data-text'); highlightItem.closest('a').empty().append(highlightItemText); } } _this.comboLayer.find('ul.list li[data-code="' + _this.obj.attr('data-code') + '"]').addClass('on'); _this.comboLayer.hide(); _this.obj.blur(); if(pValue /* && _this.comboLayer.find('ul.list li[data-code=""]').length > 0 */ ) _this.obj.nextAll('.btn-clear').show(); else _this.obj.nextAll('.btn-clear').hide(); _this.obj.trigger('combo-change'); }; control.getData = function(pIsObj) { if(pIsObj) { return { code : this.obj.attr('data-code'), value: this.obj.attr('data-value') } } else { return this.obj.attr('data-code'); } }; control.clear = function() { var _this = this; if( _this.comboData.length > 0 ) { _this.setData(_this.comboData[0][pCVT.code]); } _this.obj.closest('dl').removeClass('error'); }; // 메서드 추가 control.setComboData = function() { var _this = this; if(pAddData && pAddData.length > 0) _this.comboData = _this.comboData.concat(pAddData); if(pUrl) { if( pSnyc ) { btUtil.send_sync(pUrl, pParam, function(data) { for(var key in data) { _this.comboData = _this.comboData.concat(data[key]); } _this.bindComboItem(); }); } else { btUtil.send(pUrl, pParam, function(data) { for(var key in data) { _this.comboData = _this.comboData.concat(data[key]); } _this.bindComboItem(); }); } } else _this.bindComboItem(); }; control.showLayer = function() { var _this = this; // 모든 레이어 닫기 $('[data-control-layer]').hide(); // 컨트롤 위치를 찾아 레이어 위치를 설정 var position = _this.getPos(); _this.comboLayer.css('top', position.x + 'px'); _this.comboLayer.css('left', position.y + 'px'); _this.comboLayer.css('width', _this.obj.css('width')); _this.comboLayer.show(); }; control.hideLayer = function() { var _this = this; _this.setData(_this.obj.attr('[data-code]')); _this.comboLayer.hide(); _this.obj.blur(); }; // 컨트롤 절대 위치 반환 control.getPos = function() { var _this = this; var el = _this.obj.get(0); var rect = el.getBoundingClientRect(); var x = rect.left + ( window.scrollX || window.pageXOffset ); var y = rect.top + ( window.scrollY || window.pageYOffset ); return { x: y, y: x }; }; // 레이어에 스크롤이 있는지 체크 control.hasVerticalScrollBar = function() { return this.comboLayer.find('ul').get(0) ? this.comboLayer.find('ul').get(0).scrollHeight > this.comboLayer.find('ul').innerHeight() : false; }; control.init(); control.bindEvent(); _that.areas[pAreaName]['controls'][pControlName] = control; }; ControlManage2.prototype.initComboSr = function(pAreaName, pControlName, pCVT, pCallback, pIsAll) { var _that = this; var item = $('[data-area="' + pAreaName + '"] [name="' + pControlName + '"]'); var controlType = item.attr('data-control'); var comboType = item.attr('data-combo-type'); var control = new Control({ selector : '[data-area="' + pAreaName + '"] [data-control="' + pControlName + '"]', obj : item, areaName : pAreaName, controlName: pControlName, controlType: controlType, }); // 프로퍼티 추가 control.comboType = comboType; // S (검색콤보) control.comboData = []; control.isSearching = false; // 실시간검색중 : true control.nodatatxt = ' 검색결과가 없습니다.'; control.inittxt = '검색어를 입력하세요.'; control.serachingtxt = '검색중...'; /******************************************************************************/ // 콤보레이어 /******************************************************************************/ control.getComboLayerTag = function() { return ''; }; /******************************************************************************/ // 콤보아이템 /******************************************************************************/ control.bindComboItem = function(data) { var _this = this; _this.comboData = data; var comboItemTag = ''; data.forEach(function(cur) { var code = cur[ pCVT.code ]; var value = cur[ pCVT.value ]; var text = cur[ pCVT.text ]; comboItemTag += '
  • ' + text + '
  • '; }); _this.comboItems = $(comboItemTag); _this.comboItems.eq(0).addClass('selected'); _this.comboLayer.find('ul').empty().append(_this.comboItems); // 콤보아이템 바인딩 _this.addComboItemEvent(); if(data.length > 0) { _this.comboLayer.find('ul').show(); _this.comboLayer.find('.no-data').hide(); } else if( _this.obj.val().length > 0 && data.length <= 0 ) { _this.comboLayer.find('ul').hide(); _this.comboLayer.find('.no-data').empty().append(_this.nodatatxt).show(); } else { _this.comboLayer.find('ul').hide(); _this.comboLayer.find('.no-data').empty().append(_this.inittxt).show(); } _this.isSearching = false; }; /******************************************************************************/ // 콤보아이템 이벤트 /******************************************************************************/ control.addComboItemEvent = function() { var _this = this; _this.comboItems.on('click', function() { _this.setData($(this).attr('data-code')); }); }; // 메서드 변경 control.init = function() { var _this = this; _this.obj.off(); // 이벤트제거 _this.obj.attr('autocomplete', 'off'); // 자동완성제거 _this.obj.removeAttr('readonly'); _this.obj.nextAll('.btn-clear').remove(); _this.obj.after(''); // 추가 _this.comboLayer = $(_this.getComboLayerTag()); $('.wrap').append( _this.comboLayer ); // 콤보레이어 _this.maxHeight = _this.comboLayer.find('ul').css('max-height').replace(/[^-\d\.]/g, '') * 1; // 콤보레이어 최대높이 할당 }; control.bindEvent = function() { var _this = this; // 콤보 포커싱 _this.obj.on('focusin', function() { _this.obj.val(''); if( pIsAll ) pCallback.call(_this, _this.bindComboItem ); else { _this.comboLayer.find('ul').hide(); _this.comboLayer.find('.no-data').empty().append(_this.nodatatxt).show(); } _this.showLayer(); }); // 콤보레이어 활성화시 키이동 클릭시 스크롤 방지 _this.obj.on('keydown', function(e) { switch(e.keyCode) { case 38: case 40: // Arrow keys // case 32: // e.preventDefault(); break; // Space } }); var run = debounce(pCallback, 500); // 콤보 키이벤트 _this.obj.on('keyup' , function(e) { switch(e.keyCode) { case 27: // ESC _this.hideLayer(); break; case 38: // UP var $selectedComboItem = _this.comboLayer.find('ul.list li.selected'); var $selectedComboItemPrev = $selectedComboItem.prev('li:visible'); if($selectedComboItemPrev.length > 0) { $selectedComboItem.removeClass('selected'); var topPos = $selectedComboItemPrev.addClass('selected').get(0).offsetTop; if(_this.comboLayer.find('ul').get(0).scrollTop > topPos) _this.comboLayer.find('ul').get(0).scrollTop = topPos; } break; case 40: // DOWN var comboHeight = _this.comboLayer.find('ul').height(); // 콤보높이 var comboItemHeight = _this.comboLayer.find('li:eq(0)').height(); // 콤보항목높이 var $selectedComboItem = _this.comboLayer.find('ul.list li.selected'); if( $selectedComboItem.length <= 0 ) { _this.comboLayer.find('li:eq(0)').addClass('selected'); return; } var $selectedComboItemNext = $selectedComboItem.next('li:visible'); if($selectedComboItemNext.length > 0) { $selectedComboItem.removeClass('selected'); var topPos = $selectedComboItemNext.addClass('selected').get(0).offsetTop; // 스크롤 존재시 if( _this.hasVerticalScrollBar() && _this.comboLayer.find('ul').get(0).scrollTop + comboHeight - comboItemHeight < topPos ) { _this.comboLayer.find('ul').get(0).scrollTop = topPos; } } break; case 13: // ENTER _this.setData(_this.comboLayer.find('ul.list li.selected').attr('data-code')); break; default: run(_this, _this.bindComboItem); // if( !_this.isSearching ) { // _this.isSearching = true; // setTimeout(function() { // pCallback.call(_this, _this.bindComboItem ); // }, 500); // } break; } }); _this.obj.nextAll('.btn-clear').on('click', function() { // 필요한 컨트롤 : text, time, hp, tel, card, number, combo(검색) _this.setData(''); _this.obj.nextAll('.btn-clear').hide(); }); }; control.setData = function(pValue) { var _this = this; pValue = (pValue ? pValue : ''); var findData = _this.comboData.find(function(cur) { return ( cur[pCVT.code] == pValue ); }); if( pValue && !findData && typeof _this.setSearchData == 'function') { findData = _this.setSearchData(pValue); } var code = ''; var value = ''; var text = ''; if(findData) { code = findData[pCVT.code] value = findData[pCVT.value] text = findData[pCVT.text] ? findData[pCVT.text] : findData[pCVT.value]; } _this.obj.attr('data-code' , code); _this.obj.attr('data-value', value); _this.obj.attr('data-text' , text); _this.obj.val(value); _this.comboLayer.hide(); _this.obj.blur(); if( _this.obj.val().length > 0 ) _this.obj.nextAll('.btn-clear').show(); else _this.obj.nextAll('.btn-clear').hide(); _this.obj.trigger('combo-change'); }; control.getData = function(pIsObj) { if(pIsObj) { return { code : this.obj.attr('data-code'), value: this.obj.attr('data-value') } } else { return this.obj.attr('data-code'); } }; control.clear = function() { var _this = this; _this.obj.closest('dl').removeClass('error'); }; control.showLayer = function() { var _this = this; // 모든 레이어 닫기 $('[data-control-layer]').hide(); // 컨트롤 위치를 찾아 레이어 위치를 설정 var position = _this.getPos(); _this.comboLayer.css('top', position.x + 'px'); _this.comboLayer.css('left',position.y + 'px'); _this.comboLayer.css('width', _this.obj.css('width')); _this.comboLayer.show(); }; control.hideLayer = function() { var _this = this; _this.setData(_this.obj.attr('[data-code]')); _this.comboLayer.hide(); _this.obj.blur(); }; // 컨트롤 절대 위치 반환 control.getPos = function() { var _this = this; var el = _this.obj.get(0); var rect = el.getBoundingClientRect(); var x = rect.left + ( window.scrollX || window.pageXOffset ); var y = rect.top + ( window.scrollY || window.pageYOffset ); return { x: y, y: x }; }; // 레이어에 스크롤이 있는지 체크 control.hasVerticalScrollBar = function() { return this.comboLayer.find('ul').get(0) ? this.comboLayer.find('ul').get(0).scrollHeight > this.comboLayer.find('ul').innerHeight() : false; } control.init(); control.bindEvent(); _that.areas[pAreaName]['controls'][pControlName] = control; }; ControlManage2.prototype.initComboSrInner = function(pAreaName, pControlName, pCVT, pCallback, pIsAll) { var _that = this; var item = $('[data-area="' + pAreaName + '"] [name="' + pControlName + '"]'); var controlType = item.attr('data-control'); var comboType = item.attr('data-combo-type'); var control = new Control({ selector : '[data-area="' + pAreaName + '"] [data-control="' + pControlName + '"]', obj : item, areaName : pAreaName, controlName: pControlName, controlType: controlType, }); // 프로퍼티 추가 control.comboType = comboType; // S (검색콤보) control.comboData = []; control.isSearching = false; // 실시간검색중 : true control.nodatatxt = ' 검색결과가 없습니다.'; control.inittxt = '검색어를 입력하세요.'; control.serachingtxt = '검색중...'; /******************************************************************************/ // 콤보레이어 /******************************************************************************/ control.getComboLayerTag = function() { return ''; }; /******************************************************************************/ // 콤보아이템 /******************************************************************************/ control.bindComboItem = function(data) { var _this = this; _this.comboData = data; var comboItemTag = ''; data.forEach(function(cur) { var code = cur[ pCVT.code ]; var value = cur[ pCVT.value ]; var text = cur[ pCVT.text ]; comboItemTag += '
  • ' + text + '
  • '; }); _this.comboItems = $(comboItemTag); _this.comboItems.eq(0).addClass('selected'); _this.comboLayer.find('ul').empty().append(_this.comboItems); // 콤보아이템 바인딩 _this.addComboItemEvent(); if(data.length > 0) { _this.comboLayer.find('ul').show(); _this.comboLayer.find('.no-data').hide(); } else if( _this.obj.val().length > 0 && data.length <= 0 ) { _this.comboLayer.find('ul').hide(); _this.comboLayer.find('.no-data').empty().append(_this.nodatatxt).show(); } else { _this.comboLayer.find('ul').hide(); _this.comboLayer.find('.no-data').empty().append(_this.inittxt).show(); } _this.isSearching = false; }; /******************************************************************************/ // 콤보아이템 이벤트 /******************************************************************************/ control.addComboItemEvent = function() { var _this = this; _this.comboItems.on('click', function() { _this.setData($(this).attr('data-code')); }); }; // 메서드 변경 control.init = function() { var _this = this; _this.obj.off(); // 이벤트제거 _this.obj.attr('autocomplete', 'off'); // 자동완성제거 _this.obj.removeAttr('readonly'); _this.obj.nextAll('.btn-clear').remove(); _this.obj.after(''); // 추가 _this.comboLayer = $(_this.getComboLayerTag()); $('.wrap').append( _this.comboLayer ); // 콤보레이어 _this.maxHeight = _this.comboLayer.find('ul').css('max-height').replace(/[^-\d\.]/g, '') * 1; // 콤보레이어 최대높이 할당 }; control.bindEvent = function() { var _this = this; // 콤보 포커싱 _this.obj.on('focusin', function() { _this.obj.val(''); if( pIsAll ) pCallback.call(_this, _this.bindComboItem ); else { _this.comboLayer.find('ul').hide(); _this.comboLayer.find('.no-data').empty().append(_this.nodatatxt).show(); } _this.showLayer(); }); // 콤보레이어 활성화시 키이동 클릭시 스크롤 방지 _this.obj.on('keydown', function(e) { switch(e.keyCode) { case 38: case 40: // Arrow keys // case 32: // e.preventDefault(); break; // Space } }); var run = debounce(pCallback, 500); // 콤보 키이벤트 _this.obj.on('keyup' , function(e) { switch(e.keyCode) { case 27: // ESC _this.hideLayer(); break; case 38: // UP var $selectedComboItem = _this.comboLayer.find('ul.list li.selected'); var $selectedComboItemPrev = $selectedComboItem.prev('li:visible'); if($selectedComboItemPrev.length > 0) { $selectedComboItem.removeClass('selected'); var topPos = $selectedComboItemPrev.addClass('selected').get(0).offsetTop; if(_this.comboLayer.find('ul').get(0).scrollTop > topPos) _this.comboLayer.find('ul').get(0).scrollTop = topPos; } break; case 40: // DOWN var comboHeight = _this.comboLayer.find('ul').height(); // 콤보높이 var comboItemHeight = _this.comboLayer.find('li:eq(0)').height(); // 콤보항목높이 var $selectedComboItem = _this.comboLayer.find('ul.list li.selected'); if( $selectedComboItem.length <= 0 ) { _this.comboLayer.find('li:eq(0)').addClass('selected'); return; } var $selectedComboItemNext = $selectedComboItem.next('li:visible'); if($selectedComboItemNext.length > 0) { $selectedComboItem.removeClass('selected'); var topPos = $selectedComboItemNext.addClass('selected').get(0).offsetTop; // 스크롤 존재시 if( _this.hasVerticalScrollBar() && _this.comboLayer.find('ul').get(0).scrollTop + comboHeight - comboItemHeight < topPos ) { _this.comboLayer.find('ul').get(0).scrollTop = topPos; } } break; case 13: // ENTER _this.setData(_this.comboLayer.find('ul.list li.selected').attr('data-code')); break; default: run(_this, _this.bindComboItem); // if( !_this.isSearching ) { // _this.isSearching = true; // setTimeout(function() { // pCallback.call(_this, _this.bindComboItem ); // }, 500); // } break; } }); _this.obj.nextAll('.btn-clear').on('click', function() { // 필요한 컨트롤 : text, time, hp, tel, card, number, combo(검색) _this.setData(''); _this.obj.nextAll('.btn-clear').hide(); }); }; control.setData = function(pValue) { var _this = this; pValue = (pValue ? pValue : ''); var findData = _this.comboData.find(function(cur) { return ( cur[pCVT.code] == pValue ); }); if( pValue && !findData && typeof _this.setSearchData == 'function') { findData = _this.setSearchData(pValue); } var code = ''; var value = ''; var text = ''; if(findData) { code = findData[pCVT.code] value = findData[pCVT.value] text = findData[pCVT.text] ? findData[pCVT.text] : findData[pCVT.value]; } _this.obj.attr('data-code' , code); _this.obj.attr('data-value', value); _this.obj.attr('data-text' , text); _this.obj.val(value); _this.comboLayer.hide(); _this.obj.blur(); if( _this.obj.val().length > 0 ) _this.obj.nextAll('.btn-clear').show(); else _this.obj.nextAll('.btn-clear').hide(); _this.obj.trigger('combo-change'); }; control.getData = function(pIsObj) { if(pIsObj) { return { code : this.obj.attr('data-code'), value: this.obj.attr('data-value') } } else { return this.obj.attr('data-code'); } }; control.clear = function() { var _this = this; _this.obj.closest('dl').removeClass('error'); }; control.showLayer = function() { var _this = this; // 모든 레이어 닫기 $('[data-control-layer]').hide(); // 컨트롤 위치를 찾아 레이어 위치를 설정 var position = _this.getPos(); _this.comboLayer.css('top', position.x + 'px'); _this.comboLayer.css('left',position.y + 'px'); _this.comboLayer.css('width', _this.obj.css('width')); _this.comboLayer.show(); }; control.hideLayer = function() { var _this = this; _this.setData(_this.obj.attr('[data-code]')); _this.comboLayer.hide(); _this.obj.blur(); }; // 컨트롤 절대 위치 반환 control.getPos = function() { var _this = this; var el = _this.obj.get(0); var rect = el.getBoundingClientRect(); var x = rect.left + ( window.scrollX || window.pageXOffset ); var y = rect.top + ( window.scrollY || window.pageYOffset ); return { x: y, y: x }; }; // 레이어에 스크롤이 있는지 체크 control.hasVerticalScrollBar = function() { return this.comboLayer.find('ul').get(0) ? this.comboLayer.find('ul').get(0).scrollHeight > this.comboLayer.find('ul').innerHeight() : false; } control.init(); control.bindEvent(); _that.areas[pAreaName]['controls'][pControlName] = control; }; function debounce(func, delay) { var inDebounce; return function() { var _this = arguments[0]; var bindComboItem = arguments[1]; if(inDebounce) { clearTimeout(inDebounce); } inDebounce = setTimeout(function() { return func.call(_this, bindComboItem); }, delay); }; } ControlManage2.prototype.initComboMulti = function(pAreaName, pControlName, pUrl, pParam, pCVT, pAddData, pSnyc, pChecked) { var _that = this; var item = $('[data-area="' + pAreaName + '"] [name="' + pControlName + '"]'); var controlType = item.attr('data-control'); var comboType = item.attr('data-combo-type'); var control = new Control({ selector : '[data-area="' + pAreaName + '"] [data-control="' + pControlName + '"]', obj : item, areaName : pAreaName, controlName: pControlName, controlType: controlType, }); // 프로퍼티 추가 control.comboType = comboType; // S (검색콤보) control.comboData = []; control.nodatatxt = ' 검색결과가 없습니다.'; control.inittxt = '검색어를 입력하세요.'; /******************************************************************************/ // 콤보레이어 /******************************************************************************/ control.getComboLayerTag = function() { var _this = this; return ''; }; /******************************************************************************/ // 콤보아이템 /******************************************************************************/ control.bindComboItem = function() { var _this = this; var comboItemTag = ''; _this.comboData.forEach(function(cur) { var code = cur[pCVT.code] var value = cur[pCVT.value] var text = cur[(pCVT.text ? pCVT.text : pCVT.value)]; comboItemTag += '
  • '; }); _this.comboItems = $(comboItemTag); _this.comboLayer.find('ul').empty().append(_this.comboItems); // 콤보아이템 바인딩 _this.addComboItemEvent(); // 콤보아이템 이벤트 설정 _this.checkedAll( pChecked ); }; /******************************************************************************/ // 콤보아이템 이벤트 /******************************************************************************/ control.addComboItemEvent = function() { var _this = this; _this.comboLayer.find('[type="checkbox"]').on('change', function() { _this.setText(); }); }; /******************************************************************************/ // 콤보아이템 검색 /******************************************************************************/ control.bindFilterComboItem = function(pFilterTxt, pIsShow) { var _this = this; _this.obj.find('ul.list li.filter').each(function(idx, item) { var text = $(item).attr('data-text'); $(item).removeClass('filter').find('a').empty().append(text); }); if(pFilterTxt) { _this.comboItems.hide(); var _$comboItemsFilter = _this.comboLayer.find('ul.list li[data-text*="' + pFilterTxt + '"]'); if(_$comboItemsFilter.length > 0) { _$comboItemsFilter.each(function(idx, item) { var text = btUtil.replaceAll($(item).attr('data-text'), pFilterTxt, '' + pFilterTxt + ''); $(item).addClass('filter').show().find('a').empty().append(text); }); _this.comboLayer.find('.no-data').hide(); _this.comboLayer.find('ul.list').show(); } else { // 검색 결과가 없습니다. _this.comboLayer.find('.no-data').empty().append(_this.nodatatxt); _this.comboLayer.find('.no-data').show(); } } else { _this.comboLayer.find('ul.list').show(); _this.comboLayer.find('.no-data').hide(); _this.comboItems.show(); } if(pIsShow) _this.showLayer(); }; // 메서드 변경 control.init = function() { var _this = this; _this.obj.off(); // 이벤트제거 _this.obj.attr('autocomplete', 'off'); // 자동완성제거 _this.obj.removeAttr('readonly'); _this.obj.nextAll('.btn-clear').remove(); _this.obj.removeClass('position'); _this.obj.nextAll('[data-control-layer]').remove(); // 레이어제거 _this.obj.addClass('select'); // 검색이 가능한 콤보일 경우 if(comboType == 'S') { _this.obj.removeAttr('readonly'); _this.obj.after(''); _this.obj.addClass('position'); } // 검색이 불가한 콤보일 경우 else { _this.obj.attr('readonly', 'readonly'); // 읽기전용 _this.obj.nextAll('.btn-clear').remove(); _this.obj.removeClass('position'); } // 추가 _this.width = _this.obj.width(); // 컨트롤 넓이 할당 _this.comboLayer = $(_this.getComboLayerTag()); // 콤보레이어 객체 할당 $('.wrap').append( _this.comboLayer ); // 콤보레이어 추가 _this.maxHeight = _this.comboLayer.find('ul').css('max-height').replace(/[^-\d\.]/g, '') * 1; // 콤보레이어 최대높이 할당 _this.setComboData(); // 콤보데이터 }; control.bindEvent = function() { var _this = this; // 콤보 포커싱 _this.obj.on('focusin', function() { hideLayers(); if( _this.comboType == 'S' ) _this.obj.val(''); _this.bindFilterComboItem('', true); }); // 콤보레이어 활성화시 키이동 클릭시 스크롤 방지 _this.obj.on('keydown', function(e) { switch(e.keyCode){ case 37: case 39: case 38: case 40: // Arrow keys // case 32: // e.preventDefault(); break; // Space } }); // 콤보 키이벤트 _this.obj.on('keyup' , function(e) { switch(e.keyCode) { case 27: // ESC _this.hideLayer(); break; case 38: // UP var $selectedComboItem = _this.comboLayer.find('ul.list li.selected'); var $selectedComboItemPrev = $selectedComboItem.prev('li:visible'); if($selectedComboItemPrev.length > 0) { $selectedComboItem.removeClass('selected'); var topPos = $selectedComboItemPrev.addClass('selected').get(0).offsetTop; if(_this.comboLayer.find('ul').get(0).scrollTop > topPos) _this.comboLayer.find('ul').get(0).scrollTop = topPos; } break; case 40: // DOWN var comboHeight = _this.comboLayer.find('ul').height(); // 콤보높이 var comboItemHeight = _this.comboLayer.find('li:eq(0)').height(); // 콤보항목높이 var $selectedComboItem = _this.comboLayer.find('ul.list li.selected'); if( $selectedComboItem.length <= 0 ) { _this.comboLayer.find('li:eq(0)').addClass('selected'); return; } var $selectedComboItemNext = $selectedComboItem.next('li:visible'); if($selectedComboItemNext.length > 0) { $selectedComboItem.removeClass('selected'); var topPos = $selectedComboItemNext.addClass('selected').get(0).offsetTop; // 스크롤 존재시 if( _this.hasVerticalScrollBar() && _this.comboLayer.find('ul').get(0).scrollTop + comboHeight - comboItemHeight < topPos ) { _this.comboLayer.find('ul').get(0).scrollTop = topPos; } } break; case 13: // ENTER _this.setData(_this.comboLayer.find('ul.list li.selected').attr('data-code')); break; default: if(_this.comboType != 'S') return; _this.bindFilterComboItem( _this.obj.val(), true ); break; } }); _this.comboLayer.find('.btn button:eq(0)').on('click', function() { _this.checkedAll(true); }); _this.comboLayer.find('.btn button:eq(1)').on('click', function() { _this.checkedAll(false); }); }; control.setData = function(pValue, pChecked) { var _this = this; if( pValue ) { var checked = ( typeof pChecked == 'boolean' ? pChecked : true ); var values; // 단일 선택 if( typeof pValue == 'string' ) { values = pValue.split(','); } // 배열 선택 else { values = pValue; } values.forEach(function(cur) { _this.comboLayer.find('[type="checkbox"][value="' + cur + '"]').prop('checked', checked); }); _this.setText(); } }; control.getData = function(pIsObj) { var _this = this; if(pIsObj) { var rtnData = []; _this.comboLayer.find('[type="checkbox"]:checked').each(function() { rtnData.push( { code: $(this).closest('li').attr('data-code'), value: $(this).closest('li').attr('data-value') } ); }); return rtnData; } else { var rtnData = []; _this.comboLayer.find('[type="checkbox"]:checked').each(function() { rtnData.push( $(this).val() ); }); return rtnData.join(','); } }; control.setText = function() { var _this = this; var tmpTxt = ''; var text = ''; if( this.getSelectedLength() <= 0 ) { text = '선택'; } if( this.getSelectedLength() > 0 ) { text = _this.comboLayer.find('input[type="checkbox"]:checked').eq(0).closest('li').attr('data-value'); } if( this.getSelectedLength() > 1 ) { tmpTxt += ' 외 ' + ( this.getSelectedLength() - 1 ) + '개'; } control.obj.val(text + tmpTxt); control.obj.attr('data-value', text + tmpTxt); control.obj.trigger('combo-change'); }; control.getSelectedLength = function() { return this.comboLayer.find('[type="checkbox"]:checked').length; }; control.clear = function() { var _this = this; if(control.comboData.length > 0) _this.setData(''); _this.obj.closest('dl').removeClass('error'); }; // 메서드 추가 control.setComboData = function() { var _this = this; if(pAddData && pAddData.length > 0) _this.comboData = _this.comboData.concat(pAddData); if(pUrl) { if( pSnyc ) { btUtil.send_sync(pUrl, pParam, function(data) { for(var key in data) { _this.comboData = _this.comboData.concat(data[key]); } _this.bindComboItem(); }); } else { btUtil.send(pUrl, pParam, function(data) { for(var key in data) { _this.comboData = _this.comboData.concat(data[key]); } _this.bindComboItem(); }); } } else _this.bindComboItem(); }; control.showLayer = function() { var _this = this; // 모든 레이어 닫기 $('[data-control-layer]').hide(); _this.comboLayer.find('ul.list li.selected').removeClass('selected'); _this.comboLayer.find('ul.list li.on').addClass('selected'); // 컨트롤 위치를 찾아 레이어 위치를 설정 var position = _this.getPos(); _this.comboLayer.css('top', position.x + 45 + 'px'); _this.comboLayer.css('left',position.y + 'px'); _this.comboLayer.show(); }; control.hideLayer = function() { var _this = this; _this.setData(_this.obj.attr('[data-code]')); _this.comboLayer.hide(); _this.obj.blur(); }; // 컨트롤 절대 위치 반환 control.getPos = function() { var _this = this; var el = _this.obj.get(0); var rect = el.getBoundingClientRect(); var x = rect.left + ( window.scrollX || window.pageXOffset ); var y = rect.top + ( window.scrollY || window.pageYOffset ); return { x: y, y: x }; }; // 레이어에 스크롤이 있는지 체크 control.hasVerticalScrollBar = function() { return this.comboLayer.find('ul').get(0) ? this.comboLayer.find('ul').get(0).scrollHeight > this.comboLayer.find('ul').innerHeight() : false; }; control.checkedAll = function(pChecked) { this.comboLayer.find('input[type="checkbox"]').prop('checked', pChecked); this.setText(); }; control.init(); control.bindEvent(); _that.areas[pAreaName]['controls'][pControlName] = control; }; ControlManage2.prototype.picker = function(pOptions) { var _that = this; var options = { areaName : pOptions.areaName, controlName : pOptions.controlName, controlFromName: pOptions.controlFromName, controlToName : pOptions.controlToName, selector : pOptions.selector, selectorFrom : pOptions.selectorFrom, selectorTo : pOptions.selectorTo, multi : pOptions.controlFromName ? true : false, dateViewFormat : pOptions.dateFormat ? pOptions.dateFormat : 'YYYY-MM-DD', dateValueFormat: pOptions.dateFormat ? pOptions.dateFormat : 'YYYYMMDD', editable : false, lang : 'KO', isPadDate : false, today : moment().format('YYYY-MM-DD'), $moment1 : {}, // 달력1 $moment2 : {}, // 달력2 minDate : pOptions.minDate, maxDate : pOptions.maxDate, disable : pOptions.disable, }; var selectedDate = ''; var $selector; var $selectorFrom; var $selectorTo; var $selectedFrom; // 선택된 출발일 var $selectedTo; // 선택된 종료일 var $selectedLbFrom; // 출발일 라벨 var $selectedLbTo; // 도착일 라벨 var $layer; var $prevPickerYear; var $prevPickerMonth; var $prevPickerBody; var $nextPickerYear; var $nextPickerMonth; var $nextPickerBody; var $btnPrev; var $btnNext; var $btnPrevSel; var $btnNextSel; var $btnInit; var $btnApply; function init() { if(options.multi) { $selectorFrom = $('[data-area="' + options.areaName + '"] [name="' + options.controlFromName + '"]'); // 시작일 입력 요소 $selectorTo = $('[data-area="' + options.areaName + '"] [name="' + options.controlToName + '"]'); // 종료일 입력 요소 options.areaName = $selectorFrom.closest('[data-area]').attr('data-area'); options.controlFromName = $selectorFrom.attr('name'); options.controlToName = $selectorTo.attr('name'); var pickerWrapTag = getPickerWrapTag(options.areaName, options.controlFromName, $selectorFrom.attr('data-picker-group')); // 달력을 감싸는 영역 Tag를 반환 $layer = $(pickerWrapTag); $('.wrap').append( $layer ); // 콤보레이어 $selectedFrom = $layer.find('.calendar-data dl dd:eq(0)'); // 선택된 시작일 $selectedTo = $layer.find('.calendar-data dl dd:eq(1)'); // 선택된 종료일 $selectedLbFrom = $layer.find('.calendar-data dl dt:eq(0)'); $selectedLbTo = $layer.find('.calendar-data dl dt:eq(1)'); var itemFrom = $('[data-area="' + options.areaName + '"] [name="' + options.controlFromName + '"]'); var itemTo = $('[data-area="' + options.areaName + '"] [name="' + options.controlToName + '"]'); var controlTypeFrom = $(itemFrom).attr('data-control'); var controlNameFrom = $(itemFrom).attr('name'); var controlTypeTo = $(itemFrom).attr('data-control'); var controlNameTo = $(itemFrom).attr('name'); var controlFrom = new Control({ selector : '[data-area="' + options.areaName + '"] [data-control="' + options.controlFromName + '"]', obj : $(itemFrom), areaName : options.areaName, controlName: controlNameFrom, controlType: controlTypeFrom, }); var controlTo = new Control({ selector : '[data-area="' + options.areaName + '"] [data-control="' + options.controlToName + '"]', obj : $(itemTo), areaName : options.areaName, controlName: controlNameTo, controlType: controlTypeTo, }); controlFrom.init(); controlFrom.bindEvent(); controlTo.init(); controlTo.bindEvent(); _that.areas[options.areaName]['controls'][options.controlFromName] = controlFrom; _that.areas[options.areaName]['controls'][options.controlToName] = controlTo; } else { $selector = $('[data-area="' + options.areaName + '"] [name="' + options.controlName + '"]'); // 날짜 입력 요소 var pickerWrapTag = getPickerWrapTag(options.areaName, options.controlName, ''); // 달력을 감싸는 영역 Tag를 반환 $layer = $(pickerWrapTag); $('.wrap').append( $layer ); var item = $('[data-area="' + options.areaName + '"] [name="' + options.controlName + '"]'); var controlType = $(item).attr('data-control'); var controlName = $(item).attr('name'); var control = new Control({ selector : '[data-area="' + options.areaName + '"] [data-control="' + options.controlName + '"]', obj : $(item), areaName : options.areaName, controlName: controlName, controlType: controlType, }); control.init(); control.bindEvent(); _that.areas[options.areaName]['controls'][options.controlName] = control; } $prevPickerYear = $layer.find('ul li:eq(0) .calendar-year'); $prevPickerMonth = $layer.find('ul li:eq(0) .calendar-month'); $prevPickerBody = $layer.find('ul li:eq(0) tbody'); $nextPickerYear = $layer.find('ul li:eq(1) .calendar-year'); $nextPickerMonth = $layer.find('ul li:eq(1) .calendar-month'); $nextPickerBody = $layer.find('ul li:eq(1) tbody'); $btnPrev = $layer.find('.calendar-prev'); // 이전달버튼 $btnNext = $layer.find('.calendar-next'); // 다음달버튼 $btnPrevSel = $layer.find('.calendar-data dl:eq(0)'); $btnNextSel = $layer.find('.calendar-data dl:eq(1)'); $btnInit = $layer.find('.btn-area button:eq(0)'); // 초기화버튼 $btnApply = $layer.find('.btn-area button:eq(1)'); // 적용버튼 $btnClose = $layer.find('button.btn-close'); // 닫기버튼 // 입력창 클릭시 달력레이어 호출 이벤트 추가 switch( options.multi ) { case true : $selectorFrom.on('click', function() { $selectedLbFrom.addClass('active'); $selectedLbTo.removeClass('active'); hideLayers(); $layer.attr('data-control-name', options.controlFromName); showLayer($selectorFrom); }); $selectorTo.on('click', function() { if( $selectorFrom.val() && moment($selectorFrom.val()).isValid() ) { $selectedLbFrom.removeClass('active'); $selectedLbTo.addClass('active'); } else { $selectedLbFrom.addClass('active'); $selectedLbTo.removeClass('active'); } hideLayers(); $layer.attr('data-control-name', options.controlToName); showLayer($selectorTo); }); break; case false: $selector.on('click', function() { options.$moment1 = new moment($selector.val()); if(!options.$moment1.isValid()) { options.$moment1 = new moment(); options.$moment2 = new moment().add(1, 'M'); } else options.$moment2 = new moment($selector.val()).add(1, 'M'); drawPicker(0); $layer.find('td').removeClass('active'); $layer.find('td[data-date="' + $selector.val() + '"]').addClass('active'); hideLayers(); $layer.show(); var position = getPos($selector); // X좌표 if( $(window).height() + window.scrollY < position.x + $layer.find('.inner').height() ) { $layer.css('top' , ( position.x - $layer.find('.inner').height() - 38 ) + 'px'); } else { $layer.css('top' , position.x + 'px'); } // Y좌표 if( $(window).width() + window.scrollX < position.y + $layer.find('.inner').width() ) { $layer.css('left', (position.y - $layer.find('.inner').width() + $selector.width() ) + 'px'); } else { $layer.css('left', position.y + 'px'); } }); break; } // 이전달 $btnPrev.on('click', function() { drawPicker(-1); }); // 다음달 $btnNext.on('click', function() { drawPicker(1); }); $btnPrevSel.on('click', function() { $selectedLbFrom.addClass('active'); $selectedLbTo.removeClass('active'); }); $btnNextSel.on('click', function() { $selectedLbFrom.removeClass('active'); $selectedLbTo.addClass('active'); }); // 적용 $btnApply.on('click', function() { if($selectedFrom.text() && $selectedTo.text()) { $selectorFrom.val($selectedFrom.text()).trigger('change'); $selectorTo.val($selectedTo.text()).trigger('change'); $layer.hide(); } }); // 초기화 $btnInit.on('click', function() { clear(); }); // 닫기 $btnClose.on('click', function() { $layer.hide(); }); }; function getPickerWrapTag(pAreaName, pControlName, pGroupName) { var rtnTag = ''; return rtnTag; }; function drawPicker(pAddMonth) { if( !isEnableDate( moment( options.$moment1.format('YYYYMMDD') ).add(pAddMonth, 'M').format('YYYYMM'), 'YYYYMM' ) ) return; options.$moment1.add(pAddMonth, 'M'); options.$moment2.add(pAddMonth, 'M'); $prevPickerYear.text(options.$moment1.format('YYYY')); // 달력1 년도 설정 $nextPickerYear.text(options.$moment2.format('YYYY')); // 달력2 년도 설정 $prevPickerMonth.text(options.$moment1.format('MM')); // 달력1 월 설정 $nextPickerMonth.text(options.$moment2.format('MM')); // 달력2 월 설정 $prevPickerBody.empty().append(getPickerBodyTag(options.$moment1.format('YYYY-MM-DD'))); $nextPickerBody.empty().append(getPickerBodyTag(options.$moment2.format('YYYY-MM-DD'))); $prevPickerBody.find('td[data-date]').on('click', function() { pick($(this)); }); // 달력1 이벤트 추가 $nextPickerBody.find('td[data-date]').on('click', function() { pick($(this)); }); // 달력2 이벤트 추가 setTerm(); }; function getPickerBodyTag(pDate) { var currMonthStartDate = moment(moment(pDate).startOf('month').format('YYYY-MM-DD')); // 현재월의 시작일 var currMonthLastDate = moment(moment(pDate).endOf('month').format('YYYY-MM-DD')); // 현재월의 마지막일 var prevMonthLastDate = moment(moment(pDate).add(-1, 'M').endOf('month').format('YYYY-MM-DD')); // 이전달의 마지막일 var nextMonthStartDate = moment(moment(pDate).add( 1, 'M').startOf('month').format('YYYY-MM-DD')); // 다음달의 시작일 var calendarTag = ''; // 0: 일, 1: 월, 2: 화. 3: 수, 4: 목, 5: 금, 6: 토 var day = currMonthStartDate.day(); // == 0 ? 7 : currMonthStartDate.day(); prevMonthLastDate.add(-day, 'day'); for(var i=0; i'; var className = ''; switch ( pDay ) { case 0 : className = 'sun'; break; case 6 : className = 'sat'; break; default: className = ''; break; } if(selectedDate == pDate) className += ' on first'; return '' + pDD + ''; }; function showLayer(pPicker) { // 달력레이어가 활성화 되지 않았을 경우 if(!$layer.is(':visible')) { options.$moment1 = new moment($selectorFrom.val()); if( options.$moment1.isValid() ) { options.$moment2 = new moment($selectorFrom.val()).add(1, 'M'); } else { options.$moment1 = new moment(); options.$moment2 = new moment().add(1, 'M'); } $selectedFrom.empty().text($selectorFrom.val()); $selectedTo.empty().text($selectorTo.val()); if( !isEnableDate( moment( options.$moment1.format('YYYYMMDD') ).format('YYYYMMDD'), 'YYYYMMDD' ) || !isEnableDate( moment( options.$moment2.format('YYYYMMDD') ).format('YYYYMMDD'), 'YYYYMMDD' ) ) { //clear(); options.$moment1 = new moment( options.minDate ? options.minDate : options.maxDate ); options.$moment2 = new moment( options.minDate ? options.minDate : options.maxDate ).add(1, 'M'); } drawPicker(0); var position = getPos(pPicker); $layer.show(); // X좌표 if( $(window).height() + window.scrollY < position.x + $layer.find('.inner').height() ) { $layer.css('top' , ( position.x - $layer.find('.inner').height() - 38 ) + 'px'); } else { $layer.css('top' , position.x + 'px'); } // Y좌표 if( $(window).width() + window.scrollX < position.y + $layer.find('.inner').width() ) { $layer.css('left', (position.y - $layer.find('.inner').width() + pPicker.width() ) + 'px'); } else { $layer.css('left', position.y + 'px'); } } // 달력레이어가 활성화 되있을 경우 범위를 설정 else setTerm(); }; // 컨트롤 절대 위치 반환 function getPos(pPicker) { var el = pPicker.get(0); var rect = el.getBoundingClientRect(); var x = rect.left + ( window.scrollX || window.pageXOffset ); var y = rect.top + ( window.scrollY || window.pageYOffset ); return { x: y, y: x }; }; // 날짜선택 function pick(pPick) { var pickDate = pPick.attr('data-date'); if( !isEnableDate( moment( pickDate ).format('YYYYMMDD'), 'YYYYMMDD' ) ) { return; } if(options.multi) { // 시작일 설정 if( $selectedLbFrom.hasClass('active') ) { if( $selectedTo.text() && moment($selectedTo.text()).isValid() && moment(pickDate).isAfter( moment($selectedTo.text()) ) ) { $selectedTo.empty(); } $selectedFrom.empty().text(pickDate); $selectedLbFrom.removeClass('active'); $selectedLbTo.addClass('active'); } // 종료일 설정 else { if( $selectedFrom.text() && moment($selectedFrom.text()).isValid() && moment(pickDate).isBefore( moment($selectedFrom.text()) ) ) { $selectedFrom.empty().text(pickDate); $selectedTo.empty(); } else { $selectedTo.empty().text(pickDate); } } setTerm(); } else { options.$moment1 = moment(pickDate); $selector.val(pickDate); $selector.trigger('change'); $layer.hide(); } }; function setTerm() { if(options.multi) { $layer.find('td').removeClass('on').removeClass('first').removeClass('end'); $layer.find('td[data-date="' + $selectedFrom.text() + '"]').addClass('on').addClass('first'); $layer.find('td[data-date="' + $selectedTo.text() + '"]').addClass('on').addClass('end'); // 시작일, 종료일이 정상적일 경우 그림 if( moment($selectedFrom.text()).isValid() || moment($selectedTo.text()).isValid() ) { var $tempMomentFrom = moment($selectedFrom.text()); var $tempMomentTo = moment($selectedTo.text()); while ( $tempMomentFrom.isBefore($tempMomentTo) ) { $layer.find('[data-date="' + $tempMomentFrom.format('YYYY-MM-DD') + '"]').addClass('on'); $tempMomentFrom.add(1, 'day'); } } } }; function isEnableDate( pCompareDate, pFormat ) { if( options.minDate && options.maxDate ) { var tempDate = pCompareDate * 1; var minDate = moment( options.minDate ).format(pFormat) * 1; var maxDate = moment( options.maxDate ).format(pFormat) * 1; if( tempDate < minDate || tempDate > maxDate ) { return false; } } if( options.minDate ) { var tempDate = pCompareDate * 1; var minDate = moment( options.minDate ).format(pFormat) * 1; var rToday = moment( options.today ).format(pFormat) * 1; if( tempDate < minDate ) return false; if( pFormat == "YYYYMMDD" && tempDate < rToday ) { return false; } } if( options.maxDate ) { var tempDate = pCompareDate * 1; var maxDate = moment( options.maxDate ).format(pFormat) * 1; if( tempDate > maxDate ) return false; } return true; }; function clear() { $selectorFrom.val(''); $selectorTo.val(''); $selectedFrom.empty(); $selectedTo.empty(); options.$moment1 = new moment(); options.$moment2 = new moment().add(1, 'M'); drawPicker(0); $selectedLbFrom.addClass('active'); $selectedLbTo.removeClass('active'); }; init(); }; ControlManage2.prototype.month = function(pOptions) { var item = $('[data-area="' + pOptions.areaName + '"] [name="' + pOptions.controlName + '"]'); var control = new Control({ selector : '[data-area="' + pOptions.areaName + '"] [data-control="' + pOptions.controlName + '"]', obj : item, areaName : pOptions.areaName, controlName: pOptions.controlName, controlType: item.attr('data-control'), }); control.getMonthLayerTag = function() { return ''; }; // 메서드 변경 control.init = function() { var _this = this; _this.obj.off(); // 이벤트제거 _this.obj.attr('autocomplete', 'off'); // 자동완성제거 _this.obj.removeAttr('readonly'); // 읽기전용제거 _this.obj.nextAll('.btn-clear').remove(); _this.obj.after(''); _this.obj.addClass('position'); $('.wrap').find('[data-control-layer][data-area-name="' + _this.areaName + '"][data-control-name="' + _this.controlName + '"]').remove(); // 레이어제거 _this.monthLayer = $(_this.getMonthLayerTag()); // 콤보레이어 객체 할당 $('.wrap').append( _this.monthLayer ); // 콤보레이어 추가 if(_this.cleave) _this.cleave.destroy(); _this.cleave = new Cleave(_this.obj, { date: true, delimiter: '-', datePattern: ['Y', 'm'] }); }; control.bindEvent = function() { var _this = this; _this.obj.on('click', function() { _this.obj.val(); var $moment; if( moment(_this.obj.val(), 'YYYY-MM').isValid() ) { $moment = moment(_this.obj.val(), 'YYYY-MM'); } else { $moment = moment(); } _this.monthLayer.find('.calendar-header').empty().append( $moment.format('YYYY') ); // 년도설정 _this.monthLayer.find('.calendar-month-select button').removeClass('on'); // 선택 월 스타일 초기화 _this.monthLayer.find('.calendar-month-select button[value="' + $moment.format('MM') + '"]').addClass('on'); // 선택 월 스타일 추가 _this.showLayer(); }); _this.monthLayer.find('.btn-close').on('click', function() { _this.hideLayer(); }); _this.monthLayer.find('.calendar-month-select button').on('click', function() { _this.setData( _this.monthLayer.find('.calendar-header').text() + '-' + $(this).val() ); _this.hideLayer(); }); _this.monthLayer.find('a.calendar-prev').on('click', function() { var year = _this.monthLayer.find('.calendar-header').text() * 1 - 1; _this.monthLayer.find('.calendar-header').empty().append(year); }); _this.monthLayer.find('a.calendar-next').on('click', function() { var year = _this.monthLayer.find('.calendar-header').text() * 1 + 1; _this.monthLayer.find('.calendar-header').empty().append(year); }); _this.obj.nextAll('.btn-clear').on('click', function() { _this.setData(''); _this.obj.nextAll('.btn-clear').hide(); }); }; control.showLayer = function() { var _this = this; // 모든 레이어 닫기 $('[data-control-layer]').hide(); // 컨트롤 위치를 찾아 레이어 위치를 설정 var position = _this.getPos(); _this.monthLayer.css('top', position.x + 'px'); _this.monthLayer.css('left',position.y + 'px'); _this.monthLayer.show(); }; control.hideLayer = function() { var _this = this; _this.monthLayer.hide(); _this.obj.blur(); }; // 컨트롤 절대 위치 반환 control.getPos = function() { var _this = this; var el = _this.obj.get(0); var rect = el.getBoundingClientRect(); var x = rect.left + ( window.scrollX || window.pageXOffset ); var y = rect.top + ( window.scrollY || window.pageYOffset ); return { x: y, y: x }; }; control.init(); control.bindEvent(); this.areas[pOptions.areaName]['controls'][pOptions.controlName] = control; }; ControlManage2.prototype.initComboMobile = function(pAreaName, pControlName, pUrl, pParam, pCVT, pAddData, pSnyc) { var _that = this; var item = $('[data-area="' + pAreaName + '"] [name="' + pControlName + '"]'); var controlType = item.attr('data-control'); var comboType = item.attr('data-combo-type'); var control = new Control({ selector : '[data-area="' + pAreaName + '"] [data-control="' + pControlName + '"]', obj : item, areaName : pAreaName, controlName: pControlName, controlType: controlType, }); // 프로퍼티 추가 control.comboType = comboType; // S (검색콤보) control.comboData = []; control.nodatatxt = ' 검색결과가 없습니다.'; control.inittxt = '검색어를 입력하세요.'; /******************************************************************************/ // 콤보레이어 /******************************************************************************/ control.getComboLayerTag = function() { return ''; }; /******************************************************************************/ // 콤보아이템 /******************************************************************************/ control.bindComboItem = function() { var _this = this; var comboItemTag = ''; _this.comboData.forEach(function(cur) { var code = cur[pCVT.code]; var value = cur[pCVT.value]; var text = cur[(pCVT.text ? pCVT.text : pCVT.value)]; comboItemTag += '
  • ' + text + '
  • '; }); _this.comboItems = $(comboItemTag); _this.comboLayer.find('ul').empty().append(_this.comboItems); // 콤보아이템 바인딩 _this.addComboItemEvent(); // 콤보아이템 이벤트 설정 // 첫번째 데이터 선택 if(_this.comboData.length > 0) { _this.setData(_this.comboData[0][pCVT.code]); } }; /******************************************************************************/ // 콤보아이템 이벤트 /******************************************************************************/ control.addComboItemEvent = function() { var _this = this; var touchmoved; _this.comboItems.on('touchend', function(e) { e.preventDefault(); if(touchmoved != true){ _this.setData($(this).attr('data-code')); } }).on('touchmove', function(e){ touchmoved = true; }).on('touchstart', function(){ touchmoved = false; }); }; /******************************************************************************/ // 콤보아이템 검색 /******************************************************************************/ control.bindFilterComboItem = function(pFilterTxt, pIsShow) { var _this = this; // 콤보아이템 텍스트 초기화 (강조표시 초기화) _this.comboLayer.find('ul.list li.filter').each(function(idx, item) { $(item).removeClass('filter').find('a').empty().append( $(item).attr('data-text') ); }); // 선택초기화 _this.comboLayer.find('ul.list li.selected').removeClass('selected'); // 검색어가 존재할 경우 if(pFilterTxt) { // 전체 콤보아이템 숨김 _this.comboItems.hide(); // 검색어와 일치하는 콤보아이템을 할당 var _$comboItemsFilter = _this.comboLayer.find('ul.list li[data-text*="' + pFilterTxt + '"]'); if(_$comboItemsFilter.length > 0) { _$comboItemsFilter.each(function(idx, item) { var text = btUtil.replaceAll($(item).attr('data-text'), pFilterTxt, '' + pFilterTxt + ''); $(item).addClass('filter'); $(item).show(); $(item).find('a').empty().append(text); }); _this.comboLayer.find('.no-data').hide(); _this.comboLayer.find('ul.list').show(); } else { // 검색 결과가 없습니다. _this.comboLayer.find('.no-data').empty().append(_this.nodatatxt); _this.comboLayer.find('.no-data').show(); } } // 검색어가 존재하지 않을 경우 else { _this.comboLayer.find('ul.list').show(); _this.comboLayer.find('.no-data').hide(); _this.comboItems.show(); } // 검색결과 if( _this.comboLayer.find('ul.list li.filter').length > 0 ) { _this.comboLayer.find('ul.list li.filter:eq(0)').addClass('selected'); } else { _this.comboLayer.find('ul.list li.on:eq(0)').addClass('selected'); } if(pIsShow) _this.comboLayer.show(); }; // 메서드 변경 control.init = function() { var _this = this; _this.obj.off(); // 이벤트제거 _this.obj.attr('autocomplete', 'off'); // 자동완성제거 _this.obj.removeAttr('readonly'); // 읽기전용제거 _this.obj.nextAll('.btn-clear').remove(); // 삭제버튼제거 _this.obj.removeClass('position'); // 클래스제거 _this.obj.nextAll('[data-control-layer]').remove(); // 레이어제거 // 검색이 가능한 콤보일 경우 if(comboType == 'S') { _this.obj.removeAttr('readonly'); _this.obj.after(''); _this.obj.addClass('position'); } // 검색이 불가한 콤보일 경우 else { _this.obj.attr('readonly', 'readonly'); // 읽기전용 _this.obj.nextAll('.btn-clear').remove(); // 삭제버튼제거 _this.obj.removeClass('position'); // 클래스제거 } _this.obj.after( _this.getComboLayerTag() ); // 콤보레이어 _this.comboLayer = _this.obj.nextAll('[data-control-layer]'); // 콤보레이어 객체 할당 _this.setComboData(); // 콤보 데이터 설정 }; control.bindEvent = function() { var _this = this; // 콤보 포커싱 _this.obj.on('focusin', function() { hideLayers(); if( _this.comboType == 'S' ) _this.obj.val(''); _this.bindFilterComboItem('', true); }); // 콤보레이어 활성화시 키이동 클릭시 스크롤 방지 _this.obj.on('keydown', function(e) { switch(e.keyCode){ case 37: case 39: case 38: case 40: // Arrow keys // case 32: // e.preventDefault(); break; // Space } }); // 콤보 키이벤트 _this.obj.on('keyup' , function(e) { var isFilter = ( _this.comboLayer.find('ul.list li.filter').length > 0 ? true : false ); switch(e.keyCode) { case 27: // ESC _this.hideLayer(); break; case 38: // UP var $selectedComboItem = _this.comboLayer.find('ul.list li.selected'); var $selectedComboItemPrev = $selectedComboItem.prev(); if( isFilter ) { $selectedComboItemPrev = $selectedComboItem.prevAll('li.filter:eq(0)'); } if($selectedComboItemPrev.length > 0) { $selectedComboItem.removeClass('selected'); var topPos = $selectedComboItemPrev.addClass('selected').get(0).offsetTop; if(_this.comboLayer.find('ul').get(0).scrollTop > topPos) _this.comboLayer.find('ul').get(0).scrollTop = topPos; } break; case 40: // DOWN var comboHeight = _this.comboLayer.find('ul').height(); // 콤보높이 var comboItemHeight = _this.comboLayer.find('li:eq(0)').height(); // 콤보항목높이 var $selectedComboItem = _this.comboLayer.find('ul.list li.selected'); if( $selectedComboItem.length <= 0 ) { _this.comboLayer.find('li:eq(0)').addClass('selected'); return; } var $selectedComboItemNext = $selectedComboItem.next(); if( isFilter ) { $selectedComboItemNext = $selectedComboItem.nextAll('li.filter:eq(0)'); } if($selectedComboItemNext.length > 0) { $selectedComboItem.removeClass('selected'); var topPos = $selectedComboItemNext.addClass('selected').get(0).offsetTop; // 스크롤 존재시 if( _this.hasVerticalScrollBar() && _this.comboLayer.find('ul').get(0).scrollTop + comboHeight - comboItemHeight < topPos ) { _this.comboLayer.find('ul').get(0).scrollTop = topPos; } } break; case 13: // ENTER _this.setData(_this.comboLayer.find('ul.list li.selected').attr('data-code')); break; default: if(_this.comboType != 'S') return; _this.bindFilterComboItem( _this.obj.val(), true ); break; } }); _this.obj.nextAll('.btn-clear').on('click', function() { // 필요한 컨트롤 : text, time, hp, tel, card, number, combo(검색) _this.setData(''); _this.obj.nextAll('.btn-clear').hide(); }); }; control.setData = function(pValue) { var _this = this; pValue = (pValue ? pValue : ''); var findData = _this.comboData.find(function(cur) { return ( cur[pCVT.code] == pValue ); }); if(!findData) return; var code = findData[pCVT.code] var value = findData[pCVT.value] var text = findData[pCVT.text] ? findData[pCVT.text] : findData[pCVT.value]; _this.obj.attr('data-code' , code); _this.obj.attr('data-value', value); _this.obj.attr('data-text' , text); _this.obj.val(value); if(_this.comboItems) { _this.comboItems.removeClass('selected'); _this.comboItems.removeClass('on'); var highlightItem = _this.comboItems.find('strong'); if( highlightItem ) { var highlightItemText = highlightItem.closest('li').attr('data-text'); highlightItem.closest('a').empty().append(highlightItemText); } } _this.comboLayer.find('ul.list li[data-code="' + _this.obj.attr('data-code') + '"]').addClass('on'); _this.comboLayer.hide(); _this.obj.blur(); if(pValue /* && _this.comboLayer.find('ul.list li[data-code=""]').length > 0 */ ) _this.obj.nextAll('.btn-clear').show(); else _this.obj.nextAll('.btn-clear').hide(); _this.obj.trigger('combo-change'); }; control.getData = function(pIsObj) { if(pIsObj) { return { code : this.obj.attr('data-code'), value: this.obj.attr('data-value') } } else { return this.obj.attr('data-code'); } }; control.clear = function() { var _this = this; if( _this.comboData.length > 0 ) { _this.setData(_this.comboData[0][pCVT.code]); } _this.obj.closest('dl').removeClass('error'); }; // 메서드 추가 control.setComboData = function() { var _this = this; if(pAddData && pAddData.length > 0) _this.comboData = _this.comboData.concat(pAddData); if(pUrl) { if( pSnyc ) { btUtil.send_sync(pUrl, pParam, function(data) { for(var key in data) { _this.comboData = _this.comboData.concat(data[key]); } _this.bindComboItem(); }); } else { btUtil.send(pUrl, pParam, function(data) { for(var key in data) { _this.comboData = _this.comboData.concat(data[key]); } _this.bindComboItem(); }); } } else _this.bindComboItem(); }; control.hideLayer = function() { var _this = this; _this.setData(_this.obj.attr('[data-code]')); _this.comboLayer.hide(); _this.obj.blur(); }; // 레이어에 스크롤이 있는지 체크 control.hasVerticalScrollBar = function() { return this.comboLayer.find('ul').get(0) ? this.comboLayer.find('ul').get(0).scrollHeight > this.comboLayer.find('ul').innerHeight() : false; }; control.init(); control.bindEvent(); _that.areas[pAreaName]['controls'][pControlName] = control; }; ControlManage2.prototype.initComboSrMobile = function(pAreaName, pControlName, pCVT, pCallback) { var _that = this; var item = $('[data-area="' + pAreaName + '"] [name="' + pControlName + '"]'); var controlType = item.attr('data-control'); var comboType = item.attr('data-combo-type'); var control = new Control({ selector : '[data-area="' + pAreaName + '"] [data-control="' + pControlName + '"]', obj : item, areaName : pAreaName, controlName: pControlName, controlType: controlType, }); // 프로퍼티 추가 control.comboType = comboType; // S (검색콤보) control.comboData = []; control.isSearching = false; // 실시간검색중 : true control.nodatatxt = ' 검색결과가 없습니다.'; control.inittxt = '검색어를 입력하세요.'; /******************************************************************************/ // 콤보레이어 /******************************************************************************/ control.getComboLayerTag = function() { return ''; }; /******************************************************************************/ // 콤보아이템 /******************************************************************************/ control.bindComboItem = function(data) { var _this = this; _this.comboData = data; var comboItemTag = ''; data.forEach(function(cur) { var code = cur[ pCVT.code ]; var value = cur[ pCVT.value ]; var text = cur[ pCVT.text ]; comboItemTag += '
  • ' + text + '
  • '; }); _this.comboItems = $(comboItemTag); _this.comboItems.eq(0).addClass('selected'); _this.comboLayer.find('ul').empty().append(_this.comboItems); // 콤보아이템 바인딩 _this.addComboItemEvent(); if(data.length > 0) { _this.comboLayer.find('ul').show(); _this.comboLayer.find('.no-data').hide(); } else if( _this.obj.val().length > 0 && data.length <= 0 ) { _this.comboLayer.find('ul').hide(); _this.comboLayer.find('.no-data').empty().append(_this.nodatatxt).show(); } else { _this.comboLayer.find('ul').hide(); _this.comboLayer.find('.no-data').empty().append(_this.inittxt).show(); } _this.isSearching = false; }; /******************************************************************************/ // 콤보아이템 이벤트 /******************************************************************************/ control.addComboItemEvent = function() { var _this = this; var touchmoved; _this.comboItems.on('touchend', function(e) { e.preventDefault(); if(touchmoved != true){ _this.setData($(this).attr('data-code')); } }).on('touchmove', function(e){ touchmoved = true; }).on('touchstart', function(){ touchmoved = false; }); }; // 메서드 변경 control.init = function() { var _this = this; _this.obj.off(); // 이벤트제거 _this.obj.attr('autocomplete', 'off'); // 자동완성제거 _this.obj.removeAttr('readonly'); _this.obj.nextAll('.btn-clear').remove(); _this.obj.after(''); _this.obj.addClass('position'); _this.obj.nextAll('[data-control-layer]').remove(); // 레이어제거 // 추가 //_this.comboLayer = $(_this.getComboLayerTag()); //$('.wrap').append( _this.comboLayer ); // 콤보레이어 //_this.maxHeight = _this.comboLayer.find('ul').css('max-height').replace(/[^-\d\.]/g, '') * 1; // 콤보레이어 최대높이 할당 _this.obj.after( _this.getComboLayerTag() ); // 콤보레이어 _this.comboLayer = _this.obj.nextAll('[data-control-layer]'); // 콤보레이어 객체 할당 }; control.bindEvent = function() { var _this = this; // 콤보 포커싱 _this.obj.on('focusin', function() { $(this).nextAll('[data-control-layer]').css('display', 'block'); _this.obj.val(''); _this.comboLayer.find('ul').hide(); _this.comboLayer.find('.no-data').empty().append(_this.nodatatxt).show(); _this.obj.nextAll('.btn-clear').hide(); // _this.showLayer(); }); // 콤보레이어 활성화시 키이동 클릭시 스크롤 방지 _this.obj.on('keydown', function(e) { switch(e.keyCode) { case 38: case 40: // Arrow keys // case 32: // e.preventDefault(); break; // Space } }); // 콤보 키이벤트 _this.obj.on('keyup' , function(e) { switch(e.keyCode) { case 27: // ESC _this.hideLayer(); break; case 38: // UP var $selectedComboItem = _this.comboLayer.find('ul.list li.selected'); var $selectedComboItemPrev = $selectedComboItem.prev('li:visible'); if($selectedComboItemPrev.length > 0) { $selectedComboItem.removeClass('selected'); var topPos = $selectedComboItemPrev.addClass('selected').get(0).offsetTop; if(_this.comboLayer.find('ul').get(0).scrollTop > topPos) _this.comboLayer.find('ul').get(0).scrollTop = topPos; } break; case 40: // DOWN var comboHeight = _this.comboLayer.find('ul').height(); // 콤보높이 var comboItemHeight = _this.comboLayer.find('li:eq(0)').height(); // 콤보항목높이 var $selectedComboItem = _this.comboLayer.find('ul.list li.selected'); if( $selectedComboItem.length <= 0 ) { _this.comboLayer.find('li:eq(0)').addClass('selected'); return; } var $selectedComboItemNext = $selectedComboItem.next('li:visible'); if($selectedComboItemNext.length > 0) { $selectedComboItem.removeClass('selected'); var topPos = $selectedComboItemNext.addClass('selected').get(0).offsetTop; // 스크롤 존재시 if( _this.hasVerticalScrollBar() && _this.comboLayer.find('ul').get(0).scrollTop + comboHeight - comboItemHeight < topPos ) { _this.comboLayer.find('ul').get(0).scrollTop = topPos; } } break; case 13: // ENTER _this.setData(_this.comboLayer.find('ul.list li.selected').attr('data-code')); break; default: if( !_this.isSearching ) { _this.isSearching = true; setTimeout(function() { pCallback.call(_this, _this.bindComboItem ); }, 500); } break; } }); _this.obj.nextAll('.btn-clear').on('click', function() { // 필요한 컨트롤 : text, time, hp, tel, card, number, combo(검색) _this.setData(''); _this.obj.nextAll('.btn-clear').hide(); }); }; control.setData = function(pValue) { var _this = this; pValue = (pValue ? pValue : ''); var findData = _this.comboData.find(function(cur) { return ( cur[pCVT.code] == pValue ); }); if( pValue && !findData && typeof _this.setSearchData == 'function') { findData = _this.setSearchData(pValue); } var code = ''; var value = ''; var text = ''; if(findData) { code = findData[pCVT.code] value = findData[pCVT.value] text = findData[pCVT.text] ? findData[pCVT.text] : findData[pCVT.value]; } _this.obj.attr('data-code' , code); _this.obj.attr('data-value', value); _this.obj.attr('data-text' , text); _this.obj.val(value); // _this.comboItems.removeClass('selected'); // _this.comboItems.removeClass('on'); // _this.comboLayer.find('ul.list li[data-code="' + _this.obj.attr('data-code') + '"]').addClass('on'); _this.comboLayer.hide(); _this.obj.blur(); // var highlightItem = _this.comboItems.find('strong'); // // if( highlightItem ) { // var highlightItemText = highlightItem.closest('li').attr('data-text'); // highlightItem.closest('a').empty().append(highlightItemText); // } if( _this.obj.val().length > 0 ) _this.obj.nextAll('.btn-clear').show(); else _this.obj.nextAll('.btn-clear').hide(); _this.obj.trigger('combo-change'); }; control.getData = function(pIsObj) { if(pIsObj) { return { code : this.obj.attr('data-code'), value: this.obj.attr('data-value') } } else { return this.obj.attr('data-code'); } }; control.clear = function() { var _this = this; // _this.setData(''); _this.obj.closest('dl').removeClass('error'); }; control.hideLayer = function() { var _this = this; _this.setData(_this.obj.attr('[data-code]')); _this.comboLayer.hide(); _this.obj.blur(); }; // 레이어에 스크롤이 있는지 체크 control.hasVerticalScrollBar = function() { return this.comboLayer.find('ul').get(0) ? this.comboLayer.find('ul').get(0).scrollHeight > this.comboLayer.find('ul').innerHeight() : false; } control.init(); control.bindEvent(); _that.areas[pAreaName]['controls'][pControlName] = control; }; /** * @method paging * 페이징(웹) * @param {String,Object} pSelector * @param {function} pTotalCount * @param {object} pRowCount * @param {object} pPageNo * @param {object} pCallback * @param {object} pThis * @docauthor Redcap Tour * @author hsjeong */ ControlManage.prototype.paging = ControlManage2.prototype.paging = function(pSelector, pTotalCount, pRowCount, pPageNo, pCallback, pThis) { var _this = this; pThis = pThis ? pThis : this; var $ele; if(typeof pSelector === 'string') $ele = $(pSelector); else $ele = pSelector; var totalCount = pTotalCount * 1; // 전체행갯수 var rowCount = pRowCount * 1; // 페이지당 보여줄 행갯수 var pageSize = 10; // 화면에 보여줄 페이지번호 갯수 var pageNo = pPageNo * 1; // 현재페이지 var pageCnt = totalCount % rowCount; var html = new Array(); if (totalCount == 0) return ''; // 페이지 카운트 if (pageCnt == 0) { pageCnt = parseInt(totalCount / rowCount); } else { pageCnt = parseInt(totalCount / rowCount) + 1; } var pRCnt = parseInt(pageNo / pageSize); if (pageNo % pageSize == 0) { pRCnt = parseInt(pageNo / pageSize) - 1; } html.push('
    '); html.push('처음 페이지'); html.push(''); html.push(''); for (var index = pRCnt * pageSize + 1; index < (pRCnt + 1) * pageSize + 1; index++) { // 현재 페이지 효과 if (index == pageNo) { html.push('' + index + ''); } else { html.push('' + index + ''); } if (index == pageCnt) { break; } } html.push(''); html.push(''); html.push('마지막 페이지'); html.push('
    '); $ele.empty().append(html.join('')); $ele.find('.paging a.first').on('click', function() { if(pCallback) pCallback.call(pThis, 1, pRowCount); else _this.paging( pSelector, pTotalCount, pRowCount, 1, pCallback, pThis ); }); $ele.find('.paging a.prev').on('click', function() { var tempPageNo = pageNo - 1; if(tempPageNo <= 0) return; if(pCallback) pCallback.call(pThis, tempPageNo, pRowCount); else _this.paging( pSelector, pTotalCount, pRowCount, tempPageNo, pCallback, pThis ); }); $ele.find('.paging a.next').on('click', function() { var tempPageNo = pageNo + 1; if(tempPageNo > pageCnt) return; if(pCallback) pCallback.call(pThis, tempPageNo, pRowCount); else _this.paging( pSelector, pTotalCount, pRowCount, tempPageNo, pCallback, pThis ); }); $ele.find('.paging a.last').on('click', function() { if(pCallback) pCallback.call(pThis, pageCnt, pRowCount); else _this.paging( pSelector, pTotalCount, pRowCount, pageCnt, pCallback, pThis ); }); $ele.find('span a').on('click', function() { if(pCallback) { pCallback.call(pThis, $(this).text() * 1, pRowCount); } else { _this.paging( pSelector, pTotalCount, pRowCount, $(this).text(), pCallback, pThis ); } }); }; /************************************************************************************************************************************************************/ // 팝업 /************************************************************************************************************************************************************/ /** * @method InitBtrvrPopup * 출장자팝업 * @param {Object} pOptions * @param {Function} pCallback 출장자확인 콜백함수 * @docauthor Redcap Tour * @author hsjeong */ function InitBtrvrPopup(pOptions, pCallback) { this.id = pOptions.id; this.btrvrData; // 출장자 this.custcoEsmbrTySeCdData; // 임직원형태 (임직원,비회원,가족) this.selfStlmYn; // 결제 (본인,동행자) this.esmbrRegPopup; this.popupTag; this.$popup; this.$btnAdd; this.$btnConfirm; this.$btnClose; this.conMngs = {}; // 출장자팝업태그반환 this.getPopupTag = function() { var _this = this; return ''; }; // 출장자입력폼태그반환 this.getBtrvrFormTag = function(areaName) { return '
    ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + '
    ' + '
    ' + '
    출장자
    ' + '
    ' + '
    ' + ' ' + '
    ' + '
    ' + '
    ' + '
    ' + '
    ' + '
    ' + '
    ' + '
    ' + ' ' + '
    ' + '
    ' + '
    ' + '
    ' + '
    ' + '
    ' + '
    ' + '
    ' + ' ' + '
    ' + '
    ' + '
    ' + '
    ' + ' ' + '
    '; }; // 출장자팝업 열기 this.open = function(pBtrvrs) { var _this = this; _this.conMngs = {}; $('#' + _this.id).find('[name="btrvrs"]').empty(); pBtrvrs.forEach(function(cur) { _this.addBtrvr(cur); }); _this.addBtrvr({ CUSTCO_ESMBR_TY_SE_CD: '1' }); popupLayerOpen('#' + _this.id); }; // 출장자팝업 닫기 this.close = function() { popupLayerClose('#' + this.id + ' .popup-close'); }; this.addConMng = function(pAreaName, pConMng) { this.conMngs[pAreaName] = pConMng; }; // 출장자추가 this.addBtrvr = function(pBtrvrData) { var _this = this; var areaName = btUtil.getRandomId() + 'Area'; var bindTag = _this.getBtrvrFormTag(areaName); var $bindTag = $(bindTag); $('#' + _this.id).find('[name="btrvrs"]').append($bindTag); var conMng = new ControlManage2(areaName); _this.addConMng(areaName, conMng); // 임직원형태 conMng.initCombo(areaName, 'CUSTCO_ESMBR_TY_SE_CD', null, null, { code : 'CD', value : 'CD_NM' }, _this.custcoEsmbrTySeCdData, false); // 결제형태 conMng.initCombo(areaName, 'SELF_STLM_YN', null, null, { code : 'CD', value : 'CD_NM' }, _this.selfStlmYn, false); conMng.initComboSr(areaName, 'CUSTCO_ESMBR_NO', { code: 'CD', value: 'CD_NM', text: 'CD_DESC' }, function( bindComboItem ) { var _that = this; var param = { CD_NM : conMng.control(areaName, 'CUSTCO_ESMBR_NO').obj.val(), CUSTCO_ESMBR_TY_SE_CD: conMng.control(areaName, 'CUSTCO_ESMBR_TY_SE_CD').getData(), NOT_IN_CD : _this.getBtrvrData().map(function(cur) { return cur.CUSTCO_ESMBR_NO; }).join(','), }; btUtil.send( 'BRS_BT_WEB_RetrieveEsmbrUserAutoCombo', { baRs: 'OUT_PSET', IN_PSET: param }, function(data) { bindComboItem.call(_that, data.OUT_PSET); }); }); // 임직원형태 변경 이벤트 conMng.control(areaName, 'CUSTCO_ESMBR_TY_SE_CD').obj.on('combo-change', function() { if( conMng.control(areaName, 'CUSTCO_ESMBR_TY_SE_CD').getData() == '1' ) { conMng.control(areaName, 'SELF_STLM_YN').obj.prop('disabled', true); } else { conMng.control(areaName, 'SELF_STLM_YN').obj.prop('disabled', false); } conMng.control(areaName, 'CUSTCO_ESMBR_NO').setData(''); conMng.control(areaName, 'SELF_STLM_YN').setData('Y'); }); // 삭제 $bindTag.find('.btn-del').on('click', function() { _this.delBtrvr(areaName); }); if( pBtrvrData ) { conMng.control(areaName, 'CUSTCO_ESMBR_TY_SE_CD').setData( pBtrvrData.CUSTCO_ESMBR_TY_SE_CD); conMng.control(areaName, 'SELF_STLM_YN').setData(pBtrvrData.SELF_STLM_YN); conMng.control(areaName, 'CUSTCO_ESMBR_NO').obj.attr('data-code', pBtrvrData.CUSTCO_ESMBR_NO) conMng.control(areaName, 'CUSTCO_ESMBR_NO').obj.attr('data-value', pBtrvrData.CUSTCO_ESMBR_NM) conMng.control(areaName, 'CUSTCO_ESMBR_NO').obj.attr('data-text', pBtrvrData.CUSTCO_ESMBR_NM) conMng.control(areaName, 'CUSTCO_ESMBR_NO').obj.val(pBtrvrData.CUSTCO_ESMBR_NM); } _this.changeBtrvr(); }; this.delConMng = function(pAreaName) { delete this.conMngs[pAreaName]; }; // 출장자삭제 this.delBtrvr = function(pAreaName) { var _this = this; $('#' + _this.id).find('[data-area="' + pAreaName + '"]').remove(); // 요소삭제 _this.delConMng(pAreaName); // 객체삭제 _this.changeBtrvr(); // 출장자인원라벨 변경 }; // 출장자인원변경 this.changeBtrvr = function() { $('#' + this.id).find('.top-function strong').text('출장자' + ' 선택 ' + Object.keys(this.conMngs).length ); }; // 출장자정보반환 this.getBtrvrData = function() { var _this = this; var rtnData = []; for(var key in _this.conMngs) { for(var areaName in _this.conMngs[key].areas) { var CUSTCO_ESMBR_NO = _this.conMngs[key].control(areaName, 'CUSTCO_ESMBR_NO').getData(true); if( CUSTCO_ESMBR_NO.code ) { rtnData.push({ BIZ_NO : USER_SESSION.BIZ_NO, CUSTCO_ESMBR_NO : _this.conMngs[key].control(areaName, 'CUSTCO_ESMBR_NO').getData(true).code, CUSTCO_ESMBR_NM : _this.conMngs[key].control(areaName, 'CUSTCO_ESMBR_NO').getData(true).value, CUSTCO_ESMBR_TY_SE_CD: _this.conMngs[key].control(areaName, 'CUSTCO_ESMBR_TY_SE_CD').getData(), SELF_STLM_YN : _this.conMngs[key].control(areaName, 'SELF_STLM_YN').getData() }); } } } return rtnData; } this.init = function() { var _this = this; btUtil.send_sync('BRS_BT_WEB_RetrieveCmCodeList', { baRs: 'OUT_PSET', IN_PSET: { GRP_CD: 'CUSTCO_ESMBR_TY_SE_CD', ATTR1: 'Y' } }, function(data) { _this.custcoEsmbrTySeCdData = data.OUT_PSET; }); _this.selfStlmYn = [ { CD: 'Y', CD_NM: '동행자본인결제'}, { CD: 'N', CD_NM: '대리등록자결제' } ]; _this.popupTag = _this.getPopupTag(); _this.$popup = $(_this.popupTag); _this.$btnAdd = _this.$popup.find('.top-function [name="btnAdd"]'); _this.$btnConfirm = _this.$popup.find('.btn-area button'); _this.$btnClose = _this.$popup.find('.popup-close'); $('.wrap').append(_this.$popup); _this.esmbrRegPopup = new InitEsmbrRegPopup({ id: 'esmbrRegPopup' }); _this.addEvent(); }; this.addEvent = function() { var _this = this; $('#' + _this.id).find('[name="btnReg"]').on('click', function() { _this.esmbrRegPopup.open(); }); // 출장자 추가이벤트 _this.$btnAdd.on('click', function() { _this.addBtrvr({ CUSTCO_ESMBR_TY_SE_CD: '1' }); }); // 출장자 추가확인이벤트 _this.$btnConfirm.on('click' , function() { if(pCallback) { pCallback(_this.getBtrvrData()); } _this.close(); }); // 출장자팝업 닫기이벤트 _this.$btnClose.on('click', function() { if(pCallback) { pCallback(_this.getBtrvrData()); } _this.close(); }); }; this.init(); } /** * @method InitBtrvrPopup * 임직원등록팝업 * @param {Object} pOptions * @docauthor Redcap Tour * @author hsjeong */ function InitEsmbrRegPopup(pOptions) { this.id = pOptions.id; this.conMng; this.getPopupTag = function() { return ''; }; this.open = function() { var _this = this; _this.conMng.clear('esmbrRegArea'); popupLayerOpen('#' + _this.id); }; this.close = function() { popupLayerClose('#' + this.id + ' .popup-close'); }; this.init = function() { var _this = this; $('.wrap').append( _this.getPopupTag() ); _this.conMng = new ControlManage2('esmbrRegArea'); _this.conMng.control('esmbrRegArea', 'BRTH').obj.removeClass('date').removeClass('position'); // 임직원형태 _this.conMng.initCombo('esmbrRegArea', 'CUSTCO_ESMBR_TY_SE_CD', 'BRS_BT_WEB_RetrieveCmCodeList' , { baRs: 'OUT_PSET', IN_PSET: { GRP_CD: 'CUSTCO_ESMBR_TY_SE_CD', ATTR1: 'Y' } }, { code : 'CD', value : 'CD_NM' }, [], false); // 근무지 _this.conMng.initCombo('esmbrRegArea', 'BT_WRKPLC_NO' , 'BRS_BT_WEB_RetrieveWrkplcCombo', { baRs: 'OUT_PSET', IN_PSET: { BIZ_NO : USER_SESSION.BIZ_NO } }, { code : 'CD', value : 'CD_NM' }, [ { CD: '', CD_NM: '선택' } ], false); // 부서 _this.conMng.initComboSr('esmbrRegArea', 'CUSTCO_DEPT_CD', { code: 'CD', value: 'CD_NM', text: 'CD_NM' }, function( bindComboItem ) { var that = this; var param = { BIZ_NO: USER_SESSION.BIZ_NO, CD_NM : _this.conMng.control('esmbrRegArea', 'CUSTCO_DEPT_CD').obj.val() }; btUtil.send( 'BRS_BT_WEB_RetrieveDeptAutoCombo', { baRs: 'OUT_PSET', IN_PSET: param }, function(data) { bindComboItem.call(that, data.OUT_PSET); }); }); // 직위 _this.conMng.initCombo('esmbrRegArea', 'CUSTCO_OFPS_CD', 'BRS_BT_WEB_RetrieveOfpsCombo' , { baRs: 'OUT_PSET', IN_PSET: { BIZ_NO: USER_SESSION.BIZ_NO } }, { code : 'CD', value : 'CD_NM' }, [{ CD: '', CD_NM: '선택' }], true); // 도메인 _this.conMng.initCombo('esmbrRegArea', 'CUSTCO_DMN_ADR', 'BRS_BT_WEB_RetrieveDmnCombo' , { baRs: 'OUT_PSET', IN_PSET: { BIZ_NO: USER_SESSION.BIZ_NO, BTMS_CUSTCO_CD: USER_SESSION.BTMS_CUSTCO_CD } }, { code : 'CD', value : 'CD_NM' }, [], false); // 외국인여부 _this.conMng.initCombo('esmbrRegArea', 'FRR_YN', null, null, { code: 'CD', value: 'CD_NM' }, [{ CD: 'N', CD_NM: '내국인' }, { CD: 'Y', CD_NM: '외국인' }], false ); // 국제전화번호 _this.conMng.initCombo('esmbrRegArea', 'HP_INPH_NTN_NO', 'BRS_BT_WEB_RetrieveInphNoCombo', { baRs: 'OUT_LIST', IN_PSET: { COMP_CD: '', LANG_CD: '' } }, { code : 'CD', value : 'CD_NM', text: 'CD_DESC' }, [], false); // 임직원형태변경 _this.conMng.control('esmbrRegArea', 'CUSTCO_ESMBR_TY_SE_CD').obj.on('combo-change', function() { if ( _this.conMng.control('esmbrRegArea', 'CUSTCO_ESMBR_TY_SE_CD').getData() == '1' ) { _this.conMng.control('esmbrRegArea', 'CUSTCO_OFPS_CD').obj.closest('.form-table').show(); _this.conMng.control('esmbrRegArea', 'COMP_EML_ADR').obj.closest('.form-table').show(); _this.conMng.control('esmbrRegArea', 'BT_WRKPLC_NO').obj.closest('.form-table').show(); } else { _this.conMng.control('esmbrRegArea', 'CUSTCO_OFPS_CD').obj.closest('.form-table').hide(); _this.conMng.control('esmbrRegArea', 'COMP_EML_ADR').obj.closest('.form-table').hide(); _this.conMng.control('esmbrRegArea', 'BT_WRKPLC_NO').obj.closest('.form-table').hide(); } }); // 외국인/내국인변경 _this.conMng.control('esmbrRegArea', 'FRR_YN').obj.on('combo-change', function() { _this.conMng.control('esmbrRegArea', 'ENG_LSTNM').setData(''); _this.conMng.control('esmbrRegArea', 'ENG_MDL_NM').setData(''); _this.conMng.control('esmbrRegArea', 'ENG_NM').setData(''); if( _this.conMng.control('esmbrRegArea', 'FRR_YN').getData() == 'N' ) _this.conMng.control('esmbrRegArea', 'ENG_MDL_NM').obj.closest('td').hide(); else _this.conMng.control('esmbrRegArea', 'ENG_MDL_NM').obj.closest('td').show(); }); // 정합성 설정 _this.conMng.control('esmbrRegArea', 'CUSTCO_ESMBR_TY_SE_CD').rule.required = { isUse: true, msg: '구분을(를) 선택하세요.' }; _this.conMng.control('esmbrRegArea', 'KOR_FNM' ).rule.required = { isUse: true, msg: '성명국문을(를) 입력하세요.' }; _this.conMng.control('esmbrRegArea', 'ENG_LSTNM' ).rule.required = { isUse: true, msg: '성명영문을(를) 입력하세요.' }; _this.conMng.control('esmbrRegArea', 'ENG_NM' ).rule.required = { isUse: true, msg: '성명영문을(를) 입력하세요.' }; _this.conMng.control('esmbrRegArea', 'HP_NO' ).rule.required = { isUse: true, msg: '성명연락처을(를) 입력하세요.' }; _this.conMng.control('esmbrRegArea', 'BRTH' ).rule.required = { isUse: true, msg: '성명BTMS.ENL을(를) 입력하세요.' }; _this.addEvent(); }; this.addEvent = function() { var _this = this; // 저장 $('#' + _this.id).find('[name="btnEsmbrSave"]').on('click', function() { var param = _this.conMng.getDatas('esmbrRegArea'); param.HP_RCV_YN = 'Y'; param.COMP_EML_RCV_YN = 'Y'; param.ID_AUTO_CRT_YN = 'N'; param.COMP_CD = USER_SESSION.COMP_CD; param.LANG_CD = USER_SESSION.LANG_CD; param.USER_ID = USER_SESSION.USER_ID; param.BIZ_NO = USER_SESSION.BIZ_NO; var result = _this.conMng.isValid(); // 임직원등록일 경우 추가 정합성 체크 if( param.CUSTCO_ESMBR_TY_SE_CD == '1' ) { if( !param.BT_WRKPLC_NO ) { if( result.success ) { result.success = false; result.msg = '근무지을(를) 선택하세요.'; } _this.conMng.control('esmbrRegArea', 'BT_WRKPLC_NO').setValid(false); } if( !param.CUSTCO_DEPT_CD ) { if( result.success ) { result.success = false; result.msg = '부서을(를) 선택하세요.'; } _this.conMng.control('esmbrRegArea', 'CUSTCO_DEPT_CD').setValid(false); } if( !param.CUSTCO_OFPS_CD ) { if( result.success ) { result.success = false; result.msg = '직위을(를) 선택하세요.'; } _this.conMng.control('esmbrRegArea', 'CUSTCO_OFPS_CD').setValid(false); } if( !param.COMP_EML_ADR ) { if( result.success ) { result.success = false; result.msg = '이메일을(를) 입력하세요.'; } _this.conMng.control('esmbrRegArea', 'COMP_EML_ADR').setValid(false); } } else { param.REL_CUSTCO_ESMBR_NO = USER_SESSION.CUSTCO_ESMBR_NO; } if(!result.success) { Message.alert(result.msg); return; } btUtil.send('BRS_BT_ESMBR_SaveEsmbrInfoBtms', { baRs: 'OUT_RSLT', IN_PSET: param, IN_PINF: param, IN_COMP: param, IN_URG: param }, function(data) { Message.alert('저장되었습니다.'); _this.close(); }, function() {}, { showProgress: true }); }); }; this.init(); } /** * @method InitDeptPopup * 부서조회팝업 * @param {Object} pForm * @param {Object} pConMng * @param {object} pOptions * @docauthor Redcap Tour * @author hsjeong */ function InitDeptPopup(pForm, pConMng, pOptions) { // public this.id = pOptions.id; this.title = pOptions.title; this.sub_title = pOptions.sub_title; this.use_email = pOptions.use_email; this.fnConfirm = pOptions.fnConfirm; this.primarykey = pOptions.primarykey; this.selected = pOptions.selected; // single, multi // private var _param; // 임직원목록 페이징 조회를 위한 파라메터 var _deptNodeTag = ''; // 부서태그 var _rngData = {}; // 범위데이터 var _custcoEsmbrData = {}; // 부서별임직원데이터 this.getPopupTag = function() { var _this = this; var popupTag = ''; return popupTag; }; this.open = function(pData) { var _this = this; $('#' + _this.id).find('[name="CUSTCO_DEPT_NM"]').val(USER_SESSION.CUSTCO_DEPT_NM); $('#' + _this.id).find('[data-area="deptArea"]').empty(); $('#' + _this.id).find('[name="lbDeptNm"]').empty().append(' '); $('#' + _this.id).find('[name="tb01"] tbody').empty().append('내용이 없습니다.'); $('#' + _this.id).find('.paging-area').empty(); _rngData = {}; if(pData) _this.addRng(pData); _this.searchDept(USER_SESSION.CUSTCO_DEPT_NM); _this.searchCustcoEsmbrPage(1, 3, true, { CUSTCO_DEPT_CD: USER_SESSION.CUSTCO_DEPT_CD, COL_NM : '' }); popupLayerOpen('#' + _this.id); }; this.close = function() { popupLayerClose('#' + this.id + ' .popup-close'); }; /******************************************************************************/ // 부서조회 /******************************************************************************/ this.searchDept = function(pCustcoDeptNm) { var _this = this; pForm.send_sync('BRS_BT_WR_RetrieveCustcoDeptTree', { baRs: 'OUT_PSET', IN_PSET: { CUSTCO_DEPT_NM: pCustcoDeptNm } }, function(data) { // 최상위 부서 목록을 찾음 var found = data.OUT_PSET.find(function(cur) { return !cur.CUSTCO_UP_DEPT_CD; }); _this.createDeptTree(data.OUT_PSET, found); var $deptNodeTag = $(_deptNodeTag); // 부서 클릭 이벤트 추가 $deptNodeTag.find('li span label span').on('click', function() { $('#' + _this.id + ' [name="lbDeptNm"]').empty().text($(this).text()); _this.searchCustcoEsmbrPage(1, 3, true, { CUSTCO_DEPT_CD: $(this).closest('[data-node]').attr('data-node'), COL_NM : '' }); }); // 부서 체크 이벤트 추가 $deptNodeTag.find('li span input[type="checkbox"]').on('change', function() { var checked = $(this).prop('checked'); var deptCd = $(this).closest('[data-node]').attr('data-node'); if( checked ) { _this.searchCustcoEsmbrAll({ CUSTCO_DEPT_CD: deptCd, COL_NM : '' }); } // $(this).prop('checked', false); }); $('#' + _this.id + ' [data-area="deptArea"]').empty().append($deptNodeTag); categoryList(); _deptNodeTag = ''; }, function() {}, { showProgress: true }); }; /******************************************************************************/ // 품의서 임직원 조회기능 추가 /******************************************************************************/ this.searchFnm = function(pParam) { var _this = this; _this.searchCustcoEsmbrSearchPage(1, 3, true, {CUSTCO_KOR_FNM: pParam}); }; /******************************************************************************/ // 품의서 임직원 조회기능 추가 고객사임직원조회 (페이징) /******************************************************************************/ this.searchCustcoEsmbrSearchPage = function(pPageNo, pRowCount, pIsNewSearch, pParam) { var _this = this; var param; if( pIsNewSearch ) param = pParam; else if( !pIsNewSearch && _param ) param = _param; else return; pForm.send_sync('BRS_BT_WR_RetrieveCustcoEsmbrForDeptSearch', { baRq:'IN_PSET,_PAGE_NO,_ROWS_PER_PAGE', baRs: 'OUT_PSET', IN_PSET: param, _PAGE_NO: pPageNo, _ROWS_PER_PAGE: pRowCount }, function(data) { //조회결과 부서명 지우기 $('#' + _this.id + ' [name="lbDeptNm"]').empty().text(data.__PAGING_INFO_OUT__[0].__P_TOT_ROW_CNT__+'명'); var bindTag = ''; _custcoEsmbrData = []; data.OUT_PSET.forEach(function(cur, idx) { bindTag += '' + ' ' + ' ' + cur.CUSTCO_ESMBR_NM + '' + ' ' + cur.CUSTCO_DEPT_NM + '' + ' ' + cur.CUSTCO_OFPS_NM + '' + ' ' + cur.COMP_EML_ADR + '' + ''; _custcoEsmbrData[cur[_this.primarykey]] = cur; }); if(bindTag) { $('#' + _this.id + ' [name="tb01"] tbody').empty().append(bindTag); pConMng.paging('#' + _this.id + ' .paging-area', data.__PAGING_INFO_OUT__[0].__P_TOT_ROW_CNT__, pRowCount, pPageNo, _this.searchCustcoEsmbrSearchPage, _this); _param = param; // 임직원 체크 변경 이벤트 추가 $('#' + _this.id + ' [name="tb01"] tbody tr td input[type="checkbox"]').on('change', function() { if( $(this).prop('checked') ) { _this.addRng( [_custcoEsmbrData[$(this).val()]] ); // $(this).prop('checked', false); if(_this.selected == 'single') { $('#' + _this.id).find('[name="tb01"] input[type="checkbox"]').not($(this)).prop('checked', false); } } }); } else { $('#' + _this.id + ' [name="tb01"] tbody').empty().append('내용이 없습니다.'); $('#' + _this.id + ' .paging-area').empty(); } }, function() {}, { showProgress: true }); }; /******************************************************************************/ // 부서별고객사임직원조회 (페이징) /******************************************************************************/ this.searchCustcoEsmbrPage = function(pPageNo, pRowCount, pIsNewSearch, pParam) { var _this = this; var param; if( pIsNewSearch ) param = pParam; else if( !pIsNewSearch && _param ) param = _param; else return; pForm.send_sync('BRS_BT_WR_RetrieveCustcoEsmbrForDept', { baRq:'IN_PSET,_PAGE_NO,_ROWS_PER_PAGE', baRs: 'OUT_PSET', IN_PSET: param, _PAGE_NO: pPageNo, _ROWS_PER_PAGE: pRowCount }, function(data) { var bindTag = ''; _custcoEsmbrData = []; data.OUT_PSET.forEach(function(cur, idx) { bindTag += '' + ' ' + ' ' + cur.CUSTCO_ESMBR_NM + '' + ' ' + cur.CUSTCO_DEPT_NM + '' + ' ' + cur.CUSTCO_OFPS_NM + '' + ' ' + cur.COMP_EML_ADR + '' + ''; _custcoEsmbrData[cur[_this.primarykey]] = cur; }); if(bindTag) { $('#' + _this.id + ' [name="tb01"] tbody').empty().append(bindTag); pConMng.paging('#' + _this.id + ' .paging-area', data.__PAGING_INFO_OUT__[0].__P_TOT_ROW_CNT__, pRowCount, pPageNo, _this.searchCustcoEsmbrPage, _this); _param = param; // 임직원 체크 변경 이벤트 추가 $('#' + _this.id + ' [name="tb01"] tbody tr td input[type="checkbox"]').on('change', function() { if( $(this).prop('checked') ) { _this.addRng( [_custcoEsmbrData[$(this).val()]] ); // $(this).prop('checked', false); if(_this.selected == 'single') { $('#' + _this.id).find('[name="tb01"] input[type="checkbox"]').not($(this)).prop('checked', false); } } }); } else { $('#' + _this.id + ' [name="tb01"] tbody').empty().append('내용이 없습니다.'); $('#' + _this.id + ' .paging-area').empty(); } }, function() {}, { showProgress: true }); }; /******************************************************************************/ // 부서별고객사임직원조회 (전체) /******************************************************************************/ this.searchCustcoEsmbrAll = function(pParam) { var _this = this; pForm.send_sync('BRS_BT_WR_RetrieveCustcoEsmbrForDept', { baRq:'IN_PSET', baRs: 'OUT_PSET', IN_PSET: pParam }, function(data) { _this.addRng(data.OUT_PSET); }, function() {}, { showProgress: true }); }; /******************************************************************************/ // 부서트리구조생성 /******************************************************************************/ this.createDeptTree = function(pCustcoDeptAllData, pCustcoUpDeptData) { var _this = this; var found = pCustcoDeptAllData.filter(function(cur, idx) { cur.idx = idx; return cur.CUSTCO_UP_DEPT_CD == pCustcoUpDeptData.CUSTCO_DEPT_CD; }); if( found.length > 0 ) _deptNodeTag += '
      '; found.forEach(function(cur) { _deptNodeTag += '
    • ' + ' ' + ' ' + (_this.selected == 'single' ? '' : '' ) + ''; pCustcoDeptAllData.splice(cur.idx, 1); _this.createDeptTree(pCustcoDeptAllData, cur); _deptNodeTag += '
    • '; }); if( found.length > 0 ) _deptNodeTag += '
    '; }; /******************************************************************************/ // 범위추가 /******************************************************************************/ this.addRng = function(pCustcoEsmbrs) { var _this = this; if(_this.selected == 'single') _rngData = {}; pCustcoEsmbrs.forEach(function(cur) { if( cur[_this.primarykey] ) _rngData[cur[_this.primarykey]] = cur; }); this.drawRng(); }; /******************************************************************************/ // 범위삭제 /******************************************************************************/ this.delRng = function(pCustcoEsmbrs) { var _this = this; pCustcoEsmbrs.forEach(function(cur, idx) { delete _rngData[cur[_this.primarykey]]; }); this.drawRng(); }; /******************************************************************************/ // 범위반환 /******************************************************************************/ this.getRng = function() { var rtnData = []; for(var rng in _rngData) { rtnData.push( _rngData[rng] ); } return rtnData; }; this.drawRng = function() { var _this = this; var bindTag = ''; var length = 0; for(var rng in _rngData) { bindTag += '' + ' ' + ' ' + _rngData[rng].CUSTCO_ESMBR_NM + '' + ' ' + _rngData[rng].CUSTCO_DEPT_NM + '' + ' ' + _rngData[rng].CUSTCO_OFPS_NM + '' + ' ' + _rngData[rng].COMP_EML_ADR + '' + ''; length++; } if(bindTag) { $('#' + _this.id + ' [name="tb02"] tbody').empty().append(bindTag); } else { $('#' + _this.id + ' [name="tb02"] tbody').empty().append('내용이 없습니다.'); } $('#' + _this.id + ' [name="subTitle"]').empty().text( _this.sub_title + '(' + length + '명)' ); }; this.addEvent = function() { var _this = this; // 부서검색 $('#' + _this.id).find('[name="btnSearchDept"]').on('click', function() { _this.searchDept($('#' + _this.id).find('[name="CUSTCO_DEPT_NM"]').val()); }); $('#' + _this.id).find('[name="CUSTCO_DEPT_NM"]').on('keyup', function(e) { if(e.keyCode == 13) { _this.searchDept($('#' + _this.id).find('[name="CUSTCO_DEPT_NM"]').val()); } }); // 품의서 임직원 조회기능 추가 $('#' + _this.id).find('[name="btnSearchKorFnm"]').on('click', function() { var korFnmVal = $('#' + _this.id).find('[name="CUSTCO_KOR_FNM"]').val(); if(korFnmVal ==''){ alert('임직원 성명을 입력하세요.'); return; } _this.searchFnm(korFnmVal); }); $('#' + _this.id).find('[name="CUSTCO_KOR_FNM"]').on('keyup', function(e) { if(e.keyCode == 13) { var korFnmVal = $('#' + _this.id).find('[name="CUSTCO_KOR_FNM"]').val(); if(korFnmVal ==''){ alert('임직원 성명을 입력하세요.'); return; } _this.searchFnm(korFnmVal); } }); // 확인 $('#' + this.id).find('[name="btnConfirm"]').on('click', function() { _this.fnConfirm( _this.getRng() ); _this.close(); }); // 취소 $('#' + this.id).find('[name="btnCancel"]').on('click' , function() { _this.close(); }); // 이메일추가 $('#' + _this.id).find('button.btn-plus2').on('click', function() { var email = $('#' + _this.id).find('[name="email"]').val(); var domain = $('#' + _this.id).find('[name="domain"]').val(); if( !email || !domain ) return; _this.addRng([{ CUSTCO_ESMBR_NM: '', CUSTCO_DEPT_NM : '', CUSTCO_OFPS_NM : '', COMP_EML_ADR : ( email + '@' + domain ) }]); }); // 전체선택 $('#chk' + this.id + 'tb01').on('change', function() { $('#' + _this.id).find('[name="tb01"] tr td input[type="checkbox"]').prop('checked', $(this).prop('checked')).trigger('change'); }); $('#chk' + this.id + 'tb02').on('change', function() { $('#' + _this.id).find('[name="tb02"] tr td input[type="checkbox"]').prop('checked', $(this).prop('checked')).trigger('change'); }); // 삭제 $('#' + this.id).find('[name="btnDelRng"]').on('click', function() { $('#' + _this.id).find('[name="tb02"] tr td input[type="checkbox"]:checked').each(function() { var obj = {}; obj[_this.primarykey] = $(this).val(); _this.delRng([obj]); }); }); }; var $popupTag = $( this.getPopupTag() ); $('.wrap').append($popupTag); this.addEvent(); } /** * @method InitFlightDetailPopup * 항공상세팝업 * @param {Object} pOptions * @docauthor Redcap Tour * @author hsjeong */ function InitFlightDetailPopup(pOptions) { this.id = pOptions.id; this.title = '예약상세내역'; this.getPopupTag = function() { var _this = this; var popupTag = ''; return popupTag; }; this.open = function(MGR_BKN_NO, SVC_BKN_NO) { var _this = this; var getParam = ''; if( MGR_BKN_NO ) getParam += '&bookingCode=' + MGR_BKN_NO; if( SVC_BKN_NO ) getParam += '&bookingItemCode=' + SVC_BKN_NO; var isAdminParam = "&isAdmin=" + (location.href.indexOf("BT_WR_0200") < 0); $('#' + _this.id).find('.popup-content-inner').empty().append(''); popupLayerOpen('#' + _this.id); }; this.close = function() { popupLayerClose('#' + this.id + ' .popup-close'); }; $('.wrap').append($(this.getPopupTag())); } /** * @method InitHotelDetailPopup * 호텔상세팝업 * @param {Object} pOptions * @docauthor Redcap Tour * @author hsjeong */ function InitHotelDetailPopup(pOptions) { this.id = pOptions.id this.title = '예약상세내역'; this.getPopupTag = function() { var _this = this; var popupTag = ''; return popupTag; }; this.open = function(MGR_BKN_NO, SVC_BKN_NO) { var _this = this; var getParam = ''; if( MGR_BKN_NO ) getParam += '&bookingCode=' + MGR_BKN_NO; if( SVC_BKN_NO ) getParam += '&bookingItemCode=' + SVC_BKN_NO; $('#' + _this.id).find('.popup-content-inner').empty().append(''); popupLayerOpen('#' + _this.id); }; this.close = function() { popupLayerClose('#' + this.id + ' .popup-close'); }; $('.wrap').append($(this.getPopupTag())); } /** * @method InitCarDetailPopup * 렌터카상세팝업 * @param {Object} pOptions * @docauthor Redcap Tour * @author hsjeong */ function InitCarDetailPopup(pOptions) { this.id = pOptions.id; this.title = '예약상세내역'; this.getPopupTag = function() { var _this = this; var popupTag = ''; return popupTag; }; this.open = function(MGR_BKN_NO, SVC_BKN_NO) { var _this = this; var getParam = ''; if( MGR_BKN_NO ) getParam += '&bookingCode=' + MGR_BKN_NO; if( SVC_BKN_NO ) getParam += '&bookingItemCode=' + SVC_BKN_NO; $('#' + _this.id).find('.popup-content-inner').empty().append(''); popupLayerOpen('#' + _this.id); }; this.close = function() { popupLayerClose('#' + this.id + ' .popup-close'); }; $('.wrap').append($(this.getPopupTag())); } /** * @method InitVisaDetailPopup * 비자상세팝업 * @param {Object} pForm * @param {Object} pConMng * @param {object} pOptions * @docauthor Redcap Tour * @author hsjeong */ function InitVisaDetailPopup(pForm, pConMng, pOptions) { this.id = pOptions.id; this.title = '비자상세내역'; this.getPopupTag = function() { var _this = this; var popupTag = ''; return popupTag; }; this.open = function(SVC_BKN_NO) { var _this = this; // _this.bindVisaSts(SVC_BKN_NO); // _this.bindVisaDetail(SVC_BKN_NO); // popupLayerOpen('#' + _this.id); // $('#' + _this.id).find('.popup-content').scrollTop(0); _this.getVisaDetail(SVC_BKN_NO); }; this.close = function() { popupLayerClose('#' + this.id + ' .popup-close'); }; this.getVisaDetail = function(SVC_BKN_NO) { var _this = this; pForm.send('BRS_BT_WR_RetrieveStsTl', { baRs: 'OUT_PSET', IN_PSET: { ETC_PRX_SVC_ITM_CD: 'V', SVC_BKN_NO: SVC_BKN_NO } }, function(data) { if( data && data.OUT_PSET && data.OUT_PSET.length > 0 ) { _this.bindVisaSts(data); pForm.send('BRS_BT_WR_RetrieveVisaBknDtl', { baRs: 'OUT_PSET', IN_PSET: { SVC_BKN_NO: SVC_BKN_NO } }, function(visaBknDtlData) { if( visaBknDtlData && visaBknDtlData.OUT_PSET && visaBknDtlData.OUT_PSET.length > 0 ) { _this.bindVisaDetail(visaBknDtlData); popupLayerOpen('#' + _this.id); $('#' + _this.id).find('.popup-content').scrollTop(0); } }); } }); }; /******************************************************************************/ // 비자상태바인딩 /******************************************************************************/ this.bindVisaSts = function(data) { var _this = this; var bindData = ''; data.OUT_PSET.forEach(function(cur) { bindData += '
  • ' + cur.STS_NM + '
  • '; }); $('#' + _this.id).find('[name="stepArea"] ol').empty().append(bindData); }; /******************************************************************************/ // 비자상세바인딩 /******************************************************************************/ this.bindVisaDetail = function(data) { var _this = this; var bindData = data.OUT_PSET[0]; var bookingDetailArea = ''; var tbConfirm = ''; var tbRequest = ''; var tbRelay = ''; bookingDetailArea = '
    ' + '
    예약번호
    ' + '
    ' + ' ' + bindData.VISA_BKN_STS_NM + '' + ' ' + bindData.SVC_BKN_NO + '' + '
    ' + '
    ' + '
    ' + '
    발급예정일
    ' + '
    ' + bindData.VISA_ISU_SCHD_DT + '
    ' + '
    ' + '
    ' + '
    예약담당자
    ' + '
    ' + ' ' + bindData.PCHR + '' + '

    ' + ' 대사관 사정에 의해 접수, 발급일이 변경될 수 있습니다.
    ' + ' 접수/변경/취소 관련 담당자에게 문의하시기 바랍니다.
    ' + '

    ' + '
    ' + '
    '; if(bindData.DCSN_XN_YN == 'Y') { tbConfirm = '' + ' 신청일' + ' ' + bindData.APLC_DT + '' + ' 발급예정일' + ' ' + bindData.VISA_ISU_SCHD_DT + '' + '' + '' + ' 국가' + ' ' + bindData.NTN_NM + '' + ' 비자유형' + ' ' + bindData.VISA_TY + '' + '' + '' + ' 수속기간' + ' ' + bindData.VISA_PRCD_TERM_NM + '' + ' 결제 예상 금액' + ' ' + btUtil.addComma(bindData.TOT_AMT) + ' KRW' + '' + '' + ' 출장자정보' + ' ' + bindData.CUSTCO_ESMBR_NM + '' + '' + '' + ' 요청자정보' + ' ' + bindData.APLC_CUSTCO_ESMBR_NM + '' + ''; } else { tbConfirm = '확정사항이 없습니다.'; } if(bindData.ORGL_XN_YN == 'Y') { tbRequest = '' + ' 신청일' + ' ' + bindData.ORGL_APLC_DT + '' + // ' 발급예정일' + // ' ' + bindData.ORGL_VISA_ISU_SCHD_DT + '' + '' + '' + ' 국가' + ' ' + bindData.ORGL_NTN_NM + '' + ' 비자유형' + ' ' + bindData.ORGL_VISA_TY + '' + '' + '' + ' 수속기간' + ' ' + bindData.ORGL_VISA_PRCD_TERM_NM + '' + ' 결제 예상 금액' + ' ' + btUtil.addComma(bindData.ORGL_TOT_AMT) + ' KRW' + '' + '' + ' 출장자정보' + ' ' + bindData.ORGL_CUSTCO_ESMBR_NM + '' + '' + '' + ' 요청자정보' + ' ' + bindData.ORGL_APLC_CUSTCO_ESMBR_NM + '' + ''; } else { tbRequest = '요청사항이 없습니다.'; } tbRelay = '' + ' 접수서류전달방식' + ' ' + bindData.ACCPT_PPRS_CNVY_WAY_NM + '' + ' 접수서류발송예정일' + ' ' + bindData.ACCPT_PPRS_SNDN_SCHD_DT + '' + '' + '' + ' 발급서류수령방식' + ' ' + bindData.ISU_PPRS_CNVY_WAY_NM + '' + ' 예상출국일' + ' ' + bindData.EXPC_DPTR_DT + '' + ''; $('#' + _this.id).find('[name="bookingDetailArea"]').empty().append(bookingDetailArea); $('#' + _this.id).find('[name="tbConfirm"] tbody').empty().append(tbConfirm); $('#' + _this.id).find('[name="tbRequest"] tbody').empty().append(tbRequest); $('#' + _this.id).find('[name="tbRelay"] tbody').empty().append(tbRelay); }; var $popupTag = $( this.getPopupTag() ); $('.wrap').append($popupTag); } /** * @method InitRoamDetailPopup * 로밍상세팝업 * @param {Object} pForm * @param {Object} pConMng * @param {object} pOptions * @docauthor Redcap Tour * @author hsjeong */ function InitRoamDetailPopup(pForm, pConMng, pOptions) { this.id = pOptions.id; this.title = '로밍상세내역'; this.getPopupTag = function() { var _this = this; var popupTag = ''; return popupTag; }; this.open = function(SVC_BKN_NO) { var _this = this; // _this.bindRoamSts(SVC_BKN_NO); // _this.bindRoamDetail(SVC_BKN_NO); // _this.bindRoamBknImg(SVC_BKN_NO); // popupLayerOpen('#' + _this.id); // $('#' + _this.id).find('.popup-content').scrollTop(0); _this.getRoamDetail(SVC_BKN_NO); }; this.close = function() { popupLayerClose('#' + this.id + ' .popup-close'); }; this.getRoamDetail = function(SVC_BKN_NO) { var _this = this; pForm.send('BRS_BT_WR_RetrieveStsTl', { baRs: 'OUT_PSET', IN_PSET: { ETC_PRX_SVC_ITM_CD: 'R', SVC_BKN_NO: SVC_BKN_NO } }, function(stsTlData) { if( stsTlData && stsTlData.OUT_PSET && stsTlData.OUT_PSET.length > 0 ) { _this.bindRoamSts(stsTlData); pForm.send('BRS_BT_WR_RetrieveRoamBknImg', { baRs: 'OUT_PSET', IN_PSET: { SVC_BKN_NO: SVC_BKN_NO } }, function(roamBknImgdata) { if( roamBknImgdata && roamBknImgdata.OUT_PSET && roamBknImgdata.OUT_PSET.length > 0 ) { _this.bindRoamBknImg(roamBknImgdata); pForm.send('BRS_BT_WR_RetrieveRoamBknDtl', { baRs: 'OUT_PSET', IN_PSET: { SVC_BKN_NO: SVC_BKN_NO } }, function(roamBknDtldata) { if( roamBknDtldata && roamBknDtldata.OUT_PSET && roamBknDtldata.OUT_PSET.length > 0 ) { _this.bindRoamDetail(roamBknDtldata); popupLayerOpen('#' + _this.id); $('#' + _this.id).find('.popup-content').scrollTop(0); } }); } }); } }); }; /******************************************************************************/ // 로밍상태바인딩 /******************************************************************************/ this.bindRoamSts = function(data) { var _this = this; var bindData = ''; data.OUT_PSET.forEach(function(cur) { bindData += '
  • ' + cur.STS_NM + '
  • '; }); $('#' + _this.id).find('[name="stepArea"] ol').empty().append(bindData); }; /******************************************************************************/ // 로밍상세바인딩 /******************************************************************************/ this.bindRoamDetail = function(data) { var _this = this; var bindData = data.OUT_PSET[0]; var tbConfirm = ''; var bookingDetailArea = ''; var tbRequest = ''; bookingDetailArea = '
    ' + '
    예약번호
    ' + '
    ' + ' ' + bindData.ROAM_BKN_STS_NM + '' + ' ' + bindData.SVC_BKN_NO + '' + '
    ' + '
    ' + '
    ' + '
    신청일
    ' + '
    ' + bindData.APLC_DT + '
    ' + '
    ' + '
    ' + '
    로밍담당자정보
    ' + '
    ' + ' ' + bindData.PCHR + '' + ' ' + '

    ' + ' 접수 취소 변경 관련해서는 담당자에게 문의하시기 바랍니다.' + '

    ' + '
    ' + '
    '; if(bindData.DCSN_XN_YN == 'Y') { tbConfirm = '' + ' 서비스상품' + ' ' + bindData.SVC_ITM + '' + ' 요금' + ' ' + btUtil.addComma(bindData.TOT_AMT) + ' KRW' + '' + '' + ' 출국일자' + ' ' + bindData.DPTR_DT + '' + ' 출국시분' + ' ' + bindData.DPTR_HHMM + '' + '' + '' + ' 출국공항' + ' ' + bindData.DPTR_APO_NM + '' + ' 물품수령지' + ' ' + bindData.RCVNG_APO_PCUP_LOC_NM + '' + '' + '' + ' 입국일' + ' ' + bindData.ENTR_DT + '' + ' 입국시분' + ' ' + bindData.ENTR_HHMM + '' + '' + '' + ' 입국공항' + ' ' + bindData.ENTR_APO_NM + '' + ' 물품반납지' + ' ' + bindData.RTRN_APO_PCUP_LOC_NM + '' + '' + '' + ' 방문국가' + ' ' + bindData.NTN_NM + '' + '' + '' + ' 출장자정보' + ' ' + bindData.CUSTCO_ESMBR_NM + '' + '' + '' + ' 요청자정보' + ' ' + bindData.APLC_CUSTCO_ESMBR_NM + '' + ''; // 개통희망일이 있을 경우 if(bindData.USE_HOPE_BG_DT) { tbConfirm += '' + ' 개통희망일' + ' ' + bindData.USE_HOPE_BG_DT + '' + ''; } } else { tbConfirm = '확정사항이 없습니다.'; } if(bindData.ORGL_XN_YN == 'Y') { tbRequest = '' + ' 예약상태' + ' ' + bindData.ROAM_BKN_STS_NM + '' + ' 요금' + ' ' + bindData.ORGL_TOT_AMT + '' + '' + '' + ' 신청항목' + ' ' + bindData.ORGL_SVC_ITM + '' + '' + '' + ' 출국일자' + ' ' + bindData.ORGL_DPTR_DT + '' + ' 출국시분' + ' ' + bindData.ORGL_DPTR_HHMM + '' + '' + '' + ' 출국공항' + ' ' + bindData.ORGL_DPTR_APO_NM + '' + ' 물품수령지' + ' ' + bindData.ORGL_RCVNG_APO_PCUP_LOC_NM + '' + '' + '' + ' 입국일' + ' ' + bindData.ORGL_ENTR_DT + '' + ' 입국시분' + ' ' + bindData.ORGL_ENTR_HHMM + '' + '' + '' + ' 입국공항' + ' ' + bindData.ORGL_ENTR_APO_NM + '' + ' 물품반납지' + ' ' + bindData.ORGL_RTRN_APO_PCUP_LOC_NM + '' + '' + '' + ' 방문국가' + ' ' + bindData.ORGL_NTN_NM + '' + ''; } else { tbRequest = '요청사항이 없습니다.'; } $('#' + _this.id).find('[name="bookingDetailArea"]').empty().append(bookingDetailArea); $('#' + _this.id).find('[name="tbConfirm"] tbody').empty().append(tbConfirm); $('#' + _this.id).find('[name="tbRequest"] tbody').empty().append(tbRequest); if( bindData.INVC_URL_NM ) { $('#' + _this.id).find('[name="invoice"]').show(); $('#' + _this.id).find('[name="invoice"]').on('click', function() { window.open('http://' + bindData.INVC_URL_NM); }); } else { $('#' + _this.id).find('[name="invoice"]').hide(); } }; /******************************************************************************/ // 로밍예약이미지바인딩 /******************************************************************************/ this.bindRoamBknImg = function(data) { var _this = this; var bindData = data.OUT_PSET[0]; var statusArea = '
  • 접수

    ' + bindData.APLC_DT + '
  • ' + '
  • 수령

    ' + bindData.PRX_RCVNG_DT + '
    수령완료
  • ' + '
  • 출국(출발)

    ' + bindData.DPTR_DT + '
    ' + bindData.DPTR_APO_NM + '
  • ' + '
  • 사용중

    ' + bindData.DPTR_DT + ' ~
    ' + bindData.ENTR_DT + '
    ' + bindData.THNG_NM + '
  • ' + '
  • 입국(도착)

    ' + bindData.ENTR_DT + '
    ' + bindData.ENTR_APO_NM + '
  • '; $('#' + _this.id).find('[name="statusArea"] ol').empty().append(statusArea); }; var $popupTag = $( this.getPopupTag() ); $('.wrap').append($popupTag); } /** * @method InitInsuDetailPopup * 보험상세팝업 * @param {Object} pForm * @param {Object} pConMng * @param {object} pOptions * @docauthor Redcap Tour * @author hsjeong */ function InitInsuDetailPopup(pForm, pConMng, pOptions) { this.id = pOptions.id; this.title = '보험상세내역'; this.getPopupTag = function() { var _this = this; var popupTag = ''; return popupTag; }; this.open = function(SVC_BKN_NO) { var _this = this; _this.getInsuDetail(SVC_BKN_NO); // _this.bindInsuSts(SVC_BKN_NO); // _this.bindInsuDetail(SVC_BKN_NO); // popupLayerOpen('#' + _this.id); // $('#' + _this.id).find('.popup-content').scrollTop(0); }; this.close = function() { popupLayerClose('#' + this.id + ' .popup-close'); }; this.getInsuDetail = function(SVC_BKN_NO) { var _this = this; pForm.send('BRS_BT_WR_RetrieveStsTl', { baRs: 'OUT_PSET', IN_PSET: { ETC_PRX_SVC_ITM_CD: 'I', SVC_BKN_NO: SVC_BKN_NO } }, function(stsTlData) { if( stsTlData && stsTlData.OUT_PSET && stsTlData.OUT_PSET.length > 0 ) { _this.bindInsuSts(stsTlData); pForm.send('BRS_BT_WR_RetrieveInsuBknDtl', { baRs: 'OUT_PSET', IN_PSET: { SVC_BKN_NO: SVC_BKN_NO } }, function(insuBknDtlData) { if( insuBknDtlData && insuBknDtlData.OUT_PSET && insuBknDtlData.OUT_PSET.length > 0 ) { _this.bindInsuDetail(insuBknDtlData); popupLayerOpen('#' + _this.id); $('#' + _this.id).find('.popup-content').scrollTop(0); } }); } }); }; /******************************************************************************/ // 보험상태바인딩 /******************************************************************************/ this.bindInsuSts = function(data) { var _this = this; var bindData = ''; data.OUT_PSET.forEach(function(cur) { bindData += '
  • ' + cur.STS_NM + '
  • '; }); $('#' + _this.id).find('[name="stepArea"] ol').empty().append(bindData); }; /******************************************************************************/ // 보험상세바인딩 /******************************************************************************/ this.bindInsuDetail = function(data) { var _this = this; var bindData = data.OUT_PSET[0]; var bookingDetailArea = ''; var tbConfirm = ''; var tbRequest = ''; bookingDetailArea = '
    ' + '
    예약번호
    ' + '
    ' + ' ' + bindData.INSU_BKN_STS_NM + '' + ' ' + bindData.SVC_BKN_NO + '' + '
    ' + '
    ' + '
    ' + '
    청약일
    ' + '
    ' + bindData.ACCPT_DT + '
    ' + '
    ' + '
    ' + '
    보험담당자정보
    ' + '
    ' + ' ' + bindData.PCHR + '' + ' 증권다운로드' + ' 영수증다운로드' + '

    ' + ' 접수 취소 변경 관련해서는 담당자에게 문의하시기 바랍니다.' + '

    ' + '
    ' + '
    '; if(bindData.DCSN_XN_YN == 'Y') { tbConfirm = '' + ' 신청일' + ' ' + bindData.APLC_DT + '' + ' 청약일' + ' ' + bindData.ACCPT_DT + '' + '' + '' + ' 보험시작일' + ' ' + bindData.INSU_BG_DT + '' + ' 보험종료일' + ' ' + bindData.INSU_END_DT + '' + '' + '' + ' 국가' + ' ' + bindData.NTN_NM + '' + ' 보험금액' + ' ' + btUtil.addComma(bindData.TOT_AMT) + ' KRW' + '' + '' + ' 증권번호' + ' ' + bindData.INSU_COS_NO + '' + '' + '' + ' 출장자정보' + ' ' + bindData.CUSTCO_ESMBR_NM + '' + '' + '' + ' 요청자정보' + ' ' + bindData.APLC_CUSTCO_ESMBR_NM + '' + ''; } else { tbConfirm = '확정사항이 없습니다.'; } if(bindData.ORGL_XN_YN == 'Y') { tbRequest = '' + ' 신청일' + ' ' + bindData.ORGL_APLC_DT + '' + '' + '' + ' 보험시작일' + ' ' + bindData.ORGL_INSU_END_DT + '' + ' 보험종료일' + ' ' + bindData.ORGL_INSU_END_DT + '' + '' + '' + ' 국가' + ' ' + bindData.ORGL_NTN_NM + '' + '' + '' + ' 출장자정보' + ' ' + bindData.ORGL_CUSTCO_ESMBR_NM + '' + '' + '' + ' 요청자정보' + ' ' + bindData.ORGL_APLC_CUSTCO_ESMBR_NM + '' + ''; } else { tbRequest = '요청사항이 없습니다.'; } $('#' + _this.id).find('[name="bookingDetailArea"]').empty().append(bookingDetailArea); $('#' + _this.id).find('[name="tbConfirm"] tbody').empty().append(tbConfirm); $('#' + _this.id).find('[name="tbRequest"] tbody').empty().append(tbRequest); if( bindData.TRVLR_INSU_FILE_ID ) { $('#' + _this.id).find('[name="insuDownload"]').show(); } else { $('#' + _this.id).find('[name="insuDownload"]').hide(); } if( bindData.TRVLR_INSU_RCPT_FILE_ID ) { $('#' + _this.id).find('[name="rcptDownload"]').show(); } else { $('#' + _this.id).find('[name="rcptDownload"]').hide(); } }; var $popupTag = $( this.getPopupTag() ); $('.wrap').append($popupTag); } /** * @method InitRngPopup * 범위보기팝업 * @param {object} pOptions * @docauthor Redcap Tour * @author hsjeong */ function InitRngPopup(pOptions) { this.id = pOptions.id; this.title = pOptions.title; this.getPopupTag = function() { var _this = this; var popupTag = ''; return popupTag; }; this.open = function(data) { var _this = this; _this.init(); _this.bindRng(data); popupLayerOpen('#' + _this.id); }; this.close = function() { popupLayerClose('#' + this.id + ' .popup-close'); }; this.bindRng = function(data) { var _this = this; var bindTag = ''; data.forEach(function(cur) { bindTag += '' + ' ' + cur.CUSTCO_DEPT_NM + '' + ' ' + cur.CUSTCO_OFPS_NM + '' + ' ' + cur.CUSTCO_ESMBR_NM + '' + ''; }); $('#' + _this.id).find('[name="tbRng"]>tbody').empty().append(bindTag); }; this.setTitle = function(title) { var _this = this; _this.title = title; $('#' + _this.id).find('[name="title"]').empty().append(_this.title); }; this.init = function() { var _this = this; $('.wrap #' + _this.id).remove(); $('.wrap').append(_this.getPopupTag()); }; this.init(); } /** * @method InitCnsPopup * 품의상세팝업 * @param {object} pOptions * @docauthor Redcap Tour * @author hsjeong */ function InitCnsPopup(pOptions) { this.id = pOptions.id; this.param; this.rngPopup; this.cnsData = { AUTH : '03', /* 01: 기안자, 02: 결재자, 03: 출장자,열람자 */ CNS_NO : '', /* 품의번호 */ //MRG_BKN_NO : '', /* 통합예약번호 */ MRG_BKN_NO_LIST : [], /* 통합예약번호 */ // 1:N 관계로 변경됨 DRAF_DTM : '', /* 기안일 */ DRAF_CUSTCO_ESMBR_NO: '', /* 기안자임직원번호 */ DRAF_CUSTCO_ESMBR_NM: '', /* 기안자임직원명 */ DRAF_CUSTCO_DEPT_NM : '', /* 기안자부서명 */ BZT_TY_CD : '', /* 출장유형코드(국내,해외) */ BZT_TY_NM : '', /* 출장유형명 */ BZT_TL_NM : '', /* 제목 */ BT_CNS_STS_CD : '0', /* 품의상태 */ PSNCT_LIST : [], /* 결재자목록 */ BZT_CNS_BTRVR_LIST : [], /* 출장자목록 */ BZT_CNS_CNVY_LIST : [], /* 전달목록 */ BZT_CNS_INQ_LIST : [], /* 열람목록 */ BZT_CNS_JRNY_LIST : [], /* 여정목록 */ BZT_CNS_AMT_LIST : [], /* 비용목록 */ LOGIN_CNS_SNCT_TY_CD: '', /* 로그인한 사용자의 결재 형식(CNS_SNCT_TY_CD:10(결재), 20(합의)) */ ATCH_FILE_GRP_ID : '' /* 첨부파일그룹ID */ }; this.callback; this.getPopupTag = function() { var _this = this; var popupTag = '' + ''; return popupTag; }; this.open = function(param, callback) { var _this = this; _this.init(); _this.param = param; _this.callback = callback; _this.searchCns(); }; this.close = function() { var _this = this; if(_this.callback) { var pageNo = $('.paging-area .paging span a.on').text(); _this.callback(pageNo * 1, 5, false); } popupLayerClose('#' + this.id + ' .popup-close'); }; this.searchCns = function() { var _this = this; btUtil.send('BRS_BT_WEB_RetrieveCnsAll', { baRq: 'IN_PSET', baRs: 'OUT_PSET1,OUT_PSET2,OUT_PSET3,OUT_PSET4,OUT_PSET5,OUT_PSET6,OUT_PSET7', IN_PSET: _this.param }, function(data) { //데이터 확인 //alert(data.OUT_PSET2[0].LOGIN_CNS_SNCT_TY_CD); // 출장자/열람권한(03) _this.cnsData.AUTH = '03'; // 기안자권한(01) if( data.OUT_PSET2[0].DRAF_CUSTCO_ESMBR_NO == USER_SESSION.CUSTCO_ESMBR_NO ) { _this.cnsData.AUTH = '01'; } //로그인한 사용자의 결재 형식(10:결재, 20:합의) if(data.OUT_PSET2[0].LOGIN_CNS_SNCT_TY_CD != ''){ trace('[alert] LOGIN_CNS_SNCT_TY_CD 셋팅 완료 = '+data.OUT_PSET2[0].LOGIN_CNS_SNCT_TY_CD); _this.cnsData.LOGIN_CNS_SNCT_TY_CD = data.OUT_PSET2[0].LOGIN_CNS_SNCT_TY_CD; } // 결재자 _this.cnsData.PSNCT_LIST = data.OUT_PSET1.map(function(cur) { // 결재자권한(02) if(cur.CHG_YN =='Y' && cur.SNCT_CUSTCO_ESMBR_NO == USER_SESSION.CUSTCO_ESMBR_NO) { _this.cnsData.AUTH = '02'; _this.cnsData.SNCT_CUSTCO_ESMBR_NO = cur.SNCT_CUSTCO_ESMBR_NO; _this.cnsData.CNS_SNCT_TOR = cur.CNS_SNCT_TOR; } return cur; }); // 여정 _this.cnsData.BZT_CNS_JRNY_LIST = data.OUT_PSET3; // 열람범위 _this.cnsData.BZT_CNS_INQ_LIST = data.OUT_PSET4.map(function(cur) { cur.COMP_EML_ADR = cur.EML_ADR; return cur; }); // 전달범위 _this.cnsData.BZT_CNS_CNVY_LIST = data.OUT_PSET5.map(function(cur) { cur.COMP_EML_ADR = cur.EML_ADR; return cur; }); // 출장자 _this.cnsData.BZT_CNS_BTRVR_LIST = data.OUT_PSET6.map(function(cur) { cur.COMP_EML_ADR = cur.EML_ADR; return cur; }); // 금액 _this.cnsData.BZT_CNS_AMT_LIST = data.OUT_PSET7; for(var key in data.OUT_PSET2[0]) { _this.cnsData[key] = data.OUT_PSET2[0][key]; } // 통합예약번호 if (data.OUT_PSET2[0].MRG_BKN_NO_LIST) { _this.cnsData.MRG_BKN_NO_LIST = data.OUT_PSET2[0].MRG_BKN_NO_LIST.split(","); } _this.bindCns(); }, function() {}, { showProgress: true }); }; /******************************************************************************/ // 품의서바인딩 /******************************************************************************/ this.bindCns = function() { var _this = this; // 품의번호 $('#' + _this.id).find('[name="CNS_NO"]').empty().append(_this.cnsData.CNS_NO); // 기안일 $('#' + _this.id).find('[name="DRAF_DTM"]').empty().append(_this.cnsData.DRAF_DTM); // 결재자 $('#' + _this.id).find('[name="PSNCT_NM"]').empty().append(_this.getSnctText()); // 기안자 $('#' + _this.id).find('[name="DRAF_CUSTCO_ESMBR_NM"]').empty().append(_this.cnsData.DRAF_CUSTCO_ESMBR_NM); // 기안부서 $('#' + _this.id).find('[name="DRAF_CUSTCO_DEPT_NM"]').empty().append(_this.cnsData.DRAF_CUSTCO_DEPT_NM); // 출장자 $('#' + _this.id).find('[name="BZT_CNS_BTRVR"]').empty().append(_this.getRngText(_this.cnsData.BZT_CNS_BTRVR_LIST)); // 전달범위 $('#' + _this.id).find('[name="BZT_CNS_CNVY"]').empty().append(_this.getRngText(_this.cnsData.BZT_CNS_CNVY_LIST)); // 열람범위 $('#' + _this.id).find('[name="BZT_CNS_INQ"]').empty().append(_this.getRngText(_this.cnsData.BZT_CNS_INQ_LIST)); // 출장유형 $('#' + _this.id).find('[name="BZT_TY_NM"]').empty().append(_this.cnsData.BZT_TY_NM); // 제목 $('#' + _this.id).find('[name="BZT_TL_NM"]').empty().append(_this.cnsData.BZT_TL_NM); // 품의상태 $('#' + _this.id).find('[name="BT_CNS_STS_NM"]').empty().append(_this.cnsData.BT_CNS_STS_NM); // 출장목적 $('#' + _this.id).find('[name="BTMS_CUSTCO_BZT_PURP_NM"]').empty().append(_this.cnsData.BTMS_CUSTCO_BZT_PURP_NM); // 내용 $('#' + _this.id).find('[name="BZT_CTS"]').empty().append(_this.cnsData.BZT_CTS); // 여정 _this.bindJrny( _this.cnsData.BZT_CNS_JRNY_LIST ); // Remark $('#' + _this.id).find('[name="RMK"]').empty().append(_this.cnsData.RMK); // 비용 _this.bindCost(_this.cnsData.BZT_CNS_AMT_LIST); // 품의형태 // 비용목록 switch (USER_SESSION.BZT_CNS_TY_CD) { case 'CNSA': $('#' + _this.id).find('[name="tbBztExp"]').show(); break; case 'CNSB': case 'CNSC': if(_this.cnsData.MRG_BKN_NO_LIST.length > 0) $('#' + _this.id).find('[name="tbBztExp"]').show(); break; } // 품의목적 if(USER_SESSION.BZT_PURP_USE_YN == 'Y') $('#' + _this.id).find('[name="BZT_PURP_USE_YN"]').show(); else $('#' + _this.id).find('[name="BZT_PURP_USE_YN"]').hide(); // 품의상태 // 품의상태 20(품의상신), 기안자 취소 // 품의상태 20(품의상신), 결재자 결재, 반려 // 품의상태 20(품의상신), 출장/열람자 // 품의상태 30(품의취소), 기안자 // 품의상태 30(품의취소), 결재자 // 품의상태 30(품의취소), 출장/열람자 // 품의상태 40(품의진행), 기안자 // 품의상태 40(품의진행), 결재자 결재, 반려 // 품의상태 40(품의진행), 출장/열람자 // 품의상태 50(품의완료), 기안자 // 품의상태 50(품의완료), 결재자 // 품의상태 50(품의완료), 출장/열람자 // 품의상태 60(품의반려), 기안자 // 품의상태 60(품의반려), 결재자 // 품의상태 60(품의반려), 출장/열람자 if(_this.cnsData.BT_CNS_STS_CD == '20' && _this.cnsData.AUTH == '01') { $('#' + _this.id).find('[name="btnCncl"]').show(); } else { $('#' + _this.id).find('[name="btnCncl"]').hide(); } // 결재자의견바인딩 var bindPsnctTag = ''; _this.cnsData.PSNCT_LIST.forEach(function(cur) { // 결재자의견이 존재할 경우 if( cur.SNCT_OPIN_CTS ) { bindPsnctTag += '
  • ' + '
    ' + '

    ' + cur.SNCT_CUSTCO_ESMBR_NM + ' :

    ' + '

    ' + cur.SNCT_OPIN_CTS + '

    ' + '
    ' + '
  • '; } }); if(bindPsnctTag) { $('#' + _this.id).find('[name="snctOpinCtsArea"] ul').empty().append(bindPsnctTag); } // (_this.cnsData.BT_CNS_STS_CD == '20' || _this.cnsData.BT_CNS_STS_CD == '40') && if(_this.cnsData.AUTH == '02') { if(_this.cnsData.LOGIN_CNS_SNCT_TY_CD == '20') { trace('[alert] LOGIN_CNS_SNCT_TY_CD == 20'); $('#' + _this.id).find('[name="btnAgree"]').show(); // 합의 show $('#' + _this.id).find('[name="btnSnct"]').hide(); // 결재 hide }else{ trace('[alert] LOGIN_CNS_SNCT_TY_CD != 20'); $('#' + _this.id).find('[name="btnSnct"]').show(); // 결재 show $('#' + _this.id).find('[name="btnAgree"]').hide(); // 합의 hide } $('#' + _this.id).find('[name="btnGvbk"]').show(); // 반려 $('#' + _this.id).find('[name="SNCT_OPIN_CTS"]').closest('.input').show(); // 결재자의견 } // else if( _this.cnsData.BT_CNS_STS_CD == '50' || _this.cnsData.BT_CNS_STS_CD == '60' ) { // $('#' + _this.id).find('[name="btnSnct"]').hide(); // $('#' + _this.id).find('[name="btnGvbk"]').hide(); // $('#' + _this.id).find('[name="SNCT_OPIN_CTS"]').val(_this.cnsData.SNCT_OPIN_CTS).prop('disabled', true).closest('tr').show(); // } else { $('#' + _this.id).find('[name="btnSnct"]').hide(); $('#' + _this.id).find('[name="btnAgree"]').hide(); $('#' + _this.id).find('[name="btnGvbk"]').hide(); $('#' + _this.id).find('[name="SNCT_OPIN_CTS"]').closest('.input').hide(); } if( bindPsnctTag || _this.cnsData.AUTH == '02' ) { $('#' + _this.id).find('[name="snctOpinCtsArea"]').show(); } else { $('#' + _this.id).find('[name="snctOpinCtsArea"]').hide(); } // 출장자 $('#' + _this.id).find('[name="BZT_CNS_BTRVR"] a').on('click', function() { _this.rngPopup.setTitle('출장자'); _this.rngPopup.open(_this.cnsData.BZT_CNS_BTRVR_LIST); }); // 전달범위 $('#' + _this.id).find('[name="BZT_CNS_CNVY"] a').on('click', function() { _this.rngPopup.setTitle('전달범위'); _this.rngPopup.open(_this.cnsData.BZT_CNS_CNVY_LIST); }); // 열람범위 $('#' + _this.id).find('[name="BZT_CNS_INQ"] a').on('click', function() { _this.rngPopup.setTitle('열람범위'); _this.rngPopup.open(_this.cnsData.BZT_CNS_INQ_LIST); }); // 첨부파일 if (_this.cnsData.ATCH_FILE_GRP_ID) { _this.getFileList(_this.cnsData.ATCH_FILE_GRP_ID, function(data) { var $bindTag = $('
    ' + '
    ' + '
      ' + '
    ' + '
    ' + '
    '); data.forEach(function(cur) { var ext; if (cur.EXT_NM) { ext = cur.EXT_NM.toLowerCase(); } else { var tmpFiles = cur.CLIENT_FILENAME.split('.'); ext = tmpFiles[ tmpFiles.length - 1 ]; } $bindTag.find('ul').append('
  • ' + '' + '' + cur.CLIENT_FILENAME + '' + '
  • '); }); $('[name="ATCH_FILE"]').append($bindTag); }); } popupLayerOpen('#' + _this.id); } this.getFileList = function(pGroupId, pCallback) { btUtil.send('BRS_RTIS_CMM_RetrieveFileList', { baRs: 'OUT_PSET', IN_PSET: { FILE_GROUP_ID: pGroupId } }, function(data) { if(pCallback) pCallback(data.OUT_PSET); }, function() {}, { showProgress: true }); } /******************************************************************************/ // 결재자목록명반환 /******************************************************************************/ this.getSnctText = function() { var _this = this; return _this.cnsData.PSNCT_LIST.sort(function(a, b) { return (a.CNS_SNCT_TOR * 1 - b.CNS_SNCT_TOR * 1) }).map(function(cur) { return ( cur.SNCT_CUSTCO_ESMBR_NM + '(' + cur.CNS_SNCT_TY_NM + ')' ); }).join(','); } /******************************************************************************/ // 범위명반환 /******************************************************************************/ this.getRngText = function(pData) { var rtnText = ''; if(pData.length > 0) { var tmpText = ''; pData.every(function(cur, idx) { if(cur.CUSTCO_ESMBR_NM) { tmpText = cur.CUSTCO_ESMBR_NM + ( pData.length - 1 > 0 ? '외 ' + (pData.length - 1) + '명' : '' ); return false; } }); if(pData.length == 1) rtnText = tmpText; else rtnText = '' + tmpText + ''; } else rtnText = '-'; return rtnText; } /******************************************************************************/ // 여정바인딩 /******************************************************************************/ this.bindJrny = function(pData) { var _this = this; var bindTag = ''; pData.forEach(function(cur) { bindTag += '' + ' 출장일정' + ' ' + cur.BZT_BG_DT + ' ~ ' + cur.BZT_END_DT + '' + ' 출장도시' + ' ' + cur.BZT_CTY_NM + '' + ''; }); $('#' + _this.id).find('[name="tbJrny"]>tbody').empty().append(bindTag); }; /******************************************************************************/ // 비용바인딩 /******************************************************************************/ this.bindCost = function(data) { var _this = this; var bindTag = ''; var totalCosts = {}; data.forEach(function(cur) { var txtColorStr = 'style="color: #c70000;"'; // 출장규정위반일경우 붉은색 표시 bindTag += '
  • ' + '
    ' + '

    ' + cur.CNS_ITM_NM + '

    ' + '

    ' + cur.CRNCY_CD + ' ' + btUtil.addComma(cur.APRPT_CST_AMT) + '

    ' + '

    ' + cur.RMK + '

    ' + '

    ' + (!cur.SVC_BKN_NO ? '-' : (cur.CNS_ITM_CD != '10' && cur.CNS_ITM_CD != '20') ? '-' : cur.BZT_REGU_VIOL_RSN_CTS ? '규정위반' : '규정적합') + '

    ' + '
    ' + '
  • '; totalCosts[cur.CRNCY_CD] = (totalCosts[cur.CRNCY_CD] ? totalCosts[cur.CRNCY_CD] * 1 : 0) + (cur.APRPT_CST_AMT * 1); }); $('#' + _this.id).find('[name="tbBztExp"] ul').empty().append(bindTag); // 총비용 _this.bindTotalCost(totalCosts); if(data.length > 0) $('#' + _this.id).find('[name="tbBztExp"]').show(); else $('#' + _this.id).find('[name="tbBztExp"]').hide(); }; /******************************************************************************/ // 총비용바인딩 /******************************************************************************/ this.bindTotalCost = function(pTotalCosts) { var _this = this; var bindTag = ''; for( key in pTotalCosts) { bindTag += key + ' ' + btUtil.addComma(pTotalCosts[key]) + '
    '; } $('#' + _this.id).find('[name="tbBztExp"] .total').empty().append( bindTag ); }; /******************************************************************************/ // 초기화 /******************************************************************************/ this.init = function() { var _this = this; $('.wrap #' + _this.id).remove(); $('.wrap #ozPopup').remove(); $('.wrap').append(_this.getPopupTag()); _this.rngPopup = new InitRngPopup({ id: 'rngPopup', title: '전달범위' }); _this.addEvent(); }; /******************************************************************************/ // 품의취소 /******************************************************************************/ this.updateBztCns = function(pCnsStsCd) { var _this = this; var param = { CNS_NO : _this.cnsData.CNS_NO, //MRG_BKN_NO : _this.cnsData.MRG_BKN_NO, DRAF_CUSTCO_ESMBR_NO : _this.cnsData.DRAF_CUSTCO_ESMBR_NO, BZT_TY_CD : _this.cnsData.BZT_TY_CD, BZT_TL_NM : _this.cnsData.BZT_TL_NM, BTMS_CUSTCO_BZT_PURP_CD: _this.cnsData.BTMS_CUSTCO_BZT_PURP_CD, BZT_CTS : _this.cnsData.BZT_CTS, BZT_PRSN_NUM : _this.cnsData.BZT_PRSN_NUM, RMK : _this.cnsData.RMK, BT_CNS_STS_CD : pCnsStsCd, ATCH_FILE_GRP_ID : _this.cnsData.ATCH_FILE_GRP_ID }; btUtil.send('BRS_BT_WEB_SaveBztAprpt', { baRq: 'IN_PSET,IN_REPORT_INFO,BR_NAME', baRs: 'CM_EML_SNDN,CM_EML_SNDN_TGT', IN_PSET: param, IN_REPORT_INFO: {}, BR_NAME: {} }, function(data) { Message.alert('취소되었습니다.'); _this.close(); // _this.searchCns(); }, function() {}, { showProgress: true }); }; /******************************************************************************/ // 품의결재/반려 /******************************************************************************/ this.updateBztCnsSnct = function(pCnsStsCd) { var _this = this; trace('[alert] _this.cnsData.LOGIN_CNS_SNCT_TY_CD = '+ _this.cnsData.LOGIN_CNS_SNCT_TY_CD); var SNCT_OPIN_CTS = $('#' + _this.id).find('[name="SNCT_OPIN_CTS"]').val(); // 결재의견내용 // 품의반려이고 품의반려사유사용여부가 Y일 경우 "결재의견내용"을 입력했는지 체크 if( pCnsStsCd == '30' && USER_SESSION.CNS_GVBK_RSN_USE_YN == 'Y' ) { if( !SNCT_OPIN_CTS ) { Message.alert('결재자의견내용을(를) 입력하세요.'); $('#' + _this.id).find('[name="SNCT_OPIN_CTS"]').addClass('error'); $('#' + _this.id).find('[name="SNCT_OPIN_CTS"]').focus(); return; } else { $('#' + _this.id).find('[name="SNCT_OPIN_CTS"]').removeClass('error'); } } var param1 = { CNS_NO : _this.cnsData.CNS_NO, SNCT_CUSTCO_ESMBR_NO: _this.cnsData.SNCT_CUSTCO_ESMBR_NO, CNS_SNCT_TOR : _this.cnsData.CNS_SNCT_TOR, CNS_SNCT_STS_CD : pCnsStsCd, SNCT_OPIN_CTS : SNCT_OPIN_CTS, }; var param2 = { FILE_GROUP_ID: null, REPORT_FILE : 'RTIS_BT_WR/BT_WR_0100.ozr', PDF_FILE_NAME: '출장품의서', BR_NAME : 'BRS_BT_WEB_RetrieveCnsAll', }; var sessionData = USER_SESSION; delete sessionData["USER_ROLE_LIST"]; var param3 = { PARAM_JSON: JSON.stringify({ baRq : 'IN_PSET,RSESSION', baRs : 'OUT_PSET1,OUT_PSET2,OUT_PSET3,OUT_PSET4,OUT_PSET5,OUT_PSET6,OUT_PSET7', IN_PSET : { CNS_NO: _this.cnsData.CNS_NO, CUSTCO_ESMBR_NO: USER_SESSION.CUSTCO_ESMBR_NO }, RSESSION: sessionData }) }; btUtil.send('BRS_BT_WEB_UpdateBztCnsSnct', { baRq: 'IN_PSET,IN_REPORT_INFO,BR_NAME', baRs: 'CM_EML_SNDN,CM_EML_SNDN_TGT,CM_HP_MSG_SNDN,CM_HP_MSG_SNDN_TGT', IN_PSET: param1, IN_REPORT_INFO: param2, BR_NAME: param3 }, function(data) { switch(pCnsStsCd) { case '20': trace('[alert] loginCnsSnctTyCd = '+_this.cnsData.LOGIN_CNS_SNCT_TY_CD); //결재, 합의 메세지 구분 var loginCnsSnctTyCd = _this.cnsData.LOGIN_CNS_SNCT_TY_CD; if(loginCnsSnctTyCd!='' && loginCnsSnctTyCd=='20'){ Message.alert('합의되었습니다.'); }else{ Message.alert('결재되었습니다.'); } break; case '30': Message.alert('반려되었습니다.'); break; } _this.close(); //_this.searchCns(); var pageNo = $('.paging-area .paging span a.on').text(); //trace 오류 발생하여 주석처리함 //searchCnsList(pageNo * 1, 5, false); }, function() {}, { showProgress: true }); }; /******************************************************************************/ // 이벤트적용 /******************************************************************************/ this.addEvent = function() { var _this = this; // 품의취소 버튼 이벤트 $('#' + _this.id).find('[name="btnCncl"]').on('click', function() { _this.updateBztCns('30'); }); // 품의결재 버튼 이벤트 $('#' + _this.id).find('[name="btnSnct"]').on('click', function() { //_this.updateBztCnsSnct('20'); if(confirm('결재하시겠습니까?')){ _this.updateBztCnsSnct('20'); } }); // 품의합의 버튼 이벤트 $('#' + _this.id).find('[name="btnAgree"]').on('click', function() { //_this.updateBztCnsSnct('20'); if(confirm('합의하시겠습니까?')){ _this.updateBztCnsSnct('20'); } }); // 품의반려 버튼 이벤트 $('#' + _this.id).find('[name="btnGvbk"]').on('click', function() { //_this.updateBztCnsSnct('30'); if(confirm('반려하시겠습니까?')){ _this.updateBztCnsSnct('30'); } }); // 인쇄하기, 다운로드 $('#' + _this.id).find('[name="btnPrint"],[name="btnDownload"]').on('click', function() { var report = new ReportManager(); report.exportPdf({ report : 'RTIS_BT_WR/BT_WR_0100.ozr', action : "BRS_BT_WEB_RetrieveCnsAll", param : { baRs : 'OUT_PSET1,OUT_PSET2,OUT_PSET3,OUT_PSET4,OUT_PSET5,OUT_PSET6,OUT_PSET7', IN_PSET: _this.param }, callback : function( data ) { $('#ozPopup').find('.popup-content-inner').empty().append(''); popupLayerOpen('#ozPopup'); } }); }); }; this.init(); } /** * @method InitSchPopup * 스케줄관리팝업 * @param {object} pOptions * @docauthor Redcap Tour * @author hsjeong */ function InitSchPopup(pOptions) { this.id = pOptions.id; this.conMng; this.callback; this.getPopupTag = function() { var _this = this; var popupTag = ''; return popupTag; }; this.open = function(param, callback) { var _this = this; if(!param.MRG_BKN_NO) return; _this.conMng.clear('schArea'); $('#' + _this.id).find('[name="MRG_BKN_NO"]').val(param.MRG_BKN_NO); if(param.SEQ) { $('#' + _this.id).find('[name="SEQ"]').val(param.SEQ); _this.bindSchDetail(); } else { $('#' + _this.id).find('[name="btnDel"]').hide(); } _this.callback = callback; popupLayerOpen('#' + _this.id); }; this.close = function() { popupLayerClose('#' + this.id + ' .popup-close'); if(this.callback) this.callback(); }; /******************************************************************************/ // 스케줄상세바인딩 /******************************************************************************/ this.bindSchDetail = function() { var _this = this; var param = _this.conMng.getDatas('schArea'); btUtil.send('BRS_BT_WC_RetrieveBztSchDtl', { baRq:'IN_PSET', baRs: 'OUT_PSET', IN_PSET: param }, function(data) { if( data.OUT_PSET.length > 0 ) { _this.conMng.setDatas('schArea', data.OUT_PSET[0]); $('#' + _this.id).find('[name="btnDel"]').show(); } }, function() { }, { showProgress: true }); }; /******************************************************************************/ // 스케줄저장/수정 /******************************************************************************/ this.mergeSch = function() { var _this = this; var param = _this.conMng.getDatas('schArea'); btUtil.send('BRS_BT_WC_MergeBztSch', { baRq:'IN_PSET', IN_PSET: param }, function(data) { Message.alert('저장되었습니다.'); _this.close(); }, function() { }, { showProgress: true }); }; /******************************************************************************/ // 스케줄삭제 /******************************************************************************/ this.deleteSch = function() { var _this = this; var param = _this.conMng.getDatas('schArea'); btUtil.send('BRS_BT_WC_DeleteBztSch', { baRq:'IN_PSET', IN_PSET: param }, function(data) { Message.alert('삭제되었습니다.'); _this.close(); }, function() {}, { showProgress: true }); }; /******************************************************************************/ // 초기화 /******************************************************************************/ this.init = function() { var _this = this; $('.wrap').append(_this.getPopupTag()); _this.conMng = new ControlManage2(); _this.conMng.initCombo('schArea', 'BZT_SCH_CATE_CD', 'BRS_BT_WEB_RetrieveCmCodeList', { baRs: 'OUT_PSET', IN_PSET: { GRP_CD: 'BZT_SCH_CATE_CD' } }, { code : 'CD', value : 'CD_NM' }, [ { CD: '', CD_NM: '선택' } ] ); _this.conMng.picker({ areaName : 'schArea', controlFromName: 'BG_DT', controlToName : 'END_DT' }); _this.addEvent(); }; /******************************************************************************/ // 이벤트적용 /******************************************************************************/ this.addEvent = function() { var _this = this; // 저장 $('#' + _this.id).find('[name="btnSave"]').on('click', function() { _this.mergeSch(); }); // 삭제 $('#' + _this.id).find('[name="btnDel"]').on('click', function() { _this.deleteSch(); }); }; this.init(); } /** * @method initAddrPopup * 우편번호찾기(웹) 팝업 생성 * @docauthor Redcap Tour * @author 윤정혁 * this.show(return callback [TARGET]) */ var initAddrPopup = function(pForm, pSession, pCallback) { var popupId = btUtil.getRandomId() + 'popup'; var _param; var tmpSession; var callbackTarget; /*리턴받을 result Target (returnData) */ if(typeof USER_SESSION !== 'undefined') { tmpSession = USER_SESSION; } else { tmpSession = pSession; } $('.wrap-inner').append(createHtml(popupId)); var _con = new ControlManage(pForm); _con.initCombo('[id=' + popupId + '] [data-area="frmSrchAdr"] [name="SIDO_AREA_CD"]', 'BRS_BT_WEB_RetrieveCmCodeListNonSession', { baRs: 'OUT_RSET', IN_PSET: { GRP_CD: 'SIDO_AREA_CD', COMP_CD: tmpSession.COMP_CD, LANG_CD: tmpSession.LANG_CD } }, { code: 'CD', value: 'CD_NM' }, [{ CD: '', CD_NM: '전체' }], false); _con.initCombo('[id=' + popupId + '] [data-area="frmSrchAdr"] [name="SGG_AREA_CD"]' , 'BRS_BT_WEB_RetrieveCmCodeListNonSession', { baRs: 'OUT_RSET', IN_PSET: { GRP_CD: 'SGG_AREA_CD' , COMP_CD: tmpSession.COMP_CD, LANG_CD: tmpSession.LANG_CD } }, { code: 'CD', value: 'CD_NM' }, [{ CD: '', CD_NM: '전체' }], false); $('[id=' + popupId + '] [data-area="frmSrchAdr"] [name="SIDO_AREA_CD"]').on('combo-change', function() { var sido = _con.getData('[id=' + popupId + '] [data-area="frmSrchAdr"] [name="SIDO_AREA_CD"]'); _con.initCombo('[id=' + popupId + '] [data-area="frmSrchAdr"] [name="SGG_AREA_CD"]', 'BRS_BT_WEB_RetrieveCmCodeListNonSession', { baRs: 'OUT_RSET', IN_PSET: { GRP_CD: 'SGG_AREA_CD', PRNT_CD : sido, COMP_CD : tmpSession.COMP_CD, LANG_CD : tmpSession.LANG_CD } }, { code : 'CD', value : 'CD_NM' }, [{ CD:'', CD_NM:'전체' }],false); }); /* 주소 검색 팝업 */ $('[id=' + popupId + '] #btnSrchAddr').on('click', function() { var cond = _con.getDatas('[id=' + popupId + '] [data-area="frmSrchAdr"]'); if(cond.ROD_NM == '') { Message.alert('검색어를 입력하세요.'); return false; } var sidoNm = $('[id=' + popupId + '] [data-area="frmSrchAdr"] [name="SIDO_AREA_CD"]').val(); var sggNm = $('[id=' + popupId + '] [data-area="frmSrchAdr"] [name="SGG_AREA_CD"]').val(); var keyword = ""; if(cond.SIDO_AREA_CD) keyword += $.trim(sidoNm); if(cond.SGG_AREA_CD){ if( $.trim(keyword) == '' ) keyword+= $.trim(sggNm); else keyword += " " + $.trim(sggNm); } if( $.trim(keyword) == '' ) keyword += $.trim(cond.ROD_NM); else keyword += " " + $.trim(cond.ROD_NM); cond.keyword = keyword; fnRetrieveAddressList(1, 100, cond); }); /*주소 검색 팝업 Hide*/ $('[id=' + popupId + '] #closeAddrPop').on('click', function() { popupLayerClose(this); }); /* 주소 선택 이벤트 */ $(document).on('click',"[id=" + popupId + "] #grdAddrList tbody li", function() { var _this = this; var result = []; result.ZIP_CD = $(_this).closest('td').siblings('td').text(); result.ADR = $(_this).find('span').text(); result.TARGET = callbackTarget; if(pCallback) { pCallback(result); } popupLayerClose('[id=' + popupId + '] #closeAddrPop'); }); /* 주소검색팝업 Show */ this.show = function(target){ clearPop(); callbackTarget = target; popupLayerOpen('#' + popupId); } function clearPop() { _con.setData('[id=' + popupId + '] [data-area="frmSrchAdr"] [name="SIDO_AREA_CD"]', ''); _con.setData('[id=' + popupId + '] [data-area="frmSrchAdr"] [name="SGG_AREA_CD"]', ''); _con.setData('[id=' + popupId + '] [data-area="frmSrchAdr"] [name="ROD_NM"]', ''); $('[id='+popupId+'] #grdAddrList tbody').empty(); $('[id='+popupId+'] .paging-area').empty(); } /* 우편번호 리스트 검색 */ function fnRetrieveAddressList(pPageNo, pRowCount, condition) { var cond = condition; if(cond) { } else if(!cond && _param) { cond = _param; } else { return; } cond.rowCount = pRowCount; /*조회 수*/ if(pPageNo == 1) { cond.startRow = 0; /*start row index*/ } else { cond.startRow = ((pPageNo-1) * pRowCount) + 1 // ex) 3page 일 경우 (2 * 100)+1 = 201 startRow } var bindData = ''; pForm.send( 'ExternalInterLink.retrieveAddressList', cond, function(data) { if(data.result.list) { data.result.list.forEach(function(item, idx){ bindData += ''; bindData += ' '; bindData += '
      '; bindData += ' '; bindData += ' '; bindData += ' ' + item.zipNo + ''; bindData += ''; }); } if(bindData) { $('[id=' + popupId + '] #grdAddrList tbody').empty().append(bindData); _con.paging('[id=' + popupId + '] .paging-area', data.result.total, pRowCount, pPageNo, fnRetrieveAddressList); _param = cond; } else { $('[id=' + popupId + '] #grdAddrList tbody').empty().append('검색된 주소가 없습니다.'); $('[id=' + popupId + '] .paging-area').empty(); } }, function() {}, { showProgress: true }); } /* 주소검색팝업 태그 */ function createHtml(rndId) { var rtnTxt = ''; rtnTxt += ''; return rtnTxt; } }; /** * @method initAddrPopupMobile * 우편번호찾기(모바일) 팝업 생성 * @docauthor Redcap Tour * @author 양석진 * this.show(return callback [TARGET]) */ var initAddrPopupMobile = function(pForm, pSession, pCallback) { var popupId = btUtil.getRandomId() + 'popup'; var _param; var tmpSession; var callbackTarget; /*리턴받을 result Target (returnData) */ if(typeof USER_SESSION !== 'undefined') { tmpSession = USER_SESSION; } else { tmpSession = pSession; } $('.wrap-inner').append(createHtml(popupId)); var _con = new ControlManage(pForm); _con.initCombo('[id='+popupId+'] [data-area="frmSrchAdr"] [name="SIDO_AREA_CD"]', 'BRS_BT_WEB_RetrieveCmCodeListNonSession', {baRs: 'OUT_RSET', IN_PSET: {GRP_CD: 'SIDO_AREA_CD', COMP_CD : tmpSession.COMP_CD, LANG_CD : tmpSession.LANG_CD }}, { code : 'CD', value : 'CD_NM' },[{CD:'', CD_NM:'전체'}],false); _con.initCombo('[id='+popupId+'] [data-area="frmSrchAdr"] [name="SGG_AREA_CD"]' , 'BRS_BT_WEB_RetrieveCmCodeListNonSession', {baRs: 'OUT_RSET', IN_PSET: {GRP_CD: 'SGG_AREA_CD' , COMP_CD : tmpSession.COMP_CD, LANG_CD : tmpSession.LANG_CD }}, { code : 'CD', value : 'CD_NM' },[{CD:'', CD_NM:'전체'}],false); $('[id='+popupId+'] [data-area="frmSrchAdr"] [name="SIDO_AREA_CD"]').on('combo-change',function() { var sido = _con.getData('[id='+popupId+'] [data-area="frmSrchAdr"] [name="SIDO_AREA_CD"]'); _con.initCombo('[id='+popupId+'] [data-area="frmSrchAdr"] [name="SGG_AREA_CD"]', 'BRS_BT_WEB_RetrieveCmCodeListNonSession', {baRs: 'OUT_RSET', IN_PSET: {GRP_CD: 'SGG_AREA_CD', PRNT_CD : sido, COMP_CD : tmpSession.COMP_CD, LANG_CD : tmpSession.LANG_CD}}, { code : 'CD', value : 'CD_NM' },[{CD:'', CD_NM:'전체'}],false); }); /*주소 검색 팝업*/ $('[id='+popupId+'] #btnSrchAddr').on('click',function() { var cond = _con.getDatas('[id='+popupId+'] [data-area="frmSrchAdr"]'); if(cond.ROD_NM == '') { Message.alert('검색어를 입력하세요.'); return false; } var sidoNm = $('[id='+popupId+'] [data-area="frmSrchAdr"] [name="SIDO_AREA_CD"]').val(); var sggNm = $('[id='+popupId+'] [data-area="frmSrchAdr"] [name="SGG_AREA_CD"]').val(); var keyword = ""; if(cond.SIDO_AREA_CD) keyword += $.trim(sidoNm); if(cond.SGG_AREA_CD) { if( $.trim(keyword) == '' ) keyword += $.trim(sggNm); else keyword += " " + $.trim(sggNm); } if( $.trim(keyword) == '' ) keyword += $.trim(cond.ROD_NM); else keyword += " " + $.trim(cond.ROD_NM); cond.keyword = keyword; //cond.pageMode = 'page'; fnRetrieveAddressList(1, 100, cond); }); /*주소 검색 팝업 Hide*/ $('[id='+popupId+'] #closeAddrPop').on('click', function() { popupLayerClose(this); }); /* 주소 선택 이벤트 */ $(document).on('click',"[id="+popupId+"] #grdAddrList tbody li", function() { var _this = this; var result = []; result.ZIP_CD = $(_this).closest('td').siblings('td').text(); result.ADR = $(_this).find('span').text(); result.TARGET = callbackTarget; if(pCallback) { pCallback(result); } popupLayerClose('[id='+popupId+'] #closeAddrPop'); }); /* 주소검색팝업 Show */ this.show = function(target) { clearPop(); callbackTarget = target; popupLayerOpen('#' + popupId); } function clearPop() { _con.setData('[id='+popupId+'] [data-area="frmSrchAdr"] [name="SIDO_AREA_CD"]', ''); _con.setData('[id='+popupId+'] [data-area="frmSrchAdr"] [name="SGG_AREA_CD"]', ''); _con.setData('[id='+popupId+'] [data-area="frmSrchAdr"] [name="ROD_NM"]', ''); $('[id='+popupId+'] #grdAddrList tbody').empty(); $('[id='+popupId+'] .paging-area').empty(); } /* 우편번호 리스트 검색 */ function fnRetrieveAddressList(pPageNo, pRowCount, condition) { var cond = condition; if(cond) { } else if(!cond && _param) { cond = _param; } else { return; } cond.rowCount = pRowCount; /*조회 수*/ if(pPageNo == 1) { cond.startRow = 0; /*start row index*/ } else { cond.startRow = ((pPageNo-1) * pRowCount) + 1 // ex) 3page 일 경우 (2 * 100)+1 = 201 startRow } var bindData = ''; pForm.send( 'ExternalInterLink.retrieveAddressList', cond, function(data) { if(data.result.list) { data.result.list.forEach(function(item, idx) { bindData += ''; bindData += ' '; bindData += '
        '; bindData += ' '; bindData += ' '; bindData += ' ' + item.zipNo + ''; bindData += ''; }); } if(bindData) { $('[id='+popupId+'] #grdAddrList tbody').empty().append(bindData); _con.pagingMobile('[id='+popupId+'] .paging-area', data.result.total, pRowCount, pPageNo, fnRetrieveAddressList); _param = cond; } else { $('[id='+popupId+'] #grdAddrList tbody').empty().append('검색된 주소가 없습니다.'); $('[id='+popupId+'] .paging-area').empty(); } }, function() {}, {showProgress: true}); } /* 주소검색팝업 태그 */ function createHtml(rndId) { var rtnTxt = ''; rtnTxt += ''; return rtnTxt; } }; /** * @method InitVisaDetailPopup * 비자상세팝업-모바일용 * @param {Object} pForm * @param {Object} pConMng * @param {object} pOptions * @docauthor Redcap Tour * @author 양석진 */ function InitVisaDetailPopupMobile(pForm, pConMng, pOptions) { this.id = pOptions.id; this.title = '비자상세내역'; this.getPopupTag = function() { var _this = this; var popupTag = ''; return popupTag; }; this.open = function(SVC_BKN_NO) { var _this = this; _this.getVisaDetail(SVC_BKN_NO); // _this.bindVisaSts(SVC_BKN_NO); // _this.bindVisaDetail(SVC_BKN_NO); // popupLayerOpen('#' + _this.id); // $('#' + _this.id).find('.popup-content').scrollTop(0); }; this.close = function() { popupLayerClose('#' + this.id + ' .popup-close'); }; this.getVisaDetail = function(SVC_BKN_NO) { var _this = this; pForm.send('BRS_BT_WR_RetrieveStsTl', { baRs: 'OUT_PSET', IN_PSET: { ETC_PRX_SVC_ITM_CD: 'V', SVC_BKN_NO: SVC_BKN_NO } }, function(stsTlData) { if( stsTlData && stsTlData.OUT_PSET && stsTlData.OUT_PSET.length > 0 ) { _this.bindVisaSts(stsTlData); pForm.send('BRS_BT_WR_RetrieveVisaBknDtl', { baRs: 'OUT_PSET', IN_PSET: { SVC_BKN_NO: SVC_BKN_NO } }, function(visaBknDtlData) { if( visaBknDtlData && visaBknDtlData.OUT_PSET && visaBknDtlData.OUT_PSET.length > 0 ) { _this.bindVisaDetail(visaBknDtlData); popupLayerOpen('#' + _this.id); $('#' + _this.id).find('.popup-content').scrollTop(0); } }); } }); }; /******************************************************************************/ // 비자상태바인딩 /******************************************************************************/ this.bindVisaSts = function(data) { var _this = this; var bindData = ''; data.OUT_PSET.forEach(function(cur) { bindData += '
      • ' + cur.STS_NM + '
      • '; }); $('#' + _this.id).find('[name="stepArea"] ol').empty().append(bindData); }; /******************************************************************************/ // 비자상세바인딩 /******************************************************************************/ this.bindVisaDetail = function(data) { var _this = this; var bindData = data.OUT_PSET[0]; var bookingDetailArea = ''; var tbConfirm = ''; var tbRequest = ''; var tbRelay = ''; bookingDetailArea = '
        ' + '
        예약번호
        ' + '
        ' + ' ' + bindData.VISA_BKN_STS_NM + '' + ' ' + bindData.SVC_BKN_NO + '' + '
        ' + '
        ' + '
        ' + '
        발급예정일
        ' + '
        ' + bindData.VISA_ISU_SCHD_DT + '
        ' + '
        ' + '
        ' + '
        예약담당자
        ' + '
        ' + ' ' + bindData.PCHR + '' + '
        ' + '
        '; if(bindData.DCSN_XN_YN == 'Y') { tbConfirm = '' + ' 신청일' + ' ' + bindData.APLC_DT + '' + '' + '' + ' 발급예정일' + ' ' + bindData.VISA_ISU_SCHD_DT + '' + '' + '' + ' 국가' + ' ' + bindData.NTN_NM + '' + '' + '' + ' 비자유형' + ' ' + bindData.VISA_TY + '' + '' + '' + ' 수속기간' + ' ' + bindData.VISA_PRCD_TERM_NM + '' + '' + '' + ' 결제 예상 금액' + ' ' + btUtil.addComma(bindData.TOT_AMT) + ' KRW' + '' + '' + ' 출장자정보' + ' ' + bindData.CUSTCO_ESMBR_NM + '' + '' + '' + ' 요청자정보' + ' ' + bindData.APLC_CUSTCO_ESMBR_NM + '' + ''; } else { tbConfirm = '확정사항이 없습니다.'; } if(bindData.ORGL_XN_YN == 'Y') { tbRequest = '' + ' 신청일' + ' ' + bindData.ORGL_APLC_DT + '' + '' + // '' + // ' 발급예정일' + // ' ' + bindData.ORGL_VISA_ISU_SCHD_DT + '' + // '' + '' + ' 국가' + ' ' + bindData.ORGL_NTN_NM + '' + '' + '' + ' 비자유형' + ' ' + bindData.ORGL_VISA_TY + '' + '' + '' + ' 수속기간' + ' ' + bindData.ORGL_VISA_PRCD_TERM_NM + '' + '' + '' + ' 결제 예상 금액' + ' ' + btUtil.addComma(bindData.ORGL_TOT_AMT) + ' KRW' + '' + '' + ' 출장자정보' + ' ' + bindData.ORGL_CUSTCO_ESMBR_NM + '' + '' + '' + ' 요청자정보' + ' ' + bindData.ORGL_APLC_CUSTCO_ESMBR_NM + '' + ''; } else { tbRequest = '요청사항이 없습니다.'; } tbRelay = '' + ' 접수서류전달방식' + ' ' + bindData.ACCPT_PPRS_CNVY_WAY_NM + '' + '' + '' + ' 접수서류발송예정일' + ' ' + bindData.ACCPT_PPRS_SNDN_SCHD_DT + '' + '' + '' + ' 발급서류수령방식' + ' ' + bindData.ISU_PPRS_CNVY_WAY_NM + '' + '' + '' + ' 예상출국일' + ' ' + bindData.EXPC_DPTR_DT + '' + ''; $('#' + _this.id).find('[name="bookingDetailArea"]').empty().append(bookingDetailArea); $('#' + _this.id).find('[name="tbConfirm"] tbody').empty().append(tbConfirm); $('#' + _this.id).find('[name="tbRequest"] tbody').empty().append(tbRequest); $('#' + _this.id).find('[name="tbRelay"] tbody').empty().append(tbRelay); }; var $popupTag = $( this.getPopupTag() ); $('.wrap').append($popupTag); } /** * @method InitRoamDetailPopup * 로밍상세팝업-모바일용 * @param {Object} pForm * @param {Object} pConMng * @param {object} pOptions * @docauthor Redcap Tour * @author 양석진 */ function InitRoamDetailPopupMobile(pForm, pConMng, pOptions) { this.id = pOptions.id; this.title = '로밍상세내역'; this.getPopupTag = function() { var _this = this; var popupTag = ''; return popupTag; }; this.open = function(SVC_BKN_NO) { var _this = this; _this.getRoamDetail(SVC_BKN_NO); // _this.bindRoamSts(SVC_BKN_NO); // _this.bindRoamDetail(SVC_BKN_NO); // _this.bindRoamBknImg(SVC_BKN_NO); // popupLayerOpen('#' + _this.id); // $('#' + _this.id).find('.popup-content').scrollTop(0); }; this.close = function() { popupLayerClose('#' + this.id + ' .popup-close'); }; this.getRoamDetail = function(SVC_BKN_NO) { var _this = this; pForm.send('BRS_BT_WR_RetrieveStsTl', { baRs: 'OUT_PSET', IN_PSET: { ETC_PRX_SVC_ITM_CD: 'R', SVC_BKN_NO: SVC_BKN_NO } }, function(stsTlData) { if( stsTlData && stsTlData.OUT_PSET && stsTlData.OUT_PSET.length > 0 ) { _this.bindRoamSts(stsTlData); pForm.send('BRS_BT_WR_RetrieveRoamBknImg', { baRs: 'OUT_PSET', IN_PSET: { SVC_BKN_NO: SVC_BKN_NO } }, function(roamBknImgData) { if( roamBknImgData && roamBknImgData.OUT_PSET && roamBknImgData.OUT_PSET.length > 0 ) { _this.bindRoamBknImg(roamBknImgData); pForm.send('BRS_BT_WR_RetrieveRoamBknDtl', { baRs: 'OUT_PSET', IN_PSET: { SVC_BKN_NO: SVC_BKN_NO } }, function(roamBknDtlData) { console.log(roamBknDtlData ,roamBknDtlData.OUT_PSET , roamBknDtlData.OUT_PSET.length); if( roamBknDtlData && roamBknDtlData.OUT_PSET && roamBknDtlData.OUT_PSET.length > 0 ) { _this.bindRoamDetail(roamBknDtlData); popupLayerOpen('#' + _this.id); $('#' + _this.id).find('.popup-content').scrollTop(0); } }); } }); } }); }; /******************************************************************************/ // 로밍상태바인딩 /******************************************************************************/ this.bindRoamSts = function(data) { var _this = this; var bindData = ''; data.OUT_PSET.forEach(function(cur) { bindData += '
      • ' + cur.STS_NM + '
      • '; }); $('#' + _this.id).find('[name="stepArea"] ol').empty().append(bindData); }; /******************************************************************************/ // 로밍상세바인딩 /******************************************************************************/ this.bindRoamDetail = function(data) { var _this = this; var bindData = data.OUT_PSET[0]; var tbConfirm = ''; var bookingDetailArea = ''; var tbRequest = ''; bookingDetailArea = '
        ' + '
        예약번호
        ' + '
        ' + ' ' + bindData.ROAM_BKN_STS_NM + '' + ' ' + bindData.SVC_BKN_NO + '' + '
        ' + '
        ' + '
        ' + '
        신청일
        ' + '
        ' + bindData.APLC_DT + '
        ' + '
        ' + '
        ' + '
        로밍담당자
        ' + '
        ' + '

        ' + bindData.PCHR + '

        ' + '
        ' + '
        '; if(bindData.DCSN_XN_YN == 'Y') { tbConfirm = '' + ' 서비스상품' + ' ' + bindData.SVC_ITM + '' + '' + '' + ' 요금' + ' ' + btUtil.addComma(bindData.TOT_AMT) + ' KRW' + '' + '' + ' 출국일자' + ' ' + bindData.DPTR_DT + '' + '' + '' + ' 출국시분' + ' ' + bindData.DPTR_HHMM + '' + '' + '' + ' 출국공항' + ' ' + bindData.DPTR_APO_NM + '' + '' + '' + ' 물품수령지' + ' ' + bindData.RCVNG_APO_PCUP_LOC_NM + '' + '' + '' + ' 입국일' + ' ' + bindData.ENTR_DT + '' + '' + '' + ' 입국시분' + ' ' + bindData.ENTR_HHMM + '' + '' + '' + ' 방문국가' + ' ' + bindData.NTN_NM + '' + '' + '' + ' 출장자정보' + ' ' + bindData.CUSTCO_ESMBR_NM + '' + '' + '' + ' 요청자정보' + ' ' + bindData.APLC_CUSTCO_ESMBR_NM + '' + ''; } else { tbConfirm = '확정사항이 없습니다.'; } if(bindData.ORGL_XN_YN == 'Y') { tbRequest = '' + ' 예약상태' + ' ' + bindData.ROAM_BKN_STS_NM + '' + '' + '' + ' 요금' + ' ' + bindData.ORGL_TOT_AMT + '' + '' + '' + ' 신청항목' + ' ' + bindData.ORGL_SVC_ITM + '' + '' + '' + ' 출국일자' + ' ' + bindData.ORGL_DPTR_DT + '' + '' + '' + ' 출국시분' + ' ' + bindData.ORGL_DPTR_HHMM + '' + '' + '' + ' 출국공항' + ' ' + bindData.ORGL_DPTR_APO_NM + '' + '' + '' + ' 물품수령지' + ' ' + bindData.ORGL_RCVNG_APO_PCUP_LOC_NM + '' + '' + '' + ' 입국일' + ' ' + bindData.ORGL_DPTR_DT + '' + '' + '' + ' 입국시분' + ' ' + bindData.ORGL_DPTR_HHMM + '' + '' + '' + ' 방문국가' + ' ' + bindData.ORGL_NTN_NM + '' + ''; } else { tbRequest = '요청사항이 없습니다.'; } $('#' + _this.id).find('[name="bookingDetailArea"]').empty().append(bookingDetailArea); $('#' + _this.id).find('[name="tbConfirm"] tbody').empty().append(tbConfirm); $('#' + _this.id).find('[name="tbRequest"] tbody').empty().append(tbRequest); }; /******************************************************************************/ // 로밍예약이미지바인딩 /******************************************************************************/ this.bindRoamBknImg = function(data) { var _this = this; var bindData = data.OUT_PSET[0]; var statusArea = '
      • 접수' + bindData.APLC_DT + '

      • '+ '
      • 수령' + bindData.PRX_RCVNG_DT + ' 수령완료

      • '+ '
      • 출국(출발)' + bindData.DPTR_DT + ' ' + bindData.DPTR_APO_NM + '

      • '+ '
      • 사용중' + bindData.DPTR_DT + ' ~ ' + bindData.ENTR_DT + '
        ' + bindData.THNG_NM + '

      • '+ '
      • 입국(도착)' + bindData.ENTR_DT + ' ' + bindData.ENTR_APO_NM + '

      • '; $('#' + _this.id).find('[name="statusArea"] ol').empty().append(statusArea); }; var $popupTag = $( this.getPopupTag() ); $('.wrap').append($popupTag); } /** * @method InitInsuDetailPopup * 보험상세팝업-모바일용 * @param {Object} pForm * @param {Object} pConMng * @param {object} pOptions * @docauthor Redcap Tour * @author 양석진 */ function InitInsuDetailPopupMobile(pForm, pConMng, pOptions) { this.id = pOptions.id; this.title = '보험상세내역'; this.getPopupTag = function() { var _this = this; var popupTag = ''; return popupTag; }; this.open = function(SVC_BKN_NO) { var _this = this; _this.getInsuDetail(SVC_BKN_NO); // _this.bindInsuSts(SVC_BKN_NO); // _this.bindInsuDetail(SVC_BKN_NO); // popupLayerOpen('#' + _this.id); // $('#' + _this.id).find('.popup-content').scrollTop(0); }; this.close = function() { popupLayerClose('#' + this.id + ' .popup-close'); }; this.getInsuDetail = function(SVC_BKN_NO) { var _this = this; pForm.send('BRS_BT_WR_RetrieveStsTl', { baRs: 'OUT_PSET', IN_PSET: { ETC_PRX_SVC_ITM_CD: 'I', SVC_BKN_NO: SVC_BKN_NO } }, function(stsTlData) { if( stsTlData && stsTlData.OUT_PSET && stsTlData.OUT_PSET.length > 0 ) { _this.bindInsuSts(stsTlData); pForm.send('BRS_BT_WR_RetrieveInsuBknDtl', { baRs: 'OUT_PSET', IN_PSET: { SVC_BKN_NO: SVC_BKN_NO } }, function(insuBknData) { if( insuBknData && insuBknData.OUT_PSET && insuBknData.OUT_PSET.length > 0 ) { _this.bindInsuDetail(insuBknData); popupLayerOpen('#' + _this.id); $('#' + _this.id).find('.popup-content').scrollTop(0); } }); } }); }; /******************************************************************************/ // 보험상태바인딩 /******************************************************************************/ this.bindInsuSts = function(data) { var _this = this; var bindData = ''; data.OUT_PSET.forEach(function(cur) { bindData += '
      • ' + cur.STS_NM + '
      • '; }); $('#' + _this.id).find('[name="stepArea"] ol').empty().append(bindData); }; /******************************************************************************/ // 보험상세바인딩 /******************************************************************************/ this.bindInsuDetail = function(data) { var _this = this; var bindData = data.OUT_PSET[0]; var bookingDetailArea = ''; var tbConfirm = ''; var tbRequest = ''; bookingDetailArea = '
        ' + '
        예약번호
        ' + '
        ' + ' ' + bindData.INSU_BKN_STS_NM + '' + ' ' + bindData.SVC_BKN_NO + '' + '
        ' + '
        ' + '
        ' + '
        청약일
        ' + '
        ' + bindData.ACCPT_DT + '
        ' + '
        ' + '
        ' + '
        보험담당자
        ' + '
        ' + ' ' + bindData.PCHR + '' + '
        ' + '
        '; if(bindData.DCSN_XN_YN == 'Y') { tbConfirm = '' + ' 신청일' + ' ' + bindData.APLC_DT + '' + '' + '' + ' 청약일' + ' ' + bindData.ACCPT_DT + '' + '' + '' + ' 보험시작일' + ' ' + bindData.INSU_BG_DT + '' + '' + '' + ' 보험종료일' + ' ' + bindData.INSU_END_DT + '' + '' + '' + ' 국가' + ' ' + bindData.NTN_NM + '' + '' + '' + ' 보험금액' + ' ' + btUtil.addComma(bindData.TOT_AMT) + ' KRW' + '' + '' + ' 증권번호' + ' ' + bindData.INSU_COS_NO + '' + '' + '' + ' 출장자정보' + ' ' + bindData.CUSTCO_ESMBR_NM + '' + '' + '' + ' 요청자정보' + ' ' + bindData.APLC_CUSTCO_ESMBR_NM + '' + ''; } else { tbConfirm = '확정사항이 없습니다.'; } if(bindData.ORGL_XN_YN == 'Y') { tbRequest = '' + ' 신청일' + ' ' + bindData.ORGL_APLC_DT + '' + '' + '' + ' 보험시작일' + ' ' + bindData.ORGL_INSU_BG_DT + '' + '' + '' + ' 보험종료일' + ' ' + bindData.ORGL_INSU_END_DT + '' + '' + '' + ' 국가' + ' ' + bindData.ORGL_NTN_NM + '' + '' + '' + ' 출장자정보' + ' ' + bindData.ORGL_CUSTCO_ESMBR_NM + '' + '' + '' + ' 요청자정보' + ' ' + bindData.ORGL_APLC_CUSTCO_ESMBR_NM + '' + ''; } else { tbRequest = '요청사항이 없습니다.'; } $('#' + _this.id).find('[name="bookingDetailArea"]').empty().append(bookingDetailArea); $('#' + _this.id).find('[name="tbConfirm"] tbody').empty().append(tbConfirm); $('#' + _this.id).find('[name="tbRequest"] tbody').empty().append(tbRequest); }; var $popupTag = $( this.getPopupTag() ); $('.wrap').append($popupTag); } /** * @method InitCnsPopupMobile * 품의상세팝업-모바일용 * @param {object} pOptions * @docauthor Redcap Tour * @author 양석진 */ function InitCnsPopupMobile(pOptions) { this.id = pOptions.id; this.param; this.rngPopup; this.cnsData = { AUTH : '03', /* 01: 기안자, 02: 결재자, 03: 출장자,열람자 */ CNS_NO : '', /* 품의번호 */ MRG_BKN_NO : '', /* 통합예약번호 */ DRAF_DTM : '', /* 기안일 */ DRAF_CUSTCO_ESMBR_NO: '', /* 기안자임직원번호 */ DRAF_CUSTCO_ESMBR_NM: '', /* 기안자임직원명 */ DRAF_CUSTCO_DEPT_NM : '', /* 기안자부서명 */ BZT_TY_CD : '', /* 출장유형코드(국내,해외) */ BZT_TY_NM : '', /* 출장유형명 */ BZT_TL_NM : '', /* 제목 */ BT_CNS_STS_CD : '0', /* 품의상태 */ PSNCT_LIST : [], /* 결재자목록 */ BZT_CNS_BTRVR_LIST : [], /* 출장자목록 */ BZT_CNS_CNVY_LIST : [], /* 전달목록 */ BZT_CNS_INQ_LIST : [], /* 열람목록 */ BZT_CNS_JRNY_LIST : [], /* 여정목록 */ BZT_CNS_AMT_LIST : [], /* 비용목록 */ }; this.getPopupTag = function() { var _this = this; var popupTag = ''; } bindMenuTag += ''; }); bindMenuTag += '
      '; $('.slidemenu-navi .nav-menu .nav-1dep').empty().append(bindMenuTag); slideMenuBar(); }); $("#btnLogoutApp").on('click',function() { navigator.pluginPreferences.getString(_dmsSettings.strings.setting, function(data) { _dmsUtil.convStringJson(data).then(function(convData){ var setting = { lang : convData.lang, deviceNo: convData.deviceNo, accessToken: "", theme: convData.theme }; _dmsUtil.convJsonString(setting).then(function(convData){ navigator.pluginPreferences.putString( _dmsSettings.strings.setting, convData, function(data){ $('.slidemenu-navi .nav-menu .nav-1dep').empty(); location.href = CONTEXT_PATH + '/mobile/logout.action'; }, function(v){ } ); }); }); }, function(v) {}); }); //모바일 홈 바로가기 $("#btnHomeAppFooter, #btnHomeAppSlide, #btnHomeAppHeader").on('click',function(){ fnMovPage_stg('BT_MR_0210', null); }); //짐꾸리기 바로가기 $("#btnPackFooter, #btnPackSlide").on('click',function(){ navigator.pluginPreferences.getString( "PACKAGE_ACCESS_LOCATION", function(location){ fnMovPage_stg(location,null); }, function(v){ fnMovPage_stg("BT_MC_0040",null); } ); }); //출장예약 바로가기 $("#btnObtReserve").on('click',function(){ var originUrl = $(location).attr('origin'); var obtUrl = '/obt_mobile/#/home/?accessToken='+ACCESS_TOKEN; //개발용 설정 if(originUrl.indexOf('dev.redcap.co.kr') >-1 || originUrl.indexOf('test-drive.redcap.co.kr') >-1) { location.href = 'https://btms4.dev-redcap.co.kr' + obtUrl; } else { location.href = originUrl + obtUrl; } }); function fnMovPage_stg(strUrl, stgParam) { var param = stgParam; var objs, value; for(var key in param){ value = param[key]; sessionStorage.setItem(key,JSON.stringify(value)); } $(location).attr('href',strUrl); } } else { /* LES BTMS메뉴 수정(02.21) */ var btmsWebRoleCd = ''; //BT_GNR_WEB, BT_ADM_WEB, BT_SPA_WEB //1096688 : 엘지에너지솔루션 if(USER_SESSION.BIZ_NO=='1096688'){ trace('BTMS 세션 정보 리스트'); trace(USER_SESSION); //임직원 메뉴권한 조회 trace('BTMS 메뉴권한 조회 시작....'); myForm.send_sync('BRS_BT_AB_RetrieveCustRole', { baRq: 'IN_PSET', baRs: 'OUT_PSET', IN_PSET: { BIZ_NO: USER_SESSION.BIZ_NO, CUSTCO_ESMBR_NO: USER_SESSION.CUSTCO_ESMBR_NO} }, function(btmsRslt) { if( btmsRslt && btmsRslt["OUT_PSET"] ) { btmsWebRoleCd = btmsRslt.OUT_PSET[0].WEB_ROLE_CD; } trace('BTMS 메뉴권한 : '+btmsWebRoleCd); }); trace('BTMS 메뉴권한 조회 종료....'); } // 메뉴설정 myForm.send('BRS_BT_WEB_RetrieveMenu', { baRq: 'IN_PSET', baRs: 'OUT_LIST', IN_PSET: { SYS_CD: 'BTMS_WEB' } }, function(data) { trace('메뉴설정 시작....'); var found = data.OUT_LIST.filter(function(cur) { return !cur.PRNT_MENU_CD; }); bindMenuTag += '
        '; found.forEach(function(cur, idx) { //bindMenuTag += '
      • ' + cur.MENU_NM + ''; bindMenuTag += '
      • ' if(cur.MENU_CD=='BWC100010') { //출자예약 - BWC100010 //bindMenuTag += '' + cur.MENU_NM + ''; bindMenuTag += '' + cur.MENU_NM + ''; } else if(cur.MENU_CD=='BWC100020') { //품의정보 - BWC100020 bindMenuTag += '' + cur.MENU_NM + ''; } else if(cur.MENU_CD=='BWC100030') { //출장지정보 - BWC100030 bindMenuTag += '' + cur.MENU_NM + ''; } else if(cur.MENU_CD=='BWC100040') { //정산관리 - BWC100040 bindMenuTag += '' + cur.MENU_NM + ''; } else if(cur.MENU_CD=='BWC100050') { //출장관리 - BWC100050 bindMenuTag += '' + cur.MENU_NM + ''; } else if(cur.MENU_CD=='BWC100060') { //마이페이지 - BWC100060 bindMenuTag += '' + cur.MENU_NM + ''; } if(isSubMenu(data.OUT_LIST, cur)) { bindMenuTag += ''; } bindMenuTag += '
      • '; /* * LES BTMS메뉴 수정(02.21) * 홍보사항 추가(04.12.31) */ if(USER_SESSION.BIZ_NO=='1096688'){ //BWC100010:출장예약 아래 메뉴 지정 if(btmsWebRoleCd=='BT_GNR_WEB' && cur.MENU_CD=='BWC100010'){ //bindMenuTag += '
      • 출장안내
      • '; bindMenuTag += '
      • 출장안내
      • '; bindMenuTag += '
      • 홍보사항
      • '; } if((btmsWebRoleCd=='BT_ADM_WEB' || btmsWebRoleCd=='BT_SPA_WEB') && cur.MENU_CD=='BWC100010'){ //bindMenuTag += '
      • 출장안내
      • '; bindMenuTag += '
      • 출장안내
      • '; bindMenuTag += '
      • 홍보사항
      • '; } } }); bindMenuTag += '
      '; $('.snb .snb-nav').empty().append(bindMenuTag); $('[page-cd="' + page + '"]').closest('[big-menu]').addClass('on'); snb(); trace('메뉴설정 종료....'); }); // BTMS로고 $('#btmsLogo').on('click', function() { if( USER_SESSION.BKN_CNT * 1 > 0 ) { location.href = 'BT_WC_0390'; } else { location.href = 'BT_WC_0480'; } }); // 고객사로고설정 if( USER_SESSION.CUSTCO_LOGO_FILE_ID ) { $('.header .logo').empty().append('' + USER_SESSION.BIZ_NM + ''); } else { $('.header .logo').empty(); } // 공지사항(팝업) // 간편예약/Door to Door화면,예약후화면에서만 공지사항을 보여준다. if( page == 'BT_WC_0390' || page == 'BT_WC_0480' ) { myForm.send('BRS_BT_WEB_RetrieveNtcPopup', { baRq:'IN_PSET', baRs: 'OUT_PSET,OUT_PSET1', IN_PSET: { BBS_SE_CD: 'NOTICE', SYS_CD: 'BTMS_WEB' } }, function(data) { var hidePopups = JSON.parse(localStorage["hidePopups"] || JSON.stringify([])); data.OUT_PSET.forEach(function(cur) { var isPopup = hidePopups.find(function(popup) { return popup == cur.PST_SEQ }); if(!isPopup) window.open('BT_WC_0200?FROM=H&PST_SEQ=' + cur.PST_SEQ + '', '_blank', 'resizable=yes, scrollbars=yes, titlebar=yes, toolbar=no, width=1050, height=500'); }); }); } /* LES BTMS메뉴 수정(02.21) */ if(USER_SESSION.BIZ_NO=='1096688'){ // 출장매뉴얼 공지사항(팝업) // 간편예약/Door to Door화면,예약후화면에서만 공지사항을 보여준다. if( page == 'BT_WC_0390' || page == 'BT_WC_0480' ) { myForm.send('BRS_BT_WEB_RetrieveNtcPopup', { baRq:'IN_PSET', baRs: 'OUT_PSET,OUT_PSET1', IN_PSET: { BBS_SE_CD: 'BIZ_TR_MNL', SYS_CD: 'BTMS_WEB' } }, function(data) { var hidePopups = JSON.parse(localStorage["hidePopups"] || JSON.stringify([])); data.OUT_PSET.forEach(function(cur) { var isPopup = hidePopups.find(function(popup) { return popup == cur.PST_SEQ }); if(!isPopup) window.open('BT_WC_0201?FROM=H&PST_SEQ=' + cur.PST_SEQ + '', '_blank', 'resizable=yes, scrollbars=yes, titlebar=yes, toolbar=no, width=1050, height=500'); }); }); //홍보사항 (팝업) myForm.send('BRS_BT_WEB_RetrieveNtcPopup', { baRq:'IN_PSET', baRs: 'OUT_PSET,OUT_PSET1', IN_PSET: { BBS_SE_CD: 'PROMO_INFO', SYS_CD: 'BTMS_WEB' } }, function(data) { var hidePopups = JSON.parse(localStorage["hidePopups"] || JSON.stringify([])); data.OUT_PSET.forEach(function(cur) { var isPopup = hidePopups.find(function(popup) { return popup == cur.PST_SEQ }); if(!isPopup) window.open('BT_WC_0202?FROM=H&PST_SEQ=' + cur.PST_SEQ + '', '_blank', 'resizable=yes, scrollbars=yes, titlebar=yes, toolbar=no, width=1050, height=500'); }); }); } } // 패밀리사이트 } function createMenu(pAllData, pUpData) { var found = pAllData.filter(function(cur) { return cur.PRNT_MENU_CD == pUpData.MENU_CD; }); if( found.length > 0 ) bindMenuTag += '
        '; found.forEach(function(cur) { var isChildMenu = isSubMenu(pAllData, cur); bindMenuTag += '
      • ' + ' ' + cur.MENU_NM + '' + ( (isChildMenu && SYS_CD =='BTMS_WEB') ? '' : '' ) ; // 하위메뉴 존재시 실행 if(isChildMenu) { if(SYS_CD == 'BTMS_MOBILE') { bindMenuTag += '
      • '; }); if( found.length > 0 ) bindMenuTag += '
      '; } function isSubMenu(pAllData, pUpData) { var found = pAllData.find(function(cur) { return ( cur.PRNT_MENU_CD == pUpData.MENU_CD ); }); return ( found ? true : false ); } // 사용자정보 바인딩 if($('.user').length > 0) { if(SYS_CD == 'BTMS_MOBILE') { if(USER_SESSION && USER_SESSION.CUSTCO_ESMBR_NM) { $('#beforeLogin').hide(); $('#afterLogin').show(); $('#loginUserId').text(USER_SESSION.CUSTCO_ESMBR_NM); } else { $('#afterLogin').hide(); $('#beforeLogin').show(); } } else { var bindTag = '' + ''; $('.user').empty().append(bindTag); utilPopup(); // 메뉴삭제 $('.menu').empty(); } } // 전역이벤트처리 if(SYS_CD == 'BTMS_WEB') { $(document).off('mouseup'); // 퓨즈에서 적용한 이벤트 제거 $(window).mouseup(function(e) { var isAllLayerHide = true; $('[data-control], [data-control-layer]').each(function() { if( $(this).is($(e.target)) || $(this).has($(e.target)).length > 0) isAllLayerHide = false; }); if(isAllLayerHide) hideLayers(); }); $(window).on('scroll', function(event) { var controlLayer = $('[data-control-layer]:visible'); // 활성화된 컨트롤레이어를 찾음 if(controlLayer.length > 0) { var areaName = controlLayer.attr('data-area-name'); var controlName = controlLayer.attr('data-control-name'); var el = $('[data-area="' + areaName + '"] [name="' + controlName + '"]').get(0); var rect = el.getBoundingClientRect(); var x = rect.left + ( window.scrollX || window.pageXOffset ); var y = rect.top + ( window.scrollY || window.pageYOffset ); $('[data-area="' + areaName + '"] [name="' + controlName + '"]').css('top' , x + 'px'); $('[data-area="' + areaName + '"] [name="' + controlName + '"]').css('left', y + 'px'); } }); } // BTMS화면 호출시 공통영역(header, snb, footer)을 숨김처리를 위함 if(SYS_CD == 'BTMS_WEB') { if( !sessionStorage.getItem('hideCmnArea') && btUtil.getParam('hideCmnArea') ) { sessionStorage.setItem('hideCmnArea', btUtil.getParam('hideCmnArea')); } var hideCmnArea = sessionStorage.getItem('hideCmnArea'); if(hideCmnArea) { $('div.header').remove(); $('div.snb').remove(); $('div.footer').remove(); } } // OBT사용자키가 없거나 엑세스토큰값이 변경되었을 경우 OBT인증 if( !sessionStorage.getItem('OBT_USER_KEY') || ACCESS_TOKEN != sessionStorage.getItem('OBT_REQ_ACCESS_TOKEN') ) { // OBT인증 if( SYS_CD == 'BTMS_MOBILE' ) { obtMobile.getInfo(); } else { obt.getInfo(); } } } });