';
calendarTag += '';
}
}
// 현재월의 종료일이 토요일이 아닐 경우 다음달의 일자를 채움
if(currMonthLastDate.day() != 1) {
for(var i=0; i<(6 - currMonthLastDate.day()); i++) {
nextMonthStartDate.add(i == 0 ? 0 : 1, 'day');
calendarTag += getPickerDateTag(nextMonthStartDate.format('YYYY-MM-DD'), nextMonthStartDate.format('DD'), nextMonthStartDate.day(), false);
}
}
calendarTag += '
';
return calendarTag;
};
function getPickerDateTag(pDate, pDD, pDay, pIsCurMonth) {
if( !options.isPadDate && !pIsCurMonth)
return ' | ';
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 += '';
};
/******************************************************************************/
// 범위추가
/******************************************************************************/
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 = '