| | |
| | | formSubmit : formSubmit, // 폼 전송 |
| | | formCheck : formCheck, // 폼 체크 |
| | | getIssueIspFieldListCallBack : getIssueIspFieldListCallBack, |
| | | getIssueHostingFieldListCallBack : getIssueHostingFieldListCallBack |
| | | getIssueHostingFieldListCallBack : getIssueHostingFieldListCallBack, |
| | | autoHyphenPhone : autoHyphenPhone // 연락처 입력시 하이픈 자동 입력 |
| | | }; |
| | | |
| | | $scope.vm = { |
| | | form : { |
| | | name : "", //업체명 |
| | | ispId : "", |
| | | ispName : "", |
| | | hostingName : "", |
| | | //companyType : "", //업체분류 |
| | | //profitYN : "", //영리/비영리 |
| | | //industry : "", //산업분류 |
| | | //domain : "", //도메인 |
| | | hostingId : "", |
| | | manager : "", //담당자 |
| | | tel : "", //전화번호 |
| | | email : "", //이메일 |
| | |
| | | } |
| | | } |
| | | }; |
| | | |
| | | |
| | | angular.extend(this, $controller('autoCompleteController', {$scope : $scope, $injector : $injector})); |
| | | |
| | |
| | | return false; |
| | | } |
| | | |
| | | $scope.$on("ispFieldEvent", function (event, result) { |
| | | $scope.vm.form.ispId = result[0].id; |
| | | }); |
| | | |
| | | $scope.$on("hostingFieldEvent", function (event, result) { |
| | | $scope.vm.form.hostingId = result[0].id; |
| | | }); |
| | | |
| | | // 연락처 입력시 하이픈 자동 입력 |
| | | function autoHyphenPhone() { |
| | | let phone = $scope.vm.form.tel |
| | | let seoul = $scope.vm.form.tel |
| | | |
| | | // 핸드폰 및 지방 지역번호 조건 |
| | | phone.replace(/^[0-9]/g, ''); |
| | | // 서울 지역번호 조건 |
| | | seoul.replace(/^[0-9]/g, ''); |
| | | var tmp = ''; |
| | | |
| | | if (phone.length < 4) { |
| | | return phone; |
| | | } else if (phone.length < 7) { |
| | | tmp += phone.substr(0, 3); |
| | | tmp += '-'; |
| | | tmp += phone.substr(3); |
| | | $scope.vm.form.tel = tmp; |
| | | } else if (seoul.substring(0, 2) == "02" && seoul.length == 9) { // 서울 지역번호 조건 |
| | | tmp += seoul.substring(0, 2); |
| | | tmp += '-'; |
| | | tmp += seoul.substring(2, 5); |
| | | tmp += '-'; |
| | | tmp += seoul.substr(5); |
| | | $scope.vm.form.tel = tmp; |
| | | } else if (seoul.substring(0, 2) == "02" && seoul.length == 10) { // 서울 지역번호 조건 |
| | | tmp += seoul.substring(0, 2); |
| | | tmp += '-'; |
| | | tmp += seoul.substring(2, 6); |
| | | tmp += '-'; |
| | | tmp += seoul.substr(6); |
| | | $scope.vm.form.tel = tmp; |
| | | } else if (phone.length < 11) { // 핸드폰 및 지방 지역번호 조건 |
| | | tmp += phone.substr(0, 3); |
| | | tmp += '-'; |
| | | tmp += phone.substr(3, 3); |
| | | tmp += '-'; |
| | | tmp += phone.substr(6); |
| | | $scope.vm.form.tel = tmp; |
| | | } else { // 핸드폰 및 지방 지역번호 조건 |
| | | tmp += phone.substr(0, 3); |
| | | tmp += '-'; |
| | | tmp += phone.substr(3, 4); |
| | | tmp += '-'; |
| | | tmp += phone.substr(7); |
| | | $scope.vm.form.tel = tmp; |
| | | } |
| | | return phone; |
| | | } |
| | | |
| | | // 폼 전송 |
| | | function formSubmit(condition) { |
| | | $rootScope.spinner = true; |
| | | $scope.vm.form.tel = $scope.vm.form.tel.replace(/\-/g,''); // 전화번호를 보낼땐 하이픈을 제거해서 DB에 저장 |
| | | |
| | | var content = { |
| | | name : $rootScope.preventXss($scope.vm.form.name), // 업체명 |
| | | ispName : $rootScope.preventXss($scope.vm.form.ispName), // 업체명 |
| | | hostingName : $rootScope.preventXss($scope.vm.form.hostingName), // 업체명 |
| | | //companyType : $scope.vm.form.companyType, //업체분류 |
| | | //profitYN : $scope.vm.form.profitYN, //영리/비영리 |
| | | //industry : $scope.vm.form.industry, //산업분류 |
| | | //domain : $scope.vm.form.domain, //도메인 |
| | | ispId : (function () { // ISP 아이디 |
| | | var ispId = -1; |
| | | if ($scope.vm.form.issueIspFields != null) { |
| | | ispId = $scope.vm.form.ispId; |
| | | } |
| | | return ispId; |
| | | })(), |
| | | hostingId : (function () { // Hosting 아이디 |
| | | var hostingId = -1; |
| | | if ($scope.vm.form.issueHostingFields != null) { |
| | | hostingId = $scope.vm.form.hostingId; |
| | | } |
| | | return hostingId; |
| | | })(), |
| | | manager : $scope.vm.form.manager, //담당자 |
| | | tel : $scope.vm.form.tel, //전화번호 |
| | | email : $scope.vm.form.email, //이메일 |
| | |
| | | $uibModalInstance.dismiss('cancel'); |
| | | $(document).unbind("keydown"); // 단축키 이벤트 제거 |
| | | } |
| | | |
| | | } |
| | | |
| | | ]); |
| | | } |
| | | ); |