PageSourceSearch

https://www1.mhusa.com/app/spa/mhevent/mhEventListCtrl.js

js mhusa.com collected 2026-10-03 23:35:19 UTC 11,128 bytes, 300 lines download raw bytes

1(function (app) {
2    'use strict';
3
4    app.controller("MHEventListCtrl", MHEventListCtrl);
5
6    MHEventListCtrl.$inject = ["$rootScope", "$scope", "$location", "$uibModal", "mhEventListService", "notificationService"];
7
8    function MHEventListCtrl($rootScope, $scope, $location, $uibModal, mhEventListService, notificationService) {
9
10        //initialization
11        $scope.page = 1;
12        $scope.pagesCount = 0;
13        $scope.pagesSize = 20;
14        $scope.totalCount = 0;
15
16        //Filters
17        $scope.filter = {
18            BrandId: [],
19            EventRegistrationId: [],
20            UserListId: []
21        };
22
23        $scope.onCopiedSuccess = function (e) {
24
25            notificationService.displayInfo("Event URL Copied");
26
27            e.clearSelection();
28        };
29
30
31        //1. Event Filter
32        $scope.filterEventStatusAllModel = [];
33        $scope.filterEventStatusAllData = [];
34        $scope.filterEventStatusAllSettings = { enableSearch: false, showSelectAll: true, keyboardControls: true, scrollableHeight: "200px", scrollable: true, buttonClasses: "btn btn-sm btn-thin-filter btn-block", displayProp: "name", externalIdProp: "id" };
35        $scope.filterEventStatusAllTranslationTexts = { buttonDefaultText: "Choose Status", dynamicButtonTextSuffix: "All Status" };
36
37        $scope.onEventStatusSelectionChanged = function () {
38            applyHeatFilter();
39            $('#drp_btn_statussearch').find('button').html('All Status <span class="caret"></span>');
40        };
41
42        var FetchActualEventStatusList = function () {
43            $scope.loadingAssets = true;
44            mhEventListService.getEventStatuses().then(function (d) {
45                $scope.filterEventStatusAllData = d;
46                $scope.loadingAssets = false;
47            });
48        }
49
50        //2. Brand Filter
51        $scope.filterBrandAllModel = [];
52        $scope.filterBrandAllData = [];
53        $scope.filterBrandAllSettings = { enableSearch: true, showSelectAll: true, keyboardControls: true, scrollableHeight: "300px", scrollable: true, buttonClasses: "btn btn-sm btn-thin-filter btn-block", displayProp: "LookupItemName", externalIdProp: "id" };
54        $scope.filterBrandAllTranslationTexts = { buttonDefaultText: "Choose Brand", dynamicButtonTextSuffix: "All Brands" };
55
56        $scope.onBrandSelectionChanged = function () {
57            applyHeatFilter();
58            $('#drp_btn_brandsearch').find('button').html('All Brands <span class="caret"></span>');
59        };
60
61        var FetchActualBrandList = function () {
62            $scope.loadingAssets = true;
63            mhEventListService.fetchEventListFilter("Brand").then(function (d) {
64                $scope.filterBrandAllData = d;
65                $scope.loadingAssets = false;
66            });
67        }
68
69        //3. Author Filter
70        $scope.filterAuthorAllModel = [];
71        $scope.filterAuthorAllData = [];
72        $scope.filterAuthorAllSettings = { enableSearch: true, showSelectAll: true, keyboardControls: true, scrollableHeight: "300px", scrollable: true, buttonClasses: "btn btn-sm btn-thin-filter btn-block", displayProp: "LookupItemName", externalIdProp: "id" };
73        $scope.filterAuthorAllTranslationTexts = { buttonDefaultText: "Choose Author", dynamicButtonTextSuffix: "All Author" };
74
75        $scope.onAuthorSelectionChanged = function () {
76            applyHeatFilter();
77            $('#drp_btn_authorsearch').find('button').html('All Author <span class="caret"></span>');
78        };
79        var FetchAllAuthorList = function () {
80            $scope.loadingAssets = true;
81            mhEventListService.fetchEventListFilter("Author").then(function (d) {
82                $scope.filterAuthorAllData = d;
83                $scope.loadingAssets = false;
84            });
85        }
86
87        //paremeters
88        var getNacParams = function () {
89
90            var heatbrand = $scope.filterBrandAllModel.map(function (h) { return h.id });
91            var eventstatus = $scope.filterEventStatusAllModel.map(function (s) { return s.id });
92            var Author = $scope.filterAuthorAllModel.map(function (a) { return a.id });
93
94            var params = {
95                PageIndex: $scope.page, PageSize: $scope.pagesSize
96                , Sorting: "", SortDirection: "Asc"
97                , BrandID: heatbrand
98                , EventStatusID: eventstatus
99                , SearchText: $scope.searchText.EventTitle
100                , CreatedById: Author
101                //, IsDeleted: true
102            }
103
104            return params;
105        };
106
107        //Main data call
108        var FetchAllEventHeatList = function () {
109
110            $scope.loadingHeat = true;
111            var params = getNacParams();
112            $scope.HeatEventList = null;
113            mhEventListService.FetchEventHeatList(params).then(function (d) {
114                if (d !== "") {
115                    $scope.HeatEventList = d.Items;
116                    $scope.page = d.Page;
117                    $scope.pagesCount = d.TotalPages;
118                    $scope.totalCount = d.TotalCount;
119                } else {
120                    $scope.HeatEventList = null;
121                    $scope.page = 1;
122                    $scope.pagesCount = 0;
123                    $scope.totalCount = 0;
124                }
125                $scope.loadingHeat = false;
126            });
127
128        }
129
130
131        $scope.pageClick = function () {
132            FetchAllEventHeatList();
133        };
134
135
136        var searchDirty = false;
137        $scope.searchText = "";
138       
139        $scope.searchEvent = function () {
140            applyHeatFilter();
141        };
142
143        $scope.fetchAll = function () {
144            if ($scope.searchText.EventTitle === "") {
145                applyHeatFilter();
146            }
147        };
148
149        var applyHeatFilter = function () {
150            $scope.page = 1;
151            loadHeats();
152
153        }
154
155        var loadHeats = function () {
156            FetchAllEventHeatList();
157        }
158
159        var init = function () {
160            if (!$rootScope.repository.loggedUser) {
161                $location.url('/');
162            }
163            else {
164                var isMHEventUser = $rootScope.isMHEventUser($rootScope.repository.loggedUser.user.Id);
165                if (isMHEventUser) {                    
166                } else {
167                    alert("Sorry! you don't have access to this page!");
168                    $location.url('/');
169                }
170            }
171        }
172
173        var initFilters = function () {
174
175            FetchActualEventStatusList();
176            FetchActualBrandList();
177            FetchAllAuthorList();
178
179            FetchAllEventHeatList();
180        }
181
182        //load event;
183        init();
184        initFilters();
185
186
187        //$scope.viewAttendeesList = function (event) {
188        //    $location.path('/mhevents/mheventregistration/' + event.EventID);
189        //}
190
191        //$scope.editEventDetail = function (event) {
192
193        //    $location.path('/mhevents/createevent/' + event.EventID);
194
195        //}
196
197        //$scope.createEvent = function (event) {
198        //    $location.path("/createevent");
199        //}
200
201        //$scope.goToEventregistration = function (event) {
202
203        //    if (event.uniqueURL !== null && event.UniqueUrl !== "") {
204        //        $location.path('+ event.Brand +'/eventregistration/' + event.UniqueUrl);
205
206        //    }
207        //    else {
208
209        //        $rootScope.$broadcast("request:unauthorized", {});
210        //        notificationService.displayError("Authentication required.");
211        //    }
212        //}
213
214
215        $scope.exportToExcel = function () {
216
217            if ($scope.HeatEventList && $scope.HeatEventList.length > 0) {
218                $scope.downloadingAssets = true;
219                $scope.page = 1;
220                var params = getNacParams();
221                mhEventListService.downloadEventList(params).then(function (response) {
222                    $scope.downloadingAssets = false;
223                }, function (err) {
224                    $scope.downloadingAssets = false;
225                    notificationService.displayError("Error occurred while exporting file.Try again later.");
226                });
227            } else {
228                notificationService.displayInfo("No records are available to export.");
229            }
230
231        }
232
233        $scope.exportToExcelAttendee = function (EventID) {
234            $scope.downloadingAssets = true;
235            $scope.page = 1;
236            var parmID = {
237                PageIndex: $scope.page, PageSize: $scope.pagesSize
238                , Sorting: '', SortDirection: 'Asc', EventId: EventID
239            };
240            mhEventListService.downloadEventAttendeeList(parmID).then(function (response) {
241                if (response.success === "NoDataFound") {
242                    notificationService.displayInfo('No attendees found for this Event!');
243                    $scope.downloadingAssets = false;
244                } else {
245                    mhEventListService.downloadEventRegAttendeeList(response).then(function (res) {
246                        notificationService.displaySuccess('File downloaded successfully!');
247                        $scope.downloadingAssets = false;
248                    });
249                }
250            }, function (err) {
251                $scope.downloadingAssets = false;
252                notificationService.displayError("Error occurred while exporting file.Try again later.");
253            });
254        };
255
256        //delete
257        $scope.deleteEvent = function (event) {
258
259            if (confirm('Are you sure to delete "' + event.EventTitle + '" ?')) {
260                $scope.downloading = true;
261                mhEventListService.remove(event.EventID).then(function () {
262                    notificationService.displaySuccess("Event deleted.");
263                    var eventId = event.EventID;
264                    $rootScope.$broadcast("event:deleted", {});
265                    $scope.downloading = false;
266                    $scope.collection = null;
267
268                    FetchAllEventHeatList();
269
270                }, function (error) {
271                    notificationService.displayError("Error occured deleting event.Try again later.");
272                    $scope.downloading = false;
273                });
274            }
275        }
276
277        //modal
278        $scope.uploadAttendees = function (event) {
279
280            var modalInstance = $uibModal.open({
281                animation: true,
282                templateUrl: "app/spa/mhevent/uploadAttendees.html",
283                controller: "uploadAttendeesCtrl",
284                size: "lg",
285                resolve: {
286                    items: function () {
287                        return {
288                            event: event
289                        };
290                    }
291                }
292
293            });
294        }
295
296
297    }
298
299
300})(angular.module("distPortal"));

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.