From 7476ad22442c349f0751709957fee068d463980a Mon Sep 17 00:00:00 2001
From: wyu <kknd09321@nate.com>
Date: 수, 01 12월 2021 20:44:51 +0900
Subject: [PATCH] 이슈 수정 오류 및 메일 보내기 템플릿 이미지 추가

---
 src/main/webapp/scripts/app/issue/issueDetail.controller.js |  204 ++++++++++++++++++++++++++++++++------------------
 1 files changed, 131 insertions(+), 73 deletions(-)

diff --git a/src/main/webapp/scripts/app/issue/issueDetail.controller.js b/src/main/webapp/scripts/app/issue/issueDetail.controller.js
index cb2300e..9a44c3c 100644
--- a/src/main/webapp/scripts/app/issue/issueDetail.controller.js
+++ b/src/main/webapp/scripts/app/issue/issueDetail.controller.js
@@ -9,8 +9,8 @@
     ],
     function (app, angular) {
         app.controller('issueDetailController', ['$scope', '$rootScope', '$log', '$resourceProvider', '$tableProvider', '$state', '$uibModal', '$q',
-            '$controller', '$injector', 'SweetAlert', '$timeout', 'Issue', 'IssueComment', 'IssueRelation', 'AttachedFile',  'Priority', 'Severity','IssueStatus', 'HostingField', 'IssueTableConfig', '$filter',
-            function ($scope, $rootScope, $log, $resourceProvider, $tableProvider, $state, $uibModal, $q, $controller, $injector, SweetAlert, $timeout, Issue, IssueComment, IssueRelation, AttachedFile, Priority, Severity, IssueStatus, HostingField, IssueTableConfig, $filter) {
+            '$controller', '$injector', 'SweetAlert', '$timeout', 'Issue', 'IssueComment', 'IssueRelation', 'AttachedFile',  'Priority', 'Severity','IssueStatus', 'IssueTableConfig', '$filter',
+            function ($scope, $rootScope, $log, $resourceProvider, $tableProvider, $state, $uibModal, $q, $controller, $injector, SweetAlert, $timeout, Issue, IssueComment, IssueRelation, AttachedFile, Priority, Severity, IssueStatus, IssueTableConfig, $filter) {
 
                 //  IssueListController vm, fn 蹂��닔 �긽�냽.
 
@@ -31,7 +31,12 @@
                 $scope.fn.modifyIssueUser = modifyIssueUser;    //  �씠�뒋 �떞�떦�옄 蹂�寃�
                 $scope.fn.modifyIssueDepartment = modifyIssueDepartment;    //  �씠�뒋 �떞�떦遺��꽌 蹂�寃�
                 $scope.fn.initReload = initReload;  //  珥덇린�솕 �빐�빞�븷 �븷紐⑹쓣 吏��젙�븯�뿬 �떎瑜� �씠�뒋瑜� �겢由��븷 �븣 珥덇린�솕�빐以��떎.
-                $scope.fn.sendMail = sendMail;  //  �듅�젙 �궗�슜�옄�뿉寃� �씠�뒋 �젙蹂대�� 硫붿씪濡� 諛쒖넚
+                $scope.fn.sendMail = sendMail;
+                $scope.fn.sendMailAll = sendMailAll;
+                $scope.fn.sendMailVo = sendMailVo;
+                $scope.fn.getParameters = getParameters;
+                $scope.fn.getParametersAll = getParametersAll;
+                //  �듅�젙 �궗�슜�옄�뿉寃� �씠�뒋 �젙蹂대�� 硫붿씪濡� 諛쒖넚
                 $scope.fn.versionView = versionView;    //  踰꾩쟾 �젙蹂대�� �몴�떆�븳�떎.
                 $scope.fn.reservation = reservation;    //  �삁�빟 �젙蹂대�� �솗�씤 諛� 蹂�寃� �븳�떎.
                 $scope.fn.getIssueListCallBack = getIssueListCallBack;
@@ -42,10 +47,10 @@
                 $scope.fn.getRelTableConfigs = getRelTableConfigs;
                 $scope.fn.getDownTableConfigs = getDownTableConfigs;
                 $scope.fn.containsPartner = containsPartner;
-                $scope.fn.getPartners = getPartners;
+                $scope.fn.onActivate = onActivate;
 
                 //  �씠�뒋 紐⑸줉 而⑦듃濡ㅻ윭 vm, fn �긽�냽 以�
-                $scope.vm.viewer = [];
+                $scope.vm.viewer = {};
                 $scope.vm.images = [];  //  泥⑤��맂 �뙆�씪 以� �씠誘몄� �뙆�씪
                 $scope.vm.activeTab = "ALL";    //  �솢�룞 �궡�뿭 �꺆
                 //  �씠�뒋 �긽�깭 蹂�寃� �몴�떆 �뿬遺�
@@ -72,7 +77,10 @@
 
                 $scope.vm.form = {
                     issues : [], //�뿰愿� �씪媛�
-                    issuesDown : []  // �븯�쐞 �씪媛�
+                    issuesDown : [],  // �븯�쐞 �씪媛�
+                    issueCompanyVos : [],
+                    issueIspVos : [],
+                    issueHostingVos : []
                 };
 
 
@@ -86,6 +94,7 @@
 
                 $scope.vm.issueName = "";       // �꽑�깮�맂 �뿰愿� �씪媛� �씠由�
                 $scope.vm.issueId = "";       //
+                $scope.vm.issueTypeId = "";
                 $scope.vm.autoCompletePage = {
                     issue : {
                         page : 0,
@@ -111,11 +120,23 @@
 
                 function changeDetailView(issue) {
                     //  �씠�뒋 踰덊샇瑜� ���옣�븳 �썑 �씠�뒋 紐⑸줉�쑝濡� �씠�룞�븳�떎.
-                    // $rootScope.$broadcast("makeIssueSearch", issue);
+                    //$rootScope.$broadcast("makeIssueSearch",issue);
                     $scope.$parent.tableEvent.changeDetailView(issue.id);
+                    $scope.fn.onActivate();
+                }
+
+                function onActivate() {
+                    window.scroll(0,240);
                 }
 
                 angular.extend(this, $controller('autoCompleteController', {$scope : $scope, $injector : $injector}));
+
+                //  �씠�뒋 紐⑸줉 �뜲�씠�꽣 媛깆떊
+                $scope.$on("getIssueList", function () {
+                    $scope.fn.getIssueDetail();
+                });
+
+
 
                 // �븯�쐞 �씠�뒋 �궘�젣
                 function removeDownIssue(id) {
@@ -280,14 +301,6 @@
                                 .setDAlign("text-center")
                                 .setDName("modifyDate"));
                             break;
-                        // default :"ISSUE_RELATION_DELETE" //  �뿰愿� �궘�젣
-                        //     $scope.vm.relTableConfigs.push($tableProvider.config()
-                        //         .setHName("issue.downIssueTitle")
-                        //         .setDType("renderer")
-                        //         .setHWidth("bold" + issueTableConfig.width)
-                        //         .setHSort(false)
-                        //         .setDRenderer("ISSUE_RELATION_DELETE"));
-                        //     break;
                     }
 
                     //  �궗�슜�옄 �젙�쓽 �븘�뱶 而щ읆
@@ -582,9 +595,6 @@
                     });
                 }
 
-
-
-
                 // �뿰愿� �씠�뒋 異붽�
                 function addRelationIssue() {
                     if ($scope.vm.issueName.length == 0 || $scope.vm.form.issues.length == 0
@@ -641,25 +651,35 @@
                 }
 
                 //  �씠�뒋紐낆쓣 �겢由��븯硫� �씠�뒋 �긽�꽭 �젙蹂대�� 議고쉶�븳�떎.
-                $rootScope.$on("getIssueDetail", function (event, args) {
-                    $scope.vm.viewer.id = args["id"];
-                    $scope.fn.getIssueDetail();
-                });
+                // $rootScope.$on("getIssueDetail", function (event, args) {
+                //     $scope.vm.viewer.id = args["id"];
+                //     $scope.fn.getIssueDetail();
+                // });
 
                 //  �씠�뒋紐낆쓣 �겢由��븯硫� �씠�뒋 �긽�꽭 �젙蹂대�� 議고쉶�븳�떎.
-                $scope.$on("getIssueDetail", function (event, args) {
-                    $scope.vm.viewer.id = args["id"];
-                    $scope.fn.getIssueDetail();
-                });
+                // $scope.$on("getIssueDetail", function (event, args) {
+                //     $scope.vm.viewer.id = args["id"];
+                //     $scope.fn.getIssueDetail();
+                // });
+
+                $scope.$watch(function() {
+                    return $rootScope.currentDetailIssueId;
+                }, function() {
+                    if ($rootScope.currentDetailIssueId != null) {
+                        $scope.vm.viewer.id = $rootScope.currentDetailIssueId;
+                        $scope.fn.getIssueDetail();
+                    }
+                }, true);
 
                 //  珥덇린�솕 �빐�빞�븷 �븷紐⑹쓣 吏��젙�븯�뿬 �떎瑜� �씠�뒋瑜� �겢由��븷 �븣 珥덇린�솕�빐以��떎.
                 function initReload() {
                     $scope.vm.editor.issueStatus = false;
                     $scope.vm.issueForm.issueStatusList = [];
                     $scope.vm.issueForm.issueStatusId = "";
-                    /*if ($scope.$root.$$phase !== '$apply' && $scope.$root.$$phase !== '$digest') {
-                        $scope.$apply();
-                    }*/
+                    $scope.vm.issueTypeId = $rootScope.getCurrentIssueTypeId();
+                    // if ($scope.$root.$$phase !== '$apply' && $scope.$root.$$phase !== '$digest') {
+                    //     $scope.$apply();
+                    // }
                 }
 
                 //  �씠�뒋 �긽�깭 蹂�寃�
@@ -750,6 +770,7 @@
                                 return {
                                     issueTypeId : $scope.vm.viewer.issueTypeVo.id
                                 };
+
                             }
                         }
                     });
@@ -783,6 +804,21 @@
                     });
                 }
 
+                // �뾽泥�/ISP/�샇�뒪�똿 �씠由꾩씠 �룷�븿 �뿬遺� �솗�씤
+                function containsPartner(name) {
+                    var result = false;
+
+                    if ($scope.vm.viewer.usePartnerVos != null) {
+                        $scope.vm.viewer.usePartnerVos.forEach(function (partnerVo) {
+                            if (name === partnerVo.name) {
+                                result = true;
+                            }
+                        });
+                    }
+                    return result;
+
+                }
+
                 //  �씠�뒋 �긽�꽭 �젙蹂� 議고쉶
                 function getIssueDetail() {
                     //  珥덇린�솕 �빐�빞�븷 �븷紐⑹쓣 吏��젙�븯�뿬 �떎瑜� �씠�뒋瑜� �겢由��븷 �븣 珥덇린�솕�빐以��떎.
@@ -798,7 +834,6 @@
                         if (result.data.message.status === "success") {
                             if (angular.isDefined(result.data.data)) {
                                 $scope.vm.viewer = angular.copy(result.data.data);
-
                                 //  �씠�뒋 �씠誘몄� 誘몃━ 蹂닿린 留뚮뱾湲�
                                 $scope.fn.makePreviewImages(result.data.data.attachedFileVos);
                                 //  �솢�룞 �씠�젰 留뚮뱾湲�
@@ -820,18 +855,25 @@
                                 $scope.vm.form.issuesDown.push(result.data.data);
 
                                 // �뿰愿� �씠�뒋 諛섎났臾�
-                                angular.forEach(result.data.data.issueRelationVos, function (issueRelationVo){
-                                    issueRelationVo.relationIssueTypeName = $scope.vm.relationIssueTypes[issueRelationVo.relationIssueType].name;
-                                    $scope.vm.form.issues.push(issueRelationVo.issueRelation);
-                                });
+                                if (result.data.data.issueRelationVos !== null) {
+                                    angular.forEach(result.data.data.issueRelationVos, function (issueRelationVo){
+                                        issueRelationVo.relationIssueTypeName = $scope.vm.relationIssueTypes[issueRelationVo.relationIssueType].name;
+                                        $scope.vm.form.issues.push(issueRelationVo.issueRelation);
+                                    });
+                                }
 
                                 // �븯�쐞 �씠�뒋 諛섎ぉ臾�
-                                angular.forEach(result.data.data.issueDownVos, function (issueDownVo){
-                                    $scope.vm.form.issuesDown.push(issueDownVo.issue);
-                                });
-
+                                if (result.data.data.issueDownVos !== null){
+                                    angular.forEach(result.data.data.issueDownVos, function (issueDownVo){
+                                        $scope.vm.form.issuesDown.push(issueDownVo.issue);
+                                    });
+                                }
                                 $scope.vm.viewer.issueRelationVos = result.data.data.issueRelationVos;
                                 $scope.vm.viewer.issueDownVos = result.data.data.issueDownVos;
+
+                                if ($rootScope.workProject.id > -1) {
+                                    $rootScope.changeLastProject(result.data.data.projectVo.id);
+                                }
                             }
                         }
                         else {
@@ -840,25 +882,8 @@
                     });
                 }
 
-
                 // ===================================================================================
 
-                // �뾽泥�/ISP/�샇�뒪�똿 �씠由꾩씠 �룷�븿 �뿬遺� �솗�씤
-                function containsPartner(name) {
-                    var result = false;
-                    // �씪�떒 viewer瑜� 留⑥쐞�뿉 �꽑�뼵�빐 {} �씠�젃寃� �꽑�뼵�빐 �몢�뿀�뒗�뜲 媛믩뱾�씠 �뼱�뼡�떇�쑝濡� 蹂��솚�씠 �맟�뒗吏��뒗
-                    // 紐곕씪�꽌 諛곗뿴濡� �꽆�뼱���꽌 珥덇린媛믪쓣 諛곗뿴濡� 諛붽씀�뿀�뜑�땲 �씠�뒋 �긽�꽭�뿉�꽌�뒗 蹂댁씤�떎
-                    // �씠�젣 �씠�뒋 異붽��뿉�꽌 媛믪씠 �뼱�뼸寃� �꽆�뼱�삤�뒗吏� �솗�씤�빐蹂댁옄!
-                    if ($scope.vm.viewer.usePartnerVos != null) {
-                        $scope.vm.viewer.usePartnerVos.forEach(function (partnerVo) {
-                            if (name === partnerVo.name) {
-                                result = true;
-                            }
-                        });
-                    }
-                    return result;
-
-                }
                 //  �씠�뒋 �씠誘몄� 誘몃━ 蹂닿린 留뚮뱾湲�
                 function makePreviewImages(attachedFileVos) {
                     //  誘몃━蹂닿린 �씠誘몄� 珥덇린�솕
@@ -885,6 +910,12 @@
                         switch (issueTypeCustomField.customFieldVo.customFieldType) {
                             case "INPUT" :
                             case "SINGLE_SELECT" :
+                            case "NUMBER" :
+                            case "DATETIME" :
+                            case "IP_ADDRESS" :
+                            case "EMAIL" :
+                            case "SITE" :
+                            case "TEL" :
                                 issueTypeCustomField.useValues = "";
                                 break;
 
@@ -1035,34 +1066,62 @@
                     });
                 }
 
-                function getPartners() {
+                function sendMailVo(partnerVos) {
+                    $scope.fn.sendMail($scope.fn.getParametersAll(), $scope.fn.getParameters(null, partnerVos));
+                }
 
-                    HostingField.getPartnerList($resourceProvider.getContent(
-                        {},
-                        $resourceProvider.getPageContent(0, 1))).then(function (result) {
-                        if (result.data.message.status === "success") {
-                            $scope.vm.partnerVos = result.data.data.usePartnerVos;
-                        }
-                    });
-
+                function sendMailAll() {
+                    var param = $scope.fn.getParametersAll();
+                    $scope.fn.sendMail(param, param);
                 }
 
                 //  �듅�젙 �궗�슜�옄�뿉寃� �씠�뒋瑜� 硫붿씪濡� 諛쒖넚
-                function sendMail(issueId, projectId) {
+                function sendMail(partnersAll, partners) {
                     $uibModal.open({
-                        templateUrl : 'views/issue/issueSendMail.html',
+                        templateUrl : 'views/issue/issueSendMailPartners.html',
                         size : "md",
-                        controller : 'issueSendMailController',
+                        controller : 'issueSendMailPartnersController',
                         backdrop : 'static',
                         resolve : {
-                            parameter : function () {
-                                return {
-                                    issueId : issueId,
-                                    projectId : projectId
-                                };
+                            parameter : {
+                                partnersAll : partnersAll,
+                                partners : partners,
+                                issueId : $scope.vm.viewer.id,
+                                projectId : $scope.vm.viewer.projectVo.id,
+                                // companyVos : $scope.vm.viewer.issueCompanyVos,
+                                // ispVos : $scope.vm.viewer.issueIspVos,
+                                // hosingVos : $scope.vm.viewer.issueHostingVos,
                             }
                         }
                     });
+                }
+
+                function getParametersAll() {
+                    var params = $scope.fn.getParameters(null, $scope.vm.viewer.issueCompanyVos);
+                    params = $scope.fn.getParameters(params, $scope.vm.viewer.issueIspVos);
+                    params = $scope.fn.getParameters(params, $scope.vm.viewer.issueHostingVos);
+
+                    if (params != null && params.length > 0) {
+                        for (let i = 0; i < params.length; i++) {
+                            params[i].id = i;
+                        }
+                    }
+                    return params;
+                }
+
+                function getParameters(sourceArr, partnerVos) {
+                    var excludeVos = sourceArr != null ? sourceArr.slice() : [];
+
+                    angular.forEach(partnerVos, function (vo) {
+                        var account = {
+                            account : vo.email
+                        }
+                        Object.assign(vo, account)
+
+                        excludeVos.push(vo);
+                    });
+
+                    return excludeVos;
                 }
 
                 //  蹂�寃� �젙蹂대�� �솗�씤�븳�떎.
@@ -1098,7 +1157,6 @@
                         }
                     });
                 }
-
             }
         ]);
     }

--
Gitblit v1.8.0