From add0cdefd56c50c5427945c895574f71202e7ed6 Mon Sep 17 00:00:00 2001
From: minhee <alsdldlfrl@gmail.com>
Date: 수, 16 3월 2022 18:12:51 +0900
Subject: [PATCH] - api로 이슈 추가 시 사용자정의필드 타입으로 체크 => 정규식표현검사로 체크로 변경

---
 src/main/webapp/scripts/app/companyField/companyFieldModify.controller.js |  119 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 114 insertions(+), 5 deletions(-)

diff --git a/src/main/webapp/scripts/app/companyField/companyFieldModify.controller.js b/src/main/webapp/scripts/app/companyField/companyFieldModify.controller.js
index de4a45f..0a71bb4 100644
--- a/src/main/webapp/scripts/app/companyField/companyFieldModify.controller.js
+++ b/src/main/webapp/scripts/app/companyField/companyFieldModify.controller.js
@@ -25,8 +25,10 @@
                     getStatusListCallBack : getStatusListCallBack,
                     addTel : addTel,
                     addMail : addMail,
+                    addIpRange : addIpRange,
                     removeTelInput : removeTelInput,
-                    removeMailInput : removeMailInput
+                    removeMailInput : removeMailInput,
+                    removeIpRangeInput : removeIpRangeInput
                 };
 
                 $scope.vm = {
@@ -55,9 +57,13 @@
                         statusId : "",
                         status : "", //�긽�깭
                         inputTels : [0],
-                        tels : {},
+                        tels : [],
                         inputMails : [0],
-                        emails : {}
+                        emails : [],
+                        inputIpStarts : [0], //ip �떆�옉�젏
+                        ipStarts : [],
+                        inputIpEnds : [0], //ip 醫낅즺�젏
+                        ipEnds : []
                     },
                     typeCategory : {
                         companyType : "COMPANYTYPE",
@@ -270,8 +276,30 @@
                             }
                             return url;
                         })(),
-                        ipStart : $scope.vm.form.ipStart, // ip�떆�옉二쇱냼
-                        ipEnd : $scope.vm.form.ipEnd, // ip醫낅즺二쇱냼
+                        ipStarts : (function () {
+                            var ipStarts = [];
+                            if ($scope.vm.form.ipStarts != null) {
+                                angular.forEach($scope.vm.form.ipStarts, function (ipS) {
+                                    ipStarts.push(ipS);
+                                });
+                                ipStarts  = ipStarts.filter(function(item) { //�벐�젅湲� �뜲�씠�꽣 �븘�꽣留�
+                                    return item !== null && item !== undefined && item !== '';
+                                });
+                            }
+                            return ipStarts;
+                        })(),
+                        ipEnds : (function () {
+                            var ipEnds = [];
+                            if ($scope.vm.form.ipEnds != null) {
+                                angular.forEach($scope.vm.form.ipEnds, function (ipE) {
+                                    ipEnds.push(ipE);
+                                });
+                                ipEnds  = ipEnds.filter(function(item) { //�벐�젅湲� �뜲�씠�꽣 �븘�꽣留�
+                                    return item !== null && item !== undefined && item !== '';
+                                });
+                            }
+                            return ipEnds;
+                        })(),
                         memo : $scope.vm.form.memo,
                         companyTypeId : (function () {
                             var companyTypeId = null;
@@ -377,14 +405,53 @@
                     }
                 }
 
+                // IPRange input 李� 異붽� 踰꾪듉
+                function addIpRange() {
+                    var arrayFull = true;      // 諛곗뿴�씠 媛��뱷 李� �엳�뒗吏� �뿬遺�
+                    var startIdx = 0;
+                    var endIdx = 0;
+                    $scope.vm.form.inputIpStarts.forEach(function (start) {
+                        if (!$rootScope.isDefined($scope.vm.form.ipStarts[startIdx])) {
+                            arrayFull = false;
+                        }
+                        startIdx++;
+                    });
+
+                    $scope.vm.form.inputIpEnds.forEach(function (start) {
+                        if (!$rootScope.isDefined($scope.vm.form.ipEnds[endIdx])) {
+                            arrayFull = false;
+                        }
+                        endIdx++;
+                    });
+
+                    if (arrayFull) {
+                        $scope.vm.form.inputIpStarts.push(startIdx);
+                        $scope.vm.form.ipStarts[startIdx] = "";
+                        $scope.vm.form.inputIpEnds.push(endIdx);
+                        $scope.vm.form.ipEnds[endIdx] = "";
+                    } else {
+                        SweetAlert.warning($filter("translate")("companyField.writeCompanyIpRange"), $filter("translate")("companyField.writeIpRange")); // 異붽�踰꾪듉 寃쎄퀬
+                    }
+                }
+
                 // �뿰�씫泥� input �궘�젣
                 function removeTelInput(index) {
                     $scope.vm.form.inputTels.splice(index, 1);
+                    $scope.vm.form.tels.splice(index, 1);
                 }
 
                 // �씠硫붿씪 二쇱냼 input �궘�젣
                 function removeMailInput(index) {
                     $scope.vm.form.inputMails.splice(index, 1);
+                    $scope.vm.form.emails.splice(index, 1);
+                }
+
+                // ipRange input �궘�젣
+                function removeIpRangeInput(index) {
+                    $scope.vm.form.inputIpStarts.splice(index, 1);
+                    $scope.vm.form.ipStarts.splice(index, 1);
+                    $scope.vm.form.inputIpEnds.splice(index, 1);
+                    $scope.vm.form.ipEnds.splice(index, 1);
                 }
 
                 //  �뙘�뾽 李� �떕湲�
@@ -453,6 +520,48 @@
                                     $scope.vm.form.emails = angular.copy(inputMails);
                                 }
 
+                                if (result.data.content.ipStart != null) {
+                                    var inputIpStarts = $scope.vm.form.inputIpStarts;
+                                    var ipStarts = result.data.content.ipStart
+                                    if (result.data.content.ipStart.indexOf("[") !== -1){
+                                        ipStarts = result.data.content.ipStart.substr(1, result.data.content.ipStart.indexOf("]")-1);
+                                    }
+                                    var ipStartArr = ipStarts.split(",");
+                                    angular.forEach(ipStartArr, function (ipS) {
+                                        var ipStart = ipS.trim();
+                                        inputIpStarts.push(ipStart);
+                                    });
+                                    inputIpStarts = inputIpStarts.filter(function(item) {
+                                        return item !== null && item !== undefined && item !== '';
+                                    });
+                                    if(inputIpStarts[0] === 0 || inputIpStarts[0] === "") { // 泥ル쾲吏� 諛곗뿴�� 怨듬갚�쑝濡�
+                                        inputIpStarts.shift();
+                                    }
+                                    inputIpStarts.push("");
+                                    $scope.vm.form.ipStarts = angular.copy(inputIpStarts);
+                                }
+
+                                if (result.data.content.ipEnd != null) {
+                                    var inputIpEnds = $scope.vm.form.inputIpEnds;
+                                    var ipEnds = result.data.content.ipEnd
+                                    if (result.data.content.ipEnd.indexOf("[") !== -1){
+                                        ipEnds = result.data.content.ipEnd.substr(1, result.data.content.ipEnd.indexOf("]")-1);
+                                    }
+                                    var ipEndArr = ipEnds.split(",");
+                                    angular.forEach(ipEndArr, function (ipS) {
+                                        var ipEnd = ipS.trim();
+                                        inputIpEnds.push(ipEnd);
+                                    });
+                                    inputIpEnds = inputIpEnds.filter(function(item) {
+                                        return item !== null && item !== undefined && item !== '';
+                                    });
+                                    if(inputIpEnds[0] === 0 || inputIpEnds[0] === "") { // 泥ル쾲吏� 諛곗뿴�� 怨듬갚�쑝濡�
+                                        inputIpEnds.shift();
+                                    }
+                                    inputIpEnds.push("");
+                                    $scope.vm.form.ipEnds = angular.copy(inputIpEnds);
+                                }
+
                                 $scope.vm.form.url = result.data.content.url;
                                 $scope.vm.form.ipStart = result.data.content.ipStart;
                                 $scope.vm.form.ipEnd = result.data.content.ipEnd;

--
Gitblit v1.8.0