From fb08399e35f7b90c9c5ef9781af10569be85f9ca Mon Sep 17 00:00:00 2001
From: 이민희 <mhlee@maprex.co.kr>
Date: 월, 14 2월 2022 16:08:44 +0900
Subject: [PATCH] - 사용자정의필드 기본값 입력시 모든 오류 메세지가 표시되는 문제 해결

---
 src/main/webapp/scripts/app/customField/customFieldModify.controller.js |   64 ++++++++++++++++++++++++++++---
 1 files changed, 57 insertions(+), 7 deletions(-)

diff --git a/src/main/webapp/scripts/app/customField/customFieldModify.controller.js b/src/main/webapp/scripts/app/customField/customFieldModify.controller.js
index 56362b5..1231f23 100644
--- a/src/main/webapp/scripts/app/customField/customFieldModify.controller.js
+++ b/src/main/webapp/scripts/app/customField/customFieldModify.controller.js
@@ -30,11 +30,23 @@
                     form : {
                         id : parameter.id,
                         name : "",
-                        customFieldType : "",    //  �궗�슜�옄 �젙�쓽 �븘�뱶 �쑀�삎
+                        customFieldType : "INPUT",    //  �궗�슜�옄 �젙�쓽 �븘�뱶 �쑀�삎
                         defaultValue : "",  //  湲곕낯 媛�
+                        defaultNumValue : "",  //  湲곕낯 媛� (�닽�옄)
+                        defaultDateValue : "",  //  湲곕낯 媛� (�궇吏�)
+                        defaultIpValue : "",  //  湲곕낯 媛� (IP)
+                        defaultEmailValue : "",  //  湲곕낯 媛� (�씠硫붿씪)
+                        defaultTelValue : "",  //  湲곕낯 媛� (�뿰�씫泥�)
+                        defaultSiteValue : "",  //  湲곕낯 媛� (URL)
                         options : [],  //  �샃�뀡
                         optionText : "",   //  �샃�뀡 媛�
-                        useCustomFieldValue : false //  �씠�뒋�뿉�꽌 �궗�슜�릺怨� �엳�뒗吏� �뿬遺� �솗�씤
+                        useCustomFieldValue : false, //  �씠�뒋�뿉�꽌 �궗�슜�릺怨� �엳�뒗吏� �뿬遺� �솗�씤
+                        numberType : "",
+                        ipAddress : "",
+                        email : "",
+                        site : "",
+                        tel : "",
+                        requiredData: ""
                     },
                     origin : {
                         options : []    //  �샃�뀡 媛� 蹂�寃� �뿬遺� �솗�씤�쓣 �쐞�빐 �꽌踰꾩뿉�꽌 �궡�젮�삱 �븣 �썝蹂� 媛믪쓣 �뵲濡� 愿�由ы븳�떎.
@@ -43,7 +55,14 @@
 
                 //  �궗�슜�옄 �젙�쓽 �븘�뱶 �쑀�삎�씠 蹂�寃쎈맆 �븣 湲곕낯 媛� 珥덇린�솕
                 function changeCustomFieldType() {
+                    //$scope.vm.form.name = "";
                     $scope.vm.form.defaultValue = "";
+                    $scope.vm.form.defaultNumValue = "";
+                    $scope.vm.form.defaultDateValue = "";
+                    $scope.vm.form.defaultIpValue = "";
+                    $scope.vm.form.defaultEmailValue = "";
+                    $scope.vm.form.defaultTelValue = "";
+                    $scope.vm.form.defaultSiteValue = "";
                 }
 
                 //  �샃�뀡 �궘�젣
@@ -93,6 +112,7 @@
                     if ($scope.vm.form.customFieldType === "INPUT") {
                         return;
                     }
+                    // $scope.vm.form.customFieldType == "NUMBER" 議댁옱�븳�떎
 
                     var duplication = false;
                     //  �빐�떆 �깭洹몃뒗 �엯�젰 湲덉� - 怨듬갚 移섑솚
@@ -136,7 +156,7 @@
                     }
 
                     //  �떎以�, �떒�씪 �꽑�깮�씪 寃쎌슦�뿉
-                    if ($scope.vm.form.customFieldType !== "INPUT") {
+                    if ($scope.vm.form.customFieldType === "MULTI_SELECT" || $scope.vm.form.customFieldType === "SINGLE_SELECT") {
                         //  �샃�뀡�씠 1媛� �씠�븯�씪 寃쎌슦�뿉�뒗 ���젆�듃 �깭洹몃�� 留뚮뱾 �닔 �뾾�떎.
                         if ($scope.vm.form.options.length < 1) {
                             return true;
@@ -150,10 +170,16 @@
                 function formSubmit() {
                     $rootScope.spinner = true;
 
-                    var content = angular.copy($scope.vm.form);
-                    content.name = $rootScope.preventXss(content.name);
+                     var content = angular.copy($scope.vm.form);
+                     content.name = $rootScope.preventXss(content.name);
+                     content.numberType =$scope.vm.form.numberType;
+                     content.ipAdress = $scope.vm.form.ipAdress;
+                     content.email = $scope.vm.form.email;
+                     content.site = $scope.vm.form.site;
+                     content.tel = $scope.vm.form.tel;
+                     content.requiredData = $scope.vm.form.requiredData;
 
-                    if ($scope.vm.form.customFieldType !== 'INPUT') {
+                    if ($scope.vm.form.customFieldType === 'MULTI_SELECT'|| $scope.vm.form.customFieldType === "SINGLE_SELECT") {
                         var convertDefaultValues = "";
 
                         angular.forEach(content.defaultValue.split("#"), function (value) {
@@ -203,9 +229,33 @@
                             if (angular.isDefined(result.data.data)) {
                                 $scope.vm.form.name = result.data.data.name;
                                 $scope.vm.form.customFieldType = result.data.data.customFieldType;
-                                $scope.vm.form.defaultValue = result.data.data.defaultValue;
+
+                                let type = $scope.vm.form.customFieldType;
+
+                                if (type === "INPUT" || type === "SINGLE_SELECT" || type === "MULTI_SELECT") {
+                                    $scope.vm.form.defaultValue = result.data.data.defaultValue;
+                                } else if (type === "NUMBER") {
+                                    $scope.vm.form.defaultNumValue = result.data.data.defaultValue;
+                                } else if (type === "DATETIME") {
+                                    $scope.vm.form.defaultDateValue = result.data.data.defaultValue;
+                                } else if (type === "IP_ADDRESS") {
+                                    $scope.vm.form.defaultIpValue = result.data.data.defaultValue;
+                                } else if (type === "EMAIL") {
+                                    $scope.vm.form.defaultEmailValue = result.data.data.defaultValue;
+                                } else if (type === "SITE") {
+                                    $scope.vm.form.defaultSiteValue = result.data.data.defaultValue;
+                                } else if (type === "TEL") {
+                                    $scope.vm.form.defaultTelValue = result.data.data.defaultValue;
+                                }
+
                                 $scope.vm.form.useCustomFieldValue = result.data.data.useCustomFieldValue;
 
+                                if(result.data.data.requiredData === "Y"){
+                                    $scope.vm.form.requiredData = true;
+                                } else {
+                                    $scope.vm.form.requiredData = false;
+                                }
+
                                 angular.forEach(result.data.data.customFieldValueVos, function (customFieldValueVo) {
                                     $scope.vm.form.options.push(customFieldValueVo.value);
                                 });

--
Gitblit v1.8.0