From bdb1efdc604fce543e21152b4263a9362f64389f Mon Sep 17 00:00:00 2001
From: minhee <alsdldlfrl@gmail.com>
Date: 목, 10 3월 2022 15:35:19 +0900
Subject: [PATCH] - api 이슈 추가 시 입력한 ip에 속해있는 업체정보를 가진 이슈의 하위로 입력되도록 수정 - issue_company 테이블에 ip 컬럼 추가 및 이슈 추가/수정 시 ip 대역대 항목 추가

---
 src/main/webapp/scripts/app/issue/issueAddTableConfig.controller.js |  137 ++++++++++++++++++++++++++++++++-------------
 1 files changed, 97 insertions(+), 40 deletions(-)

diff --git a/src/main/webapp/scripts/app/issue/issueAddTableConfig.controller.js b/src/main/webapp/scripts/app/issue/issueAddTableConfig.controller.js
index 8f9eb74..95b70bc 100644
--- a/src/main/webapp/scripts/app/issue/issueAddTableConfig.controller.js
+++ b/src/main/webapp/scripts/app/issue/issueAddTableConfig.controller.js
@@ -8,20 +8,22 @@
         'angular'
     ],
     function (app, angular) {
-        app.controller('issueAddTableConfigController', ['$scope', '$rootScope', '$log', '$resourceProvider', '$uibModalInstance', 'SweetAlert', '$timeout', 'IssueTableConfig', 'IssueTypeCustomField', '$q', '$filter', 'parameter',
-            function ($scope, $rootScope, $log, $resourceProvider, $uibModalInstance, SweetAlert, $timeout, IssueTableConfig, IssueTypeCustomField, $q, $filter, parameter) {
+        app.controller('issueAddTableConfigController', ['$scope', '$rootScope', '$log', '$resourceProvider', '$uibModalInstance', 'SweetAlert', '$timeout', 'IssueTableConfig', 'Issue', 'IssueTypeCustomField', '$q', '$filter', 'parameter',
+            function ($scope, $rootScope, $log, $resourceProvider, $uibModalInstance, SweetAlert, $timeout, IssueTableConfig, Issue, IssueTypeCustomField, $q, $filter, parameter) {
 
                 //  �븿�닔 紐⑥쓬
                 $scope.fn = {
                     cancel : cancel,    //  �뙘�뾽 李� �떕湲�
                     formSubmit : formSubmit,    //  �뤌 �쟾�넚
                     formCheck : formCheck,  //  �뤌 泥댄겕
+                    getUsePartner : getUsePartner,
                     getCustomFields : getCustomFields,   //  �궗�슜�옄 �젙�쓽 �븘�뱶 紐⑸줉�쓣 媛��졇�삩�떎.
                     getIssueAddTableConfigs : getIssueAddTableConfigs //  �씠�뒋 紐⑸줉 �뀒�씠釉� �꽕�젙 �젙蹂대�� 媛��졇�삩�떎.
                 };
 
                 //  蹂��닔 紐⑥쓬
                 $scope.vm = {
+                    allIssue : parameter.allIssue,
                     issueTableConfigs : [{
                         name : $filter("translate")("issue.issueTitle"), // �씠�뒋 �젣紐�
                         key : "ISSUE_TITLE",
@@ -85,7 +87,6 @@
                         position : 8,
                         display : false,
                         checkboxShow : true
-                    }, {
                     }]
                 };
 
@@ -104,7 +105,15 @@
                     $rootScope.spinner = true;
 
                     var content = {
-                        issueTypeId : $rootScope.getCurrentIssueTypeId(),
+                        issueTypeId : (function () {
+                            var id = "";
+                            if ($rootScope.allIssueList) {
+                                id = -1;
+                            } else {
+                                id = $rootScope.getCurrentIssueTypeId();
+                            }
+                            return id;
+                        })(),
                         issueTableConfigs : JSON.stringify($scope.vm.issueTableConfigs)
                     };
 
@@ -114,15 +123,14 @@
                         if (result.data.message.status === "success") {
                             SweetAlert.success($filter("translate")("issue.completedSavingIssueTable"), $filter("translate")("issue.saveIssueTableSettingsInformation")); // "�씠�뒋 �뀒�씠釉� �꽕�젙 ���옣 �셿猷�", "�씠�뒋 �뀒�씠釉� �꽕�젙 �젙蹂닿� ���옣�릺�뿀�뒿�땲�떎."
 
-                            //  蹂�寃쎈맂 �씠�뒋 �뀒�씠釉� �젙蹂대�� �씠�뒋 紐⑸줉 �뀒�씠釉붿뿉 媛깆떊�븳�떎.
-                            swal.close();
+                            //swal.close();
                             $scope.fn.cancel();
+                            //  蹂�寃쎈맂 �씠�뒋 �뀒�씠釉� �젙蹂대�� �씠�뒋 紐⑸줉 �뀒�씠釉붿뿉 媛깆떊�븳�떎.
                             $rootScope.$broadcast("getIssueTableConfigs", {});
                         }
                         else {
                             SweetAlert.error($filter("translate")("issue.failedToSaveIssueTableSetting"), result.data.message.message); // �씠�뒋 �뀒�씠釉� �꽕�젙 ���옣 �떎�뙣
                         }
-
                         $rootScope.spinner = false;
                     });
                 }
@@ -133,6 +141,24 @@
                     $rootScope.$broadcast("closeLayer");    //  �뙘�뾽�씠 �뿴由ш퀬 �굹�꽌 js-multi, js-single �벑�뿉�꽌 body �씠踰ㅽ듃媛� �궇�븘媛��뒗 �쁽�긽 �닔�젙
                     $uibModalInstance.dismiss('cancel');
                     $(document).unbind("keydown");  //  �떒異뺥궎 �씠踰ㅽ듃 �젣嫄�
+                }
+
+                //  �씠�뒋�쑀�삎 蹂� �뙆�듃�꼫 紐⑸줉
+                function getUsePartner() {
+                    var deferred = $q.defer();
+                    $scope.vm.partners = [];
+
+                    Issue.findPartners($resourceProvider.getContent({issueTypeId : $rootScope.getCurrentIssueTypeId()},
+                        $resourceProvider.getPageContent(0, 1))).then(function (result) {
+                        if (result.data.message.status === "success") {
+                            $scope.vm.partnerVos = result.data.data;
+                        }
+                        else {
+                            SweetAlert.swal($filter("translate")("issue.failedToPartnerListLookup"), result.data.message.message, "error"); // �뙆�듃�꼫 紐⑸줉 議고쉶 �떎�뙣
+                        }
+                        deferred.resolve(result.data.data);
+                    });
+                    return deferred.promise;
                 }
 
                 //  �궗�슜�옄 �젙�쓽 �븘�뱶 紐⑸줉�쓣 媛��졇�삩�떎.
@@ -152,9 +178,17 @@
                 }
 
                 var content = {
-                    delValue : $scope.vm.issueTableConfigs.splice(9,1),
+                    //delValue : $scope.vm.issueTableConfigs.splice(12,1),
                     issueTableConfigs : JSON.stringify($scope.vm.issueTableConfigs),
-                    issueTypeId : $rootScope.getCurrentIssueTypeId()
+                    issueTypeId : (function () {
+                        var id = "";
+                        if ($rootScope.allIssueList) {
+                            id = -1;
+                        } else {
+                            id = $rootScope.getCurrentIssueTypeId();
+                        }
+                        return id;
+                    })()
                 };
                 //  �씠�뒋 紐⑸줉 �뀒�씠釉� �꽕�젙 �젙蹂대�� 媛��졇�삩�떎.
                 function getIssueAddTableConfigs() {
@@ -179,46 +213,69 @@
                     return deferred.promise;
                 }
 
-                //  �궗�슜�옄 �젙�쓽 �븘�뱶瑜� 議고쉶�븳 �썑 �몴�떆�븷 �씠�뒋 �뀒�씠釉� 而щ읆�쓣 以�鍮꾪븳�떎.
-                $scope.fn.getCustomFields().then(function (result) {
-                    var count = 10;
-                    angular.forEach(result, function (customField) {
+                //  �뙆�듃�꼫瑜� 議고쉶�븳 �썑 �몴�떆�븷 �씠�뒋 �뀒�씠釉� 而щ읆�쓣 以�鍮꾪븳�떎.
+                $scope.fn.getUsePartner().then(function (result) {
+                    let count = 9;
+                    angular.forEach(result, function (partner) {
                         $scope.vm.issueTableConfigs.push({
-                            name : customField.name,
-                            key : "CUSTOM_FIELD_" + customField.id,
+                            name : partner.name,
+                            key : (function () {
+                                var key = "";
+                                if (partner.name === "�뾽泥�") {
+                                    key = "COMPANY";
+                                } else if(partner.name === "ISP") {
+                                    key = "ISP";
+                                } else {
+                                    key = "HOSTING";
+                                }
+                                return key;
+                            })(),
                             width : "width-100-p",
                             display : false,
                             checkboxShow : true,
                             position : count
                         });
-
-                        count++;
+                        count ++;
                     });
-
-                    //  �씠�뒋 紐⑸줉 �뀒�씠釉� �꽕�젙 �젙蹂대�� 媛��졇�삩�떎.
-                    $scope.fn.getIssueAddTableConfigs().then(function (issueTableConfigs) {
-                        if ($rootScope.isDefined(issueTableConfigs)) {
-                            $rootScope.spinner = true;
-
-                            var saveTableConfigs = JSON.parse(issueTableConfigs);
-
-                            angular.forEach(saveTableConfigs, function (saveTableConfig) {
-
-                                for (var count in $scope.vm.issueTableConfigs) {
-                                    var issueTableConfig = $scope.vm.issueTableConfigs[count];
-
-                                    if (issueTableConfig.key === saveTableConfig.key) {
-                                        issueTableConfig.display = saveTableConfig.display;
-                                        issueTableConfig.width = saveTableConfig.width;
-                                        issueTableConfig.position = saveTableConfig.position;
-                                        break;
-                                    }
-                                }
+                    //  �궗�슜�옄 �젙�쓽 �븘�뱶瑜� 議고쉶�븳 �썑 �몴�떆�븷 �씠�뒋 �뀒�씠釉� 而щ읆�쓣 以�鍮꾪븳�떎.
+                    $scope.fn.getCustomFields().then(function (result) {
+                        angular.forEach(result, function (customField) {
+                            $scope.vm.issueTableConfigs.push({
+                                name : customField.name,
+                                key : "CUSTOM_FIELD_" + customField.id,
+                                width : "width-100-p",
+                                display : false,
+                                checkboxShow : true,
+                                position : count
                             });
+                            count++;
+                        });
 
-                            $rootScope.spinner = false;
-                        }
-                    });
+                        //  �씠�뒋 紐⑸줉 �뀒�씠釉� �꽕�젙 �젙蹂대�� 媛��졇�삩�떎.
+                        $scope.fn.getIssueAddTableConfigs().then(function (issueTableConfigs) {
+                            if ($rootScope.isDefined(issueTableConfigs)) {
+                                $rootScope.spinner = true;
+
+                                var saveTableConfigs = JSON.parse(issueTableConfigs);
+
+                                angular.forEach(saveTableConfigs, function (saveTableConfig) {
+
+                                    for (var count in $scope.vm.issueTableConfigs) {
+                                        var issueTableConfig = $scope.vm.issueTableConfigs[count];
+
+                                        if (issueTableConfig.key === saveTableConfig.key) {
+                                            issueTableConfig.display = saveTableConfig.display;
+                                            issueTableConfig.width = saveTableConfig.width;
+                                            issueTableConfig.position = parseInt(saveTableConfig.position);
+                                            break;
+                                        }
+                                    }
+                                });
+
+                                $rootScope.spinner = false;
+                            }
+                        });
+                    })
                 });
 
             }]);

--
Gitblit v1.8.0