From 398a4927e195755bd6a46be99337efd8dacc3dc2 Mon Sep 17 00:00:00 2001 From: 박지현 <jhpark@maprex.co.kr> Date: 월, 07 3월 2022 18:08:13 +0900 Subject: [PATCH] Merge branch 'master' of http://maprex.iptime.org:9001/r/owl-kisa --- src/main/webapp/scripts/app/companyField/companyFieldAdd.controller.js | 305 +++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 284 insertions(+), 21 deletions(-) diff --git a/src/main/webapp/scripts/app/companyField/companyFieldAdd.controller.js b/src/main/webapp/scripts/app/companyField/companyFieldAdd.controller.js index 42bdacc..e2a2c5c 100644 --- a/src/main/webapp/scripts/app/companyField/companyFieldAdd.controller.js +++ b/src/main/webapp/scripts/app/companyField/companyFieldAdd.controller.js @@ -7,31 +7,61 @@ 'app' ], function (app) { - app.controller('companyFieldAddController', ['$scope', '$rootScope', '$log', '$resourceProvider', 'SweetAlert', '$uibModal', '$uibModalInstance', '$state', 'CompanyField', '$filter', '$injector','$controller', - function ($scope, $rootScope, $log, $resourceProvider, SweetAlert, $uibModal, $uibModalInstance, $state, CompanyField, $filter, $injector, $controller) { + app.controller('companyFieldAddController', ['$scope', '$rootScope', '$log', '$resourceProvider', 'SweetAlert', '$uibModal', '$uibModalInstance', '$state', 'CompanyField', 'CompanyFieldCategory', '$filter', '$injector','$controller', + function ($scope, $rootScope, $log, $resourceProvider, SweetAlert, $uibModal, $uibModalInstance, $state, CompanyField, CompanyFieldCategory, $filter, $injector, $controller) { $scope.fn = { cancel : cancel, // �뙘�뾽 李� �떕湲� formSubmit : formSubmit, // �뤌 �쟾�넚 formCheck : formCheck, // �뤌 泥댄겕 getIssueIspFieldListCallBack : getIssueIspFieldListCallBack, - getIssueHostingFieldListCallBack : getIssueHostingFieldListCallBack + getIssueHostingFieldListCallBack : getIssueHostingFieldListCallBack, + getCompanyTypeListCallBack : getCompanyTypeListCallBack, + getParentSectorListCallBack : getParentSectorListCallBack, + getChildSectorListCallBack : getChildSectorListCallBack, + getRegionListCallBack : getRegionListCallBack, + getStatusListCallBack : getStatusListCallBack, + addTel : addTel, + addMail : addMail, + removeTelInput : removeTelInput, + removeMailInput : removeMailInput }; $scope.vm = { form : { name : "", //�뾽泥대챸 + ispId : "", ispName : "", hostingName : "", - //companyType : "", //�뾽泥대텇瑜� - //profitYN : "", //�쁺由�/鍮꾩쁺由� - //industry : "", //�궛�뾽遺꾨쪟 - //domain : "", //�룄硫붿씤 + hostingId : "", manager : "", //�떞�떦�옄 tel : "", //�쟾�솕踰덊샇 email : "", //�씠硫붿씪 url : "", // url - memo : "" //鍮꾧퀬 + ipStart : "", //ip�떆�옉二쇱냼 + ipEnd : "", //ip醫낅즺二쇱냼 + memo : "", //鍮꾧퀬 + companyTypeId : "", + companyType : "", //湲곗뾽援щ텇 + parentSectorId : "", + parentSector : "", //�뾽醫�(��遺꾨쪟) + childSectorId : "", + childSector : "", //�뾽醫�(以묐텇瑜�) + regionId : "", + region : "", //吏��뿭 + statusId : "", + status : "", //�긽�깭 + inputTels : [0], //�뿰�씫泥� + tels : {}, + inputMails : [0], //�씠硫붿씪 + emails : {} + }, + typeCategory : { + companyType : "COMPANYTYPE", + parentSector : "PARENTSECTOR", + childSector : "CHILDSECTOR", + region : "REGION", + status : "STATUS" }, autoCompletePage : { ispField : { @@ -41,10 +71,29 @@ hostingField : { page : 0, totalPage : 0 + }, + companyType : { + page : 0, + totalPage : 0 + }, + parentSector : { + page : 0, + totalPage : 0 + }, + childSector : { + page : 0, + totalPage : 0 + }, + region : { + page : 0, + totalPage : 0 + }, + status : { + page : 0, + totalPage : 0 } } }; - angular.extend(this, $controller('autoCompleteController', {$scope : $scope, $injector : $injector})); @@ -59,6 +108,40 @@ $scope.vm.autoCompletePage.hostingField.totalPage = result.data.page.totalPage; } + // 湲곗뾽援щ텇 autocomplete page �뾽�뜲�씠�듃 + function getCompanyTypeListCallBack(result) { + $scope.vm.autoCompletePage.companyType.totalPage = result.data.page.totalPage; + } + + // �뾽醫�(��遺꾨쪟) autocomplete page �뾽�뜲�씠�듃 + function getParentSectorListCallBack(result, value) { + if (value === "") { + $scope.vm.form.parentSectorId = ""; + if ($rootScope.isDefined($scope.vm.form.parentSectors) && $rootScope.isDefined($scope.vm.form.parentSectors[0])) { + $scope.vm.form.parentSectors[0].id = ""; + } + $scope.vm.form.childSectorId = ""; + $scope.vm.form.childSector = ""; + $scope.vm.form.childSectors = []; + } + $scope.vm.autoCompletePage.parentSector.totalPage = result.data.page.totalPage; + } + + // �뾽醫�(以묐텇瑜�) 移댄뀒怨좊━ autocomplete page �뾽�뜲�씠�듃 + function getChildSectorListCallBack(result) { + $scope.vm.autoCompletePage.childSector.totalPage = result.data.page.totalPage; + } + + // 吏��뿭 移댄뀒怨좊━ autocomplete page �뾽�뜲�씠�듃 + function getRegionListCallBack(result) { + $scope.vm.autoCompletePage.region.totalPage = result.data.page.totalPage; + } + + // �긽�깭 移댄뀒怨좊━ autocomplete page �뾽�뜲�씠�듃 + function getStatusListCallBack(result) { + $scope.vm.autoCompletePage.status.totalPage = result.data.page.totalPage; + } + // �뤌 泥댄겕 function formCheck(formInvalid) { if (formInvalid) { @@ -67,23 +150,157 @@ return false; } + $scope.$on("ispFieldEvent", function (event, result) { + if ($rootScope.isDefined(result) && $rootScope.isDefined(result[0])) { + $scope.vm.form.ispId = result[0].id; + } + }); + + $scope.$on("hostingFieldEvent", function (event, result) { + if ($rootScope.isDefined(result) && $rootScope.isDefined(result[0])) { + $scope.vm.form.hostingId = result[0].id; + } + }); + + $scope.$on("companyTypeEvent", function (event, result) { + if ($rootScope.isDefined(result) && $rootScope.isDefined(result[0])) { + $scope.vm.form.companyTypeId = result[0].id; + } + }); + $scope.$on("parentSectorEvent", function (event, result) { + if ($rootScope.isDefined(result) && $rootScope.isDefined(result[0])) { + $scope.vm.form.parentSectorId = result[0].id; + } else { + $scope.vm.form.parentSectorId = ""; + if ($rootScope.isDefined($scope.vm.form.parentSectors) && $rootScope.isDefined($scope.vm.form.parentSectors[0])) { + $scope.vm.form.parentSectors[0].id = ""; + } + } + $scope.vm.form.childSectorId = ""; + $scope.vm.form.childSector = ""; + $scope.vm.form.childSectors = []; + }); + $scope.$on("childSectorEvent", function (event, result) { + if ($rootScope.isDefined(result) && $rootScope.isDefined(result[0])) { + $scope.vm.form.childSectorId = result[0].id; + } + }); + $scope.$on("regionEvent", function (event, result) { + if ($rootScope.isDefined(result) && $rootScope.isDefined(result[0])) { + $scope.vm.form.regionId = result[0].id; + } + }); + $scope.$on("statusEvent", function (event, result) { + if ($rootScope.isDefined(result) && $rootScope.isDefined(result[0])) { + $scope.vm.form.statusId = result[0].id; + } + }); + // �뤌 �쟾�넚 function formSubmit(condition) { $rootScope.spinner = true; 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 = null; + if ($scope.vm.form.issueIspFields != null) { + ispId = $scope.vm.form.ispId; + } + return ispId; + })(), + hostingId : (function () { // Hosting �븘�씠�뵒 + var hostingId = null; + 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, //�씠硫붿씪 - url : $scope.vm.form.url, // url - memo : $scope.vm.form.memo //鍮꾧퀬 + tels : (function () { + var telList = []; + if ($scope.vm.form.tels != null) { + angular.forEach($scope.vm.form.tels, function (tel) { + telList.push(tel); + }); + telList = telList.filter(function(item) { //�벐�젅湲� �뜲�씠�꽣 �븘�꽣留� + return item !== null && item !== undefined && item !== ''; + }); + telList = telList.filter(function(item, idx){ + return telList.findIndex(function(item2, idx2){ + return item === item2 + }) == idx; + }); + } + return telList; + })(), + emails : (function () { + var emailList = []; + if ($scope.vm.form.emails != null) { + angular.forEach($scope.vm.form.emails, function (email) { + emailList.push(email); + }); + emailList = emailList.filter(function(item) { //�벐�젅湲� �뜲�씠�꽣 �븘�꽣留� + return item !== null && item !== undefined && item !== ''; + }); + emailList = emailList.filter(function(item, idx){ + return emailList.findIndex(function(item2, idx2){ + return item === item2 + }) == idx; + }); + } + return emailList; + })(), + url : (function () { + // 紐⑤뱺 怨듬갚 �젣嫄� + var regex = / /gi; + let url = $scope.vm.form.url; + if ($rootScope.isDefined(url) && url.indexOf(" ") !== -1) { + url = url.replace(regex, ""); + } + return url; + })(), + ipStart : $scope.vm.form.ipStart, // ip�떆�옉二쇱냼 + ipEnd : $scope.vm.form.ipEnd, // ip醫낅즺二쇱냼 + memo : $scope.vm.form.memo, //鍮꾧퀬 + companyTypeId : (function () { + var companyTypeId = null; + if ($scope.vm.form.companyTypes != null && $scope.vm.form.companyTypes.length > 0) { + companyTypeId = $scope.vm.form.companyTypes[0].id; + } + return companyTypeId; + })(), + parentSectorId : (function () { + var parentSectorId = null; + if ($scope.vm.form.parentSectors != null && $scope.vm.form.parentSectors.length > 0) { + parentSectorId = $scope.vm.form.parentSectors[0].id; + } + return parentSectorId; + })(), + childSectorId : (function () { + var childSectorId = null; + if ($scope.vm.form.childSectors != null && $scope.vm.form.childSectors.length > 0) { + childSectorId = $scope.vm.form.childSectors[0].id; + } + return childSectorId; + })(), + regionId : (function () { + var regionId = null; + if ($scope.vm.form.regions != null && $scope.vm.form.regions.length > 0) { + regionId = $scope.vm.form.regions[0].id; + } + return regionId; + })(), + statusId : (function () { + var statusId = null; + if ($scope.vm.form.statuses != null && $scope.vm.form.statuses.length > 0) { + statusId = $scope.vm.form.statuses[0].id; + } else if ($scope.vm.form.status !== ""){ + statusId = 120; //吏곸젒�엯�젰 �씪 寃쎌슦 + } + return statusId; + })(), + statusName : $scope.vm.form.status }; CompanyField.add($resourceProvider.getContent(content, @@ -103,15 +320,61 @@ } + // �뿰�씫泥� input 李� 異붽� 踰꾪듉 + function addTel() { + var arrayFull = true; // 諛곗뿴�씠 媛��뱷 李� �엳�뒗吏� �뿬遺� + var index = 0; + $scope.vm.form.inputTels.forEach(function (tel) { + if (!$rootScope.isDefined($scope.vm.form.tels[index])) { + arrayFull = false; + } + index++; + }); + + if (arrayFull) { + $scope.vm.form.inputTels.push(index); + $scope.vm.form.tels[index] = ""; + } else { + SweetAlert.warning($filter("translate")("companyField.writeCompanyTel"), $filter("translate")("companyField.writeTel")); // 異붽�踰꾪듉 寃쎄퀬 + } + } + + // 硫붿씪 二쇱냼 input 李� 異붽� 踰꾪듉 + function addMail() { + var arrayFull = true; // 諛곗뿴�씠 媛��뱷 李� �엳�뒗吏� �뿬遺� + var index = 0; + $scope.vm.form.inputMails.forEach(function (email) { + if (!$rootScope.isDefined($scope.vm.form.emails[index])) { + arrayFull = false; + } + index++; + }); + + if (arrayFull) { + $scope.vm.form.inputMails.push(index); + $scope.vm.form.emails[index] = ""; + } else { + SweetAlert.warning($filter("translate")("issue.writeIssueMail"), $filter("translate")("issue.writeMail")); // 異붽�踰꾪듉 寃쎄퀬 + } + } + + // �뿰�씫泥� input �궘�젣 + function removeTelInput(index) { + $scope.vm.form.inputTels.splice(index, 1); + } + + // �씠硫붿씪 二쇱냼 input �궘�젣 + function removeMailInput(index) { + $scope.vm.form.inputMails.splice(index, 1); + } + // �뙘�뾽 李� �떕湲� function cancel() { $rootScope.$broadcast("closeLayer"); // �뙘�뾽�씠 �뿴由ш퀬 �굹�꽌 js-multi, js-single �벑�뿉�꽌 body �씠踰ㅽ듃媛� �궇�븘媛��뒗 �쁽�긽 �닔�젙 $uibModalInstance.dismiss('cancel'); $(document).unbind("keydown"); // �떒異뺥궎 �씠踰ㅽ듃 �젣嫄� } - } - ]); } ); \ No newline at end of file -- Gitblit v1.8.0