From a75bcc7c2b0fc98bd3a8abc100a4ad4ec11b9c26 Mon Sep 17 00:00:00 2001
From: wyu <kknd09321@nate.com>
Date: 화, 28 12월 2021 15:54:35 +0900
Subject: [PATCH] Merge branch 'master' of http://192.168.0.25:9001/r/owl-kisa

---
 src/main/webapp/scripts/app/common/common.controller.js |   45 ++++++++++++++++++++++-----------------------
 1 files changed, 22 insertions(+), 23 deletions(-)

diff --git a/src/main/webapp/scripts/app/common/common.controller.js b/src/main/webapp/scripts/app/common/common.controller.js
index 4c12bea..3ca4ae2 100644
--- a/src/main/webapp/scripts/app/common/common.controller.js
+++ b/src/main/webapp/scripts/app/common/common.controller.js
@@ -36,8 +36,6 @@
                     }
                 };
 
-
-
                 //  �떆�뒪�뀥�뿉�꽌 �듅�젙 �씠�뒋濡� 諛붾줈 �씠�룞�븷 �닔 �엳�룄濡� �빐以��떎.
                 $scope.$on("makeIssueSearch", function (event, args) {
                     //  �씠�뒋 踰덊샇瑜� ���옣�븳 �썑 �씠�뒋 紐⑸줉�쑝濡� �씠�룞�븳�떎.
@@ -60,15 +58,22 @@
                     //}
                 });
 
+                $rootScope.$on("$stateChangeStart", function (event, toState, toStateParams) {
+                    var keyWord = $rootScope.getCookie("searchKeyword");
+
+                    if (keyWord == null || keyWord === '') {
+                        $scope.vm.searchAll.keyWord = "";
+                    }
+                });
+
                 // 硫붿씤 �긽�떒 寃��깋
                 function searchAll() {
-                    $rootScope.isMainSearch = true;
-
-                    if ($state.current.name !== "issues.list" || $state.current.name === "issues.list") {
-                        $state.go("issues.list");
+                    if ($rootScope.isDefined($scope.vm.searchAll.keyWord)) {
+                        $rootScope.setCookie("searchKeyword", $scope.vm.searchAll.keyWord, 60000);
+                        moveMenu("issues.list");
+                    } else {
+                        SweetAlert.warning($filter("translate")("common.alertSystem"), $filter("translate")("issue.pleaseEnterIssueKeyWord"));
                     }
-
-                    $scope.$broadcast("searchIssueList", {keyWord: $scope.vm.searchAll.keyWord});
                 }
 
                 function setLastIssueType() {
@@ -108,8 +113,6 @@
                     if ($rootScope.user.lastIssueTypeId !== issueTypeId) {
                         $scope.fn.setLastIssueType(issueTypeId);
                     }
-
-
                 }
 
                 function moveMenu(stateName) {
@@ -202,9 +205,9 @@
                                     }
 
                                     var id = $rootScope.workProject.id === -1 ? null : $rootScope.workProject.id;
-                                    $scope.fn.findIssueList(id);
                                 }
                                 $rootScope.projects = datas;
+                                $scope.fn.findIssueList(id);
                             }
 
                             if ($rootScope.user.lastProjectId == null) {
@@ -259,6 +262,10 @@
 
                 // �씠�뒋 �쑀�삎 紐⑸줉 媛��졇�삤湲�
                function findIssueList(projectId) {
+
+                    if ($rootScope.projects == null || $rootScope.projects.length <= 1)
+                        return;
+
                    //  �씠�뒋 ���엯 紐⑸줉 寃��깋 議곌굔�쓣 留뚮뱺�떎.
                    var conditions = {
                        projectId : projectId > -1 ? projectId : null,
@@ -274,23 +281,15 @@
                            if ($rootScope.workIssueTypes != null && $rootScope.workIssueTypes.length > 0) {
                                $rootScope.workIssueTypes.forEach(function (issueType) {
 
-                                   var selectIssueTypeId = null;
+                                   //var selectIssueTypeId = null;
                                    if (issueType.id === $rootScope.user.lastIssueTypeId) {
-                                       selectIssueTypeId = issueType.id;
+                                       //selectIssueTypeId = issueType.id;
                                        $scope.fn.changeIssueListMenu(issueType.id, false);
-                                       // $state.go('dashboards.dashboard');
-                                   }
-
-                                   if (selectIssueTypeId == null) {
-                                       $scope.fn.changeIssueListMenu($rootScope.workIssueTypes[0].id, false);
-
+                                       // �씠�뒋紐⑸줉 �깉濡쒓퀬移� 紐⑸줉 媛깆떊
+                                       $scope.$broadcast("findIssueListOK", { myIssueType : issueType} );
                                    }
                                });
                            }
-                           // ���돩蹂대뱶濡� 媛��뒗�뜲 �봽濡쒖젥�듃瑜� �깮�꽦�븯嫄곕굹 �닔�젙�빐�룄 嫄몃━�뒗 議곌굔�씠�떎.
-                           // else {
-                           //     $state.go('dashboards.dashboard');
-                           // }
                        }
                        else {
                            SweetAlert.error($filter("translate")("managementType.failedToIssueTypeList"), result.data.message.message); // "�씠�뒋 �쑀�삎 紐⑸줉 議고쉶 �떎�뙣"

--
Gitblit v1.8.0