@ -0,0 +1,40 @@ |
|||||
|
<div class="container"> |
||||
|
<div class="row"> |
||||
|
<div class="col-sm-3"></div> |
||||
|
<div class="col-sm-6"> |
||||
|
<div class="panel"> |
||||
|
<div class="panel-heading c_deepPurpleG500to300"> |
||||
|
<h3 class="panel-title"> |
||||
|
Notifications |
||||
|
<span class="badge badge-secondary pull-right c_deepPurpleG500to300">{{storageuser.notifications.length}}</span> |
||||
|
</h3> |
||||
|
</div> |
||||
|
<div class="panel-body"> |
||||
|
<div ng-show="!notifications[0]" class="item"> |
||||
|
No notifications yet |
||||
|
</div> |
||||
|
<div class="list-group"> |
||||
|
<a ng-repeat="notification in notifications | orderBy: '-date'" ng-show="notification.state=='pendent'" class="list-group-item c_deepPurple100" href="#!/{{notification.link}}"> |
||||
|
<div class="pull-right"> |
||||
|
<div class="o_text_purple600">{{notification.date | date:"dd/MM"}}</div> |
||||
|
<div class="o_text_purple600">{{notification.date | date:"HH:mm:ss"}}</div> |
||||
|
</div> |
||||
|
<i ng-show="notification.state=='pendent'" class="icon {{notification.icon}} o_text_purple600"></i> |
||||
|
<p>{{notification.message}}</p> |
||||
|
</a> |
||||
|
<a ng-repeat="notification in notifications | orderBy: '-date'" ng-show="notification.state=='viewed'" class="list-group-item" href="#!/{{notification.link}}"> |
||||
|
<div class="pull-right"> |
||||
|
<div class="o_text_purple600">{{notification.date | date:"dd/MM"}}</div> |
||||
|
<div class="o_text_purple600">{{notification.date | date:"HH:mm:ss"}}</div> |
||||
|
</div> |
||||
|
<i ng-show="notification.state=='viewed'" class="icon {{notification.icon}}"></i> |
||||
|
<h2>{{notification.message}}</h2> |
||||
|
</a> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
</div> |
||||
|
</div> |
@ -0,0 +1,32 @@ |
|||||
|
'use strict'; |
||||
|
|
||||
|
angular.module('app.notifications', ['ngRoute']) |
||||
|
|
||||
|
.config(['$routeProvider', function($routeProvider) { |
||||
|
$routeProvider.when('/notifications', { |
||||
|
templateUrl: 'views/notifications/notifications.html', |
||||
|
controller: 'NotificationsCtrl' |
||||
|
}); |
||||
|
}]) |
||||
|
|
||||
|
.controller('NotificationsCtrl', function($scope, $http) { |
||||
|
$scope.notifications = []; |
||||
|
|
||||
|
$http.get(urlapi + 'notifications') |
||||
|
.then(function(data) { |
||||
|
//get the storage notifications
|
||||
|
if (localStorage.getItem("cr_webapp_notifications")) { |
||||
|
$scope.notifications = JSON.parse(localStorage.getItem("cr_webapp_notifications")); |
||||
|
$scope.notifications = $scope.notifications.concat(data.data); // for UI
|
||||
|
} else { |
||||
|
$scope.notifications = data.data; |
||||
|
} |
||||
|
//store the notifications
|
||||
|
localStorage.setItem("cr_webapp_notifications", JSON.stringify($scope.notifications)); |
||||
|
|
||||
|
}, function(data) { |
||||
|
console.log('data error'); |
||||
|
toastr.error("Error connecting server"); |
||||
|
|
||||
|
}); |
||||
|
}); |