From 3b019e5599dfb5d368f4e8fd50fb557f4679a645 Mon Sep 17 00:00:00 2001 From: 이민희 <mhlee@maprex.co.kr> Date: 수, 12 1월 2022 15:19:58 +0900 Subject: [PATCH] 업체/isp/호스팅 기능 개편 --- src/main/webapp/scripts/app/hostingField/hostingFieldModify.controller.js | 135 ++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 128 insertions(+), 7 deletions(-) diff --git a/src/main/webapp/scripts/app/hostingField/hostingFieldModify.controller.js b/src/main/webapp/scripts/app/hostingField/hostingFieldModify.controller.js index b643107..edd8f2a 100644 --- a/src/main/webapp/scripts/app/hostingField/hostingFieldModify.controller.js +++ b/src/main/webapp/scripts/app/hostingField/hostingFieldModify.controller.js @@ -15,7 +15,11 @@ detail : detail, // �긽�꽭 議고쉶 cancel : cancel, // �뙘�뾽 李� �떕湲� formSubmit : formSubmit, // �뤌 �쟾�넚 - formCheck : formCheck // �뤌 泥댄겕 + formCheck : formCheck, // �뤌 泥댄겕 + addTel : addTel, + addMail : addMail, + removeTelInput : removeTelInput, + removeMailInput : removeMailInput }; $scope.vm = { @@ -27,7 +31,11 @@ tel : "", //�쟾�솕踰덊샇 email : "", //�씠硫붿씪 url : "", // url - memo : "" //硫붾え(鍮꾧퀬) + memo : "", //硫붾え(鍮꾧퀬) + inputTels : [0], + tels : {}, + inputMails : [0], + emails : {} } }; @@ -49,8 +57,40 @@ code : $rootScope.preventXss($scope.vm.form.code), name : $rootScope.preventXss($scope.vm.form.name), manager : $rootScope.preventXss($scope.vm.form.manager), - tel : $rootScope.preventXss($scope.vm.form.tel), - email : $rootScope.preventXss($scope.vm.form.email), + 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 : $rootScope.preventXss($scope.vm.form.url), // url memo : $rootScope.preventXss($scope.vm.form.memo) }; @@ -74,6 +114,54 @@ } + // 硫붿씪 二쇱냼 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 �씠踰ㅽ듃媛� �궇�븘媛��뒗 �쁽�긽 �닔�젙 @@ -94,12 +182,45 @@ $resourceProvider.getPageContent(0, 1))).then(function (result) { if (result.data.message.status === "success") { - if (angular.isDefined(result.data.content)) { + if (result.data.content != null) { $scope.vm.form.code = result.data.content.code; $scope.vm.form.name = result.data.content.name; $scope.vm.form.manager = result.data.content.manager; - $scope.vm.form.email = result.data.content.email; - $scope.vm.form.tel = result.data.content.tel; + + if (result.data.content.tel != null) { + var inputTels = $scope.vm.form.inputTels; + var tels = result.data.content.tel.substr(1, result.data.content.tel.indexOf("]")-1); + var telArr = tels.split(", "); + angular.forEach(telArr, function (tel) { + inputTels.push(tel); + }); + inputTels = inputTels.filter(function(item) { + return item !== null && item !== undefined && item !== ''; + }); + if (inputTels[0] === 0 || inputTels[0] === "") { + inputTels.shift(); + } + inputTels.push(""); + $scope.vm.form.tels = angular.copy(inputTels); + } + + if (result.data.content.email != null) { + var inputMails = $scope.vm.form.inputMails; + var emails = result.data.content.email.substr(1, result.data.content.email.indexOf("]")-1); + var emailArr = emails.split(", "); + angular.forEach(emailArr, function (email) { + inputMails.push(email); + }); + inputMails = inputMails.filter(function(item) { + return item !== null && item !== undefined && item !== ''; + }); + if(inputMails[0] === 0 || inputMails[0] === "") { // 泥ル쾲吏� 諛곗뿴�� 怨듬갚�쑝濡� + inputMails.shift(); + } + inputMails.push(""); + $scope.vm.form.emails = angular.copy(inputMails); + } + $scope.vm.form.url = result.data.content.url; $scope.vm.form.memo = result.data.content.memo; } -- Gitblit v1.8.0