/* start customerList board search */ vm.searchForBoard_customerList = function(){ if(vm.searchCustomerNameOrNumber_customerList == null || vm.searchCustomerNameOrNumber_customerList == ''){ vm.searchCustomerNameOrNumber_customerList = null; } vm.searchInfo_customerList = { searchDate: { startDate: vm.startDate_customerList, endDate: vm.endDate_customerList, }, searchAccountStatus: vm.searchAccountStatus_customerList, searchCustomerNameOrNumber: vm.searchCustomerNameOrNumber_customerList } vm.iniBoard_customerList(); getCustomerList(); } vm.checkDuring_customerList = function(check){ if(check == 1){ // 오늘 vm.checkChangeDate_customerList = false; }else{ vm.checkChangeDate_customerList = true; } } vm.searchForDate_customerList = function(check){ if(check){ vm.checkChangeDate_customerList = false; vm.startDate_customerList = null; vm.endDate_customerList = null; }else{ vm.startDate_customerList = $("#startDate").val(); vm.endDate_customerList = $("#endDate").val(); } vm.searchForBoard_customerList(); } vm.searchForAccountStatus_customerList = function(check){ // check 0:비활성, 1: 활성 if(check == null){ vm.searchAccountStatus_customerList = null; }else{ vm.searchAccountStatus_customerList = check; } vm.searchForBoard_customerList(); } vm.searchForCustomerJoinStatus_customerList = function(check){ // check 0:승인대기, 1: 가입승인, 2: 승인거부 if(check == null){ vm.searchCustomerJoinStatus_customerList = null; }else{ vm.searchCustomerJoinStatus_customerList = check; } vm.searchForBoard_customerList(); } vm.searchForCustomerNameOrNumber_customerList = function(check){ if(check == 0){ vm.searchCustomerNameOrNumber_customerList = null; } vm.searchForBoard_customerList(); } /* end customerList board search */ /* start customerList board function */ vm.resetBoard_customerList = function () { /* start customerList board search 초기화*/ vm.checkChangeDate_customerList = false; /* end customerList board search 초기화*/ // board 초기화 vm.flag_customerList = true; vm.curPage_customerList = 1; // 현재 페이지 vm.startRange_customerList = 1; // 시작 페이지 번호 vm.endRange_customerList = 1; // 마지막 페이지 번호 vm.searchInfo_customerList = { searchDate: { startDate: vm.startDate_customerList, endDate: vm.endDate_customerList, }, searchAccountStatus: vm.searchAccountStatus_customerList, searchCustomerNameOrNumber: vm.searchCustomerNameOrNumber_customerList } vm.startDate_customerList = null; vm.endDate_customerList = null; vm.searchAccountStatus_customerList = null; vm.searchCustomerNameOrNumber_customerList = null; vm.orderInfo_customerList = null; getCustomerList(); } vm.iniBoard_customerList = function(){ vm.flag_customerList = true; vm.curPage_customerList = 1; // 현재 페이지 vm.startRange_customerList = 1; // 시작 페이지 번호 vm.endRange_customerList = 1; // 마지막 페이지 번호 } vm.selectBoardCnt_customerList = function(number){ vm.boardCnt_customerList = number; vm.iniBoard_customerList(); getCustomerList(); } /* end customerList board function */ /* start: releaseList board iniData*/ function iniData(){ /* start customerList board search 초기화*/ vm.checkChangeDate_customerList = false; /* end customerList board search 초기화*/ /* start customerList board 초기화*/ vm.flag_customerList = true; vm.curPage_customerList = 1; // 현재 페이지 vm.boardCnt_customerList = 15; // 한페이지에 보여지는 콘텐츠 개수 vm.arrowPageCnt_customerList = 5; vm.maxShownPageCnt_customerList = 5; // 보여지는 최대 페이지 개수 vm.startRange_customerList = 1; // 시작 페이지 번호 vm.endRange_customerList = 1; // 마지막 페이지 번호 vm.searchInfo_customerList = { searchDate: { startDate: null, endDate: null, }, searchAccountStatus: null, searchCustomerNameOrNumber: null } vm.startDate_customerList = null; vm.endDate_customerList = null; vm.searchAccountStatus_customerList = null; vm.searchCustomerNameOrNumber_customerList = null; /* end customerList board 초기화*/ getCustomerList(); } /* end: releaseList board iniData*/ /* start: customerList board */ function getCustomerList() { WEB_API_EMPLOYEE.getCustomerList({ curPage: vm.curPage_customerList, boardCnt: vm.boardCnt_customerList, searchInfo: vm.searchInfo_customerList, orderInfo: vm.orderInfo_customerList, }).then(function (result) { vm.getCustomerList = result.data.rows; vm.totalBoardLen_customerList = result.data.count; vm.pageCnt_customerList = Math.ceil(vm.totalBoardLen_customerList / vm.boardCnt_customerList); if (vm.flag_customerList) { if (vm.pageCnt_customerList <= vm.maxShownPageCnt_customerList) { vm.endRange_customerList = vm.pageCnt_customerList; } else { vm.endRange_customerList = vm.maxShownPageCnt_customerList; } } vm.flag_customerList = false; }).catch(function (err) { $log.error(err); }); } // ======================================================================= // 페이지 범위 계산 // ======================================================================= vm.pageRange_customerList = function (min, max) { var input = []; for (var i = min; i <= max; i += 1) { input.push(i); } return input; }; // ======================================================================= // 버튼클릭 이벤트 // ======================================================================= // clickFirstArrow 클릭 vm.clickFirstArrow_customerList = function () { vm.curPage_customerList = 1; vm.startRange_customerList = 1; if (vm.pageCnt_customerList <= vm.maxShownPageCnt_customerList) { vm.endRange_customerList = vm.pageCnt_customerList; } else { vm.endRange_customerList = vm.maxShownPageCnt_customerList; } getCustomerList(); }; // clickLastArrow 클릭 vm.clickLastArrow_customerList = function () { vm.curPage_customerList = vm.pageCnt_customerList; vm.endRange_customerList = vm.pageCnt_customerList; if (vm.pageCnt_customerList <= vm.maxShownPageCnt_customerList) { vm.startRange_customerList = 1; } else { var remainderValue = vm.pageCnt_customerList % vm.maxShownPageCnt_customerList; var value = vm.maxShownPageCnt_customerList - remainderValue; if (remainderValue != 0) { vm.startRange_customerList = vm.pageCnt_customerList - remainderValue + 1; } else { vm.startRange_customerList = vm.endRange_customerList; } } getCustomerList(); }; // leftArrow 클릭 vm.clickLeftArrow_customerList = function () { if (vm.curPage_customerList > 1) { vm.curPage_customerList -= vm.arrowPageCnt_customerList; } if (vm.curPage_customerList < vm.startRange_customerList) { if ((vm.endRange_customerList % vm.maxShownPageCnt_customerList) != 0) { vm.endRange_customerList += (vm.maxShownPageCnt_customerList - (vm.endRange_customerList % vm.maxShownPageCnt_customerList)); } vm.startRange_customerList -= vm.arrowPageCnt_customerList; vm.endRange_customerList = vm.startRange_customerList + (vm.arrowPageCnt_customerList - 1); } vm.curPage_customerList = vm.endRange_customerList; getCustomerList(); }; // rightArrow 클릭 vm.clickRightArrow_customerList = function () { if (vm.curPage_customerList < vm.pageCnt_customerList) { vm.curPage_customerList += vm.arrowPageCnt_customerList; } if (vm.curPage_customerList > vm.endRange_customerList) { vm.startRange_customerList += vm.arrowPageCnt_customerList; vm.endRange_customerList += vm.arrowPageCnt_customerList; if (vm.endRange_customerList >= vm.pageCnt_customerList) { vm.endRange_customerList = vm.pageCnt_customerList; } } vm.curPage_customerList = vm.startRange_customerList; getCustomerList(); }; // 페이지 직접 클릭 vm.clickPage_customerList = function (index) { vm.curPage_customerList = index; getCustomerList(); }; /* end: customerList board */