implemented travel join system, added notifications page and to navbar

This commit is contained in:
arnaucode
2017-10-22 12:20:10 +02:00
parent 644ad79712
commit 72f1f2e952
8 changed files with 255 additions and 4 deletions

View File

@@ -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>

View File

@@ -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");
});
});