OWL ITS + 탐지시스템(인터넷 진흥원)
jhjang
2021-10-14 b74776268dd3eb2bc57744928d6f7150ffcd4ec2
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
'use strict';
 
define(['app'],
    function (app) {
        app.directive('jsInformation', ["$rootScope", "$log", "SystemEmail", "$resourceProvider", "SweetAlert", "$filter",
            function ($rootScope, $log, SystemEmail, $resourceProvider, SweetAlert, $filter) {
                return {
                    restrict : 'E',
                    scope : {},
                    templateUrl : 'custom_components/js-information/js-information.html',
                    link : function ($scope, $element, $attrs) {
 
                        $scope.fn = {
                            formSubmit : formSubmit,    //  폼 전송
                            formCheck : formCheck,  //  폼 체크
                            initForm : initForm //  폼 초기화
                        };
 
                        $scope.vm = {
                            form : {
                                email : "", //  이메일
                                description : ""    //  내용
                            }
                        };
 
                        //  폼 체크
                        function formCheck(formInvalid) {
                            if (formInvalid) {
                                return true;
                            }
 
                            return false;
                        }
 
                        //  폼 전송
                        function formSubmit() {
                            $rootScope.spinner = true;
                            $rootScope.information = false;
 
                            SystemEmail.information($resourceProvider.getContent(
                                $scope.vm.form,
                                $resourceProvider.getPageContent(0, 0))).then(function (result) {
 
                                if (result.data.message.status === "success") {
                                    SweetAlert.success($filter("translate")("inquiry.contactCompleted"), $filter("translate")("inquiry.asap"));
                                }
                                else {
                                    SweetAlert.error($filter("translate")("inquiry.failedToReceiveEnquiry"), result.data.message.message);
                                }
 
                                $rootScope.spinner = false;
                            });
 
                        }
 
                        //  폼 초기화
                        function initForm() {
                            if ($rootScope.isDefined($rootScope.user)) {
                                $scope.vm.form.email = $rootScope.user.account;
                            }
                            else {
                                $scope.vm.form.email = "";
                            }
 
                            $scope.vm.form.description = "";
 
                            $rootScope.information = !$rootScope.information;
                        }
 
                    }
                };
            }])
    });