PageSourceSearch

https://www.imglobal.com/ResourcePackages/IMG/MyIMGWidgets/apps/Ce…?package=IMG&version=2026-9-23-15-10-4

js imglobal.com collected 2026-09-25 02:39:36 UTC 11,566 bytes, 222 lines download raw bytes

1
2(function () {
3    'use strict';
4    var globalScope = {};
5
6    var app = angular.module("certificates", ['ui.grid', 'ui.grid.resizeColumns', 'ui.bootstrap', 'loading', 'ngSanitize']);
7    //service to display active certificate
8    app.factory("certificatesList", ['$uibModal', function ($uibModal) {
9        return {
10            get: function (callback, isNeedOnlyCertificate) {
11                $uibModal.open({
12                    controller: 'CertificateModalController',
13                    templateUrl: '/ResourcePackages/IMG/MyImgWidgets/apps/Certificates/base.html',
14                    size: 'lg'
15                });
16                globalScope.callbackFunction = callback;
17                globalScope.isNeedOnlyCertificate = isNeedOnlyCertificate;
18            }
19        }
20    }
21    ]);
22
23    //App config
24    app.config([
25        "$httpProvider", function ($httpProvider) {
26            var _widgetGlobal = getTokenCookie();
27            //if no common headers, create new common headers object
28            if (!$httpProvider.defaults.headers.common)
29                $httpProvider.defaults.headers.common = {};
30
31            $httpProvider.defaults.headers.common.WebApiToken = _widgetGlobal.WebApiToken;
32        }
33    ]);
34
35    app.controller('CertificateModalController', ['$scope', '$uibModalInstance', '$http', 'loadingModal', function ($scope, $uibModalInstance, $http, loadingModal) {
36        var _widgetGlobal = getTokenCookie();
37        $scope.IsDisabledCancelCertificate = false;
38
39        $scope.activeCertificate = {};
40        $scope.activeInsured = {};
41
42        //insured data 
43        $scope.gridOptionsCertificates = {};
44        $scope.myData = [];
45
46
47        //insured name
48        var user = _widgetGlobal.CurrentUserName;
49
50        var modal;
51        // Open modal when doc is ready
52        angular.element(document).ready(function () {
53            modal = loadingModal.open("Loading...", jQuery("#Certificates-modal-container-1"));
54        });
55
56        //Get insured data
57        $http.get(_widgetGlobal.WebApiHost + "active/certificate/").then(function (result) {
58
59            if (result.data.CertificateNumber) {
60
61                $scope.CertificateAppScopeProvider.gridRowClick({ entity: result.data });
62
63            } else {
64
65            }
66
67            $http.get(_widgetGlobal.WebApiHost + "certificates/list/").then(function (result) {
68                // Close modal when doc is ready
69                angular.element(document).ready(function () {
70                    loadingModal.close(modal, jQuery("#Certificates-modal-container-1"));
71                });
72
73                $scope.gridOptionsCertificates.data = result.data.certificates;
74
75                $scope.isGroup = result.data.isGroupPerson;
76
77                //boolen value, for indicate to show or hide change certificate button
78                localStorage.setItem('IsMoreThanOneCertificate', result.data.IsMoreThanOneCertificate);
79
80                WidgetGridResize();
81            });
82        });
83
84
85        $scope.CertificateAppScopeProvider = {
86            gridRowClick: function (row) {
87                $scope.activeCertificate = row.entity;
88                $scope.activeCertificate.UserName = user;
89                $scope.activeCertificate.IsMoreThanOneCertificate = localStorage.getItem('IsMoreThanOneCertificate');
90                $scope.isCertificateSelected = true;
91
92                //save certificate in session
93                $http.post(_widgetGlobal.WebApiHost + "certificates/item", $scope.activeCertificate).then(function (result) {
94                    if (result.data.isSuccess) {
95
96                        //if page that request this modal view need only active certificate , after selecting invoke callback function
97                        if (globalScope.isNeedOnlyCertificate) {
98                            $uibModalInstance.close();
99                            globalScope.callbackFunction($scope.activeCertificate, $scope.activeInsured);
100                        }
101
102                        //Automatically go to next tab
103                        $('.nav-tabs li:eq(1) a').tab('show');
104                        WidgetGridResize();
105
106                        var modal;
107                        // Open modal when doc is ready
108                        angular.element(document).ready(function () {
109                            modal = loadingModal.open("Loading...", jQuery("#Certificates-modal-container-2"));
110                        });
111
112                        //Load insureds grid
113                        $http.get(_widgetGlobal.WebApiHost + "certificates/Insureds/" + $scope.activeCertificate.CertificateNumber + "/" + $scope.activeCertificate.CertificateSequenceNumber).then(function (result) {
114                            $scope.gridOptionsInsureds.data = result.data;
115
116                            // Close modal when doc is ready
117                            angular.element(document).ready(function () {
118                                loadingModal.close(modal, jQuery("#Certificates-modal-container-2"));
119                            });
120
121                            WidgetGridResize();
122                        });
123
124                        //On error:
125                    } else {
126                        $uibModalInstance.close();
127                        alert("Sorry, but we can't set active certificate due server error, please contact to MyIMG!");
128                    }
129
130                });
131            }
132        }
133
134        //certificates grid define
135        $scope.gridOptionsCertificates = {
136            columnDefs: [
137                { field: 'CertificateNumber', displayName: 'Certificate Number', cellTemplate: '<div class="ui-grid-cell-contents"  data-label="Certificate Number"><div class="primary"><span>{{row.entity.CertificateNumber}}</span></div ></div>' },
138                { field: 'CertificateProductName', displayName: 'Product Name', cellTemplate: '<div class="ui-grid-cell-contents"  data-label="Product Name"><div class="primary"><span>{{row.entity.CertificateProductName}}</span></div ></div>' },
139                { field: 'CertificateEffectiveDate', displayName: 'Effective Date', cellTemplate: '<div class="ui-grid-cell-contents"  data-label="Effective Date"><div class="primary"><span>{{row.entity.CertificateEffectiveDate}}</span></div ></div>' },
140                { field: 'CertificateExpirationDate', displayName: 'Expiration Date', cellTemplate: '<div class="ui-grid-cell-contents"  data-label="Expiration Date"><div class="primary"><span>{{row.entity.CertificateExpirationDate}}</span></div ></div>' },
141                { field: 'PrimaryInsuredId', visible: false },
142                { field: 'CertificateSequenceNumber', visible: false },
143                { field: 'GroupId', visible: false }
144            ],
145            rowTemplate: "<div ng-click=\"grid.appScope.gridRowClick(row)\" ng-repeat=\"(colRenderIndex, col) in colContainer.renderedColumns track by col.colDef.name\" class=\"ui-grid-cell\" ng-class=\"{ 'ui-grid-row-header-cell': col.isRowHeader }\" ui-grid-cell></div>",
146            appScopeProvider: $scope.CertificateAppScopeProvider
147        };
148
149
150        //Insureds Grid define
151        $scope.InsuredAppScopeProvider = {
152            gridRowClick: function (row) {
153                $scope.activeInsured = row.entity;
154                $scope.activeInsured.UserName = user;
155
156                var modal;
157                // Open modal when doc is ready
158                angular.element(document).ready(function () {
159                    modal = loadingModal.open("Loading...", jQuery("#Certificates-modal-container-2"));
160                });
161
162                $http.post(_widgetGlobal.WebApiHost + "certificates/Insureds", $scope.activeInsured).then(function (result) {
163                    if (result.data.isSuccess) {
164                        //close modal
165                        $uibModalInstance.close();
166                        // Close modal when doc is ready
167                        angular.element(document).ready(function () {
168                            loadingModal.close(modal, jQuery("#Certificates-modal-container-2"));
169                        });
170
171                        globalScope.callbackFunction($scope.activeCertificate, $scope.activeInsured);
172
173                    } else {
174
175                        $uibModalInstance.close();
176                        // Close modal when doc is ready
177                        angular.element(document).ready(function () {
178                            loadingModal.close(modal, jQuery("#Certificates-modal-container-2"));
179                        });
180                        alert("Sorry, but we can't set active insured due server error, please contact to MyIMG!");
181                    }
182
183                });
184            }
185        }
186
187        $scope.gridOptionsInsureds = {
188            columnDefs: [
189            { name: 'Name', field: "PersonName", cellTemplate: '<div class="ui-grid-cell-contents"  data-label="Name"><div class="primary"><span>{{row.entity.PersonName}}</span></div ></div>' },
190            { name: 'Certificate', field: "CertificateNumber", width: 150, cellTemplate: '<div class="ui-grid-cell-contents"  data-label="Certificate"><div class="primary"><span>{{row.entity.CertificateNumber}}</span></div ></div>' },
191            { name: 'Effective Date', field: "InsuredCertificateEffectiveDate", width: 150, cellTemplate: '<div class="ui-grid-cell-contents"  data-label="Effective Date"><div class="primary"><span>{{row.entity.InsuredCertificateEffectiveDate}}</span></div ></div>' },
192            { name: 'Expiration Date', field: "InsuredCertificateExpirationDate", width: 150, cellTemplate: '<div class="ui-grid-cell-contents"  data-label="Expiration Date"><div class="primary"><span>{{row.entity.InsuredCertificateExpirationDate}}</span></div ></div>' },
193            { name: 'Gender', field: "gender", width: 100, cellTemplate: '<div class="ui-grid-cell-contents"  data-label="Gender"><div class="primary"><span>{{row.entity.gender}}</span></div ></div>' },
194            { name: 'Date of Birth', field: "DateOfBirth", width: 150, cellTemplate: '<div class="ui-grid-cell-contents"  data-label="Date of Birth"><div class="primary"><span>{{row.entity.DateOfBirth}}</span></div ></div>' },
195            { field: "InsuredId", visible: false }],
196            appScopeProvider: $scope.InsuredAppScopeProvider,
197            rowTemplate: "<div ng-click=\"grid.appScope.gridRowClick(row)\" ng-repeat=\"(colRenderIndex, col) in colContainer.renderedColumns track by col.colDef.name\" class=\"ui-grid-cell\" ng-class=\"{ 'ui-grid-row-header-cell': col.isRowHeader }\" ui-grid-cell></div>"
198        }
199
200        $scope.RefreshGrid = function () {
201            setTimeout(function () { WidgetGridResize(); }, 1000);
202        }
203
204        $scope.cancel = function () {
205            //Check active certificate
206            $http.get(_widgetGlobal.WebApiHost + "active/certificate/").then(function (result) {
207                $scope.IsDisabledCancelCertificate = true;
208
209                if (result.data.CertificateNumber) {
210                    console.log(result.data.CertificateNumber);
211                    $uibModalInstance.dismiss('cancel');
212                } else {
213                    console.log("cancel clicked");
214                    $uibModalInstance.dismiss('cancel');
215                    window.history.back();
216                }
217
218            });
219        }
220
221    }]);
222})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.