2 * ================================================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ================================================================================
24 class notificationHistoryCtrl {
25 constructor( $scope, $log,notificationService, confirmBoxService, $modal, ngDialog, $state) {
27 var priorityItems={"1":"Normal","2":"Important"};
28 $scope.priorityItems=priorityItems;
29 $scope.externalNotification="External System";
30 $scope.isLoadingTable = false;
31 $scope.searchString = '';
32 $scope.notificationHistory = [];
33 let getNotificationHistory = () => {
34 $scope.isLoadingTable = true;
35 notificationService.getNotificationHistory().then(res => {
36 $scope.notificationHistory = res.data;
37 $scope.isLoadingTable = false;
39 $log.error('notificationHistoryCtlr:notifSvc.getNotifHist failed: ', err);
40 $scope.isLoadingTable = false;
44 getNotificationHistory();
46 $scope.showDetailedJsonMessage=function (selectedAdminNotification) {
47 notificationService.getMessageRecipients(selectedAdminNotification.notificationId).then(res =>{
48 $scope.messageRecipients = res;
49 var messageObject=JSON.parse(selectedAdminNotification.msgDescription);
51 html+='<p>'+'Message Source'+' : '+selectedAdminNotification.msgSource+'</p>';
52 html+='<p>'+'Message Title'+' : '+selectedAdminNotification.msgHeader+'</p>';
53 html+='<p>'+'Message Recipient'+' : '+$scope.messageRecipients+'</p>';
55 for(var field in messageObject){
56 if(field=='eventDate'||field=='lastModifiedDate'){
57 html+='<p>'+field+' : '+new Date(+messageObject[field])+'</p>';
60 html+='<p>'+field+' : '+messageObject[field]+'</p>';
65 var modalInstance = ngDialog.open({
66 templateUrl: 'app/views/user-notifications-admin/user.notifications.Json.details.modal.page.html',
67 controller: 'userNotificationCtrl',
69 message: function () {
82 $log.error('userNotificationsCtrl:getMessageRecipients:: error ', err);
83 $scope.isLoadingTable = false;
89 notificationHistoryCtrl.$inject = ['$scope', '$log', 'notificationService', 'confirmBoxService', '$modal', 'ngDialog', '$state'];
90 angular.module('ecompApp').controller('notificationHistoryCtrl', notificationHistoryCtrl);