| | |
| | | 'angular' |
| | | ], |
| | | function (app, angular) { |
| | | app.controller('workspaceLevelAddController', ['$scope', '$rootScope', '$log', '$resourceProvider', 'SweetAlert', '$uibModal', '$uibModalInstance', '$state', 'Workspace', '$filter', 'parameter', '$timeout', |
| | | function ($scope, $rootScope, $log, $resourceProvider, SweetAlert, $uibModal, $uibModalInstance, Payment, $filter, parameter, $timeout) { |
| | | app.controller('workspaceLevelAddController', ['$scope', '$rootScope', '$log', '$resourceProvider', 'SweetAlert', '$uibModal', '$uibModalInstance', 'UserWorkspace', 'Workspace', '$filter', 'parameter', |
| | | function ($scope, $rootScope, $log, $resourceProvider, SweetAlert, $uibModal, $uibModalInstance, UserWorkspace, Workspace, $filter, parameter) { |
| | | |
| | | $scope.fn = { |
| | | //add : add, // 등급 추가 |
| | | cancel : cancel, // 팝업 창 닫기 |
| | | formSubmit : formSubmit, // 폼 전송 |
| | | formCheck : formCheck, // 폼 체크 |
| | | formSubmit : formSubmit |
| | | modifyUserPermission : modifyUserPermission // 업무 공간 참여하는 사용자의 참여 상태 변경 |
| | | }; |
| | | |
| | | $scope.vm = { |
| | | form : { |
| | | /*workspaceId : parameter.workspaceId, |
| | | usdKrw : parameter.usdKrw, |
| | | maxUser : parameter.maxUser, |
| | | buyUser : "", |
| | | type : "MONTH", |
| | | cardNumber1 : "", |
| | | cardNumber2 : "", |
| | | cardNumber3 : "", |
| | | cardNumber4 : "", |
| | | expireMonth : "", |
| | | expireYear : "", |
| | | expireYearTmp : "", |
| | | birth : "", |
| | | cardPwd : "", |
| | | paymentAmountTemp : "", // 클라이언트에서 사용자 수를 변경할 때 보여줄 결제 금액 - 금액은 서버에서 다시 계산한다. |
| | | confirm : false // 약관 동의*/ |
| | | }, |
| | | viewAgreeTerm : false |
| | | levelName : "", |
| | | permPartnerSetting : false, |
| | | permWorkSpaceSetting : false, |
| | | permProjectSetting : false, |
| | | permIssueSetting : false, |
| | | permIssueSystemSetting : false, |
| | | permApi : false, |
| | | permNotice : false, |
| | | permFAQ : false, |
| | | permQnA : false, |
| | | permGuide : false |
| | | } |
| | | }; |
| | | |
| | | // 사용자 가격 보기 |
| | | /*$scope.$watch("vm.form.buyUser", function (newValue) { |
| | | |
| | | if ($rootScope.isDefined(newValue)) { |
| | | var totalAmount = (BILLING_AMOUNT * $scope.vm.form.usdKrw * newValue); |
| | | var discount = 0; |
| | | |
| | | if (newValue > 99) { |
| | | var sale = newValue * 0.01; |
| | | discount = (totalAmount * (sale/100)); |
| | | } |
| | | |
| | | $scope.vm.form.paymentAmountTemp = Math.floor(totalAmount - discount); |
| | | // 폼 체크 |
| | | function formCheck(formInvalid) { |
| | | if (formInvalid) { |
| | | return true; |
| | | } |
| | | else { |
| | | $scope.vm.form.paymentAmountTemp = 0; |
| | | } |
| | | });*/ |
| | | |
| | | return false; |
| | | } |
| | | |
| | | // 폼 전송 |
| | | /*function formSubmit() { |
| | | function formSubmit(condition) { |
| | | $rootScope.spinner = true; |
| | | |
| | | $scope.vm.form.expireYear = "20" + $scope.vm.form.expireYearTmp; |
| | | var content = angular.copy($scope.vm.form); |
| | | UserWorkspace.levelAdd($resourceProvider.getContent(condition, |
| | | $resourceProvider.getPageContent(0, 0))).then(function (result) { |
| | | |
| | | // 암호화 시간동안 프로그래스바 못올리는 현상 수정 |
| | | $timeout(function () { |
| | | content.cardNumber1 = $rootScope.encryption($scope.vm.form.cardNumber1); |
| | | content.cardNumber2 = $rootScope.encryption($scope.vm.form.cardNumber2); |
| | | content.cardNumber3 = $rootScope.encryption($scope.vm.form.cardNumber3); |
| | | content.cardNumber4 = $rootScope.encryption($scope.vm.form.cardNumber4); |
| | | content.expireMonth = $rootScope.encryption($scope.vm.form.expireMonth); |
| | | content.expireYear = $rootScope.encryption($scope.vm.form.expireYear); |
| | | content.cardPwd = $rootScope.encryption($scope.vm.form.cardPwd); |
| | | content.birth = $rootScope.encryption($scope.vm.form.birth); |
| | | if (result.data.message.status === "success") { |
| | | $scope.fn.cancel(); |
| | | // 목록 화면 갱신 |
| | | $rootScope.$broadcast("getUserLevelList", {}); |
| | | } |
| | | else { |
| | | SweetAlert.error($filter("translate")("managementWorkspace.failedLevelRegistration"), result.data.message.message); |
| | | } |
| | | |
| | | Payment.immediateAddUser($resourceProvider.getContent( |
| | | content, |
| | | $resourceProvider.getPageContent(0, 10))).then(function (result) { |
| | | if (result.data.message.status === "success") { |
| | | $scope.fn.cancel(); |
| | | SweetAlert.success($filter("translate")("managementWorkspace.paymentCompleted"), result.data.message.message); // "추가 결제 성공" |
| | | // 결제 및 업무 공간 정보 화면 갱신 |
| | | $rootScope.$broadcast("findMyWorkspace", {}); |
| | | $rootScope.$broadcast("getPaymentDetail", {}); |
| | | } |
| | | else { |
| | | SweetAlert.error($filter("translate")("managementWorkspace.failedToRegularPaymentChange"), result.data.message.message); // "추가 결제 실패" |
| | | } |
| | | $rootScope.spinner = false; |
| | | }); |
| | | |
| | | $rootScope.spinner = false; |
| | | }); |
| | | }, 100); |
| | | }*/ |
| | | } |
| | | |
| | | // 팝업 창 닫기 |
| | | function cancel() { |
| | |
| | | $(document).unbind("keydown"); // 단축키 이벤트 제거 |
| | | } |
| | | |
| | | // 사용자 수 변경 |
| | | /*function changeBuyUser(changeType) { |
| | | if (changeType === "PLUS") { |
| | | if ($scope.vm.form.buyUser < 999) { |
| | | $scope.vm.form.buyUser++; |
| | | function modifyUserPermission(userPermission ) { |
| | | UserWorkspace.levelModify($resourceProvider.getContent(userPermission, |
| | | $resourceProvider.getPageContent(0, 0))).then(function (result) { |
| | | if (result.data.message.status === "success") { |
| | | } |
| | | } |
| | | else { |
| | | if ($scope.vm.form.buyUser > 1) { |
| | | $scope.vm.form.buyUser--; |
| | | else { |
| | | SweetAlert.error($filter("translate")("managementWorkspace.failedToParticipationStatusChange"), result.data.message.message); // "참여 상태 변경 실패" |
| | | } |
| | | } |
| | | }*/ |
| | | |
| | | // 폼 체크 |
| | | /*function formCheck() { |
| | | if (!$scope.vm.form.confirm) { |
| | | return true; |
| | | } |
| | | |
| | | if (!$rootScope.isDefined($scope.vm.form.cardNumber1) || !$rootScope.isDefined($scope.vm.form.cardNumber2) || !$rootScope.isDefined($scope.vm.form.cardNumber3) |
| | | || !$rootScope.isDefined($scope.vm.form.cardNumber4) || !$rootScope.isDefined($scope.vm.form.expireMonth) || !$rootScope.isDefined($scope.vm.form.expireYearTmp) |
| | | || !$rootScope.isDefined($scope.vm.form.birth) || !$rootScope.isDefined($scope.vm.form.cardPwd) || !$rootScope.isDefined($scope.vm.form.type)) { |
| | | return true; |
| | | } |
| | | |
| | | if ($scope.vm.form.cardNumber1.length !== 4 || $scope.vm.form.cardNumber2.length !== 4 || $scope.vm.form.cardNumber3.length !== 4 || $scope.vm.form.cardNumber4.length !== 4 |
| | | || $scope.vm.form.expireMonth.length !== 2 || $scope.vm.form.expireYearTmp.length !== 2 || $scope.vm.form.birth.length < 6 || $scope.vm.form.cardPwd.length !== 2) { |
| | | return true; |
| | | } |
| | | |
| | | // 사용자 수는 1명 이상이어야 한다. |
| | | if ($scope.vm.form.buyUser < 1) { |
| | | return true; |
| | | } |
| | | |
| | | return false; |
| | | }*/ |
| | | }); |
| | | } |
| | | } |
| | | |
| | | ]); |