OWL ITS + 탐지시스템(인터넷 진흥원)
이민희
2022-03-02 20d2fc7868921587e7a0aafd0dc00690507bb6e9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/**
 * Created by wisestone on 2017-12-15.
 */
'use strict';
 
define([
        'app',
        'angular'
    ],
    function (app, angular) {
        app.controller('issueCompanyFieldDetailController', ['$scope', '$rootScope', '$log', '$resourceProvider', '$uibModalInstance', '$uibModal', '$injector',
            '$controller', '$tableProvider', 'SweetAlert', '$timeout', '$stateParams', '$q', 'Issue', 'CompanyField', 'User', 'AttachedFile', 'IssueType', 'Priority', 'Severity', 'IssueTypeCustomField', '$filter', '$state',
            function ($scope, $rootScope, $log, $resourceProvider, $uibModalInstance, $uibModal,  $injector, $controller, $tableProvider, SweetAlert, $timeout,
                      $stateParams, $q, Issue, CompanyField, User, AttachedFile, IssueType, Priority, Severity, IssueTypeCustomField, $filter, $state) {
 
                $scope.fn = {
                    cancel : cancel,    //  팝업 창 닫기
                    formSubmit : formSubmit,    //  폼 전송
                    formCheck : formCheck,  //  폼 체크
                };
 
                $scope.vm = {
                    form : {
                        companyName : "",
                        companyManager : "",
                        companyTel : "",
                        companyEmail : "",
                        companyDesc : ""
                    }
                };
 
                function formCheck(formInvalid) {
                    if (formInvalid) {
                        return true;
                    }
 
                    return false;
                }
 
                //  폼 전송
                function formSubmit() {
                    $rootScope.spinner = true;
 
                    var content = {
                        companyName :  $rootScope.preventXss($scope.vm.form.companyName),
                        companyManager : $rootScope.preventXss($scope.vm.form.companyManager),
                        companyTel : $rootScope.preventXss($scope.vm.form.companyTel),
                        companyEmail : $rootScope.preventXss($scope.vm.form.companyEmail),
                        companyDesc :  $rootScope.preventXss($scope.vm.form.companyDesc)
                    };
 
                    CompanyField.modify($resourceProvider.getContent(
                        content,
                        $resourceProvider.getPageContent(0, 0))).then(function (result) {
 
                        if (result.data.message.status === "success") {
                            $scope.fn.cancel();
 
                            //  목록 화면 갱신
                            $rootScope.$broadcast("getPageList", {});
                        }
                        else {
                            SweetAlert.error($filter("translate")("companyField.failedCompanyFieldRegistration"), result.data.message.message); //업체 등록 실패
                        }
 
                        $rootScope.spinner = false;
                    });
 
                }
 
                //  팝업 창 닫기
                function cancel() {
                    $rootScope.$broadcast("closeLayer");    //  팝업이 열리고 나서 js-multi, js-single 등에서 body 이벤트가 날아가는 현상 수정
                    $uibModalInstance.dismiss('cancel');
                    $(document).unbind("keydown");  //  단축키 이벤트 제거
                }
            }]);
    });