mirror of
https://github.com/arnaucube/commonroutesWebApp.git
synced 2026-02-08 11:56:46 +01:00
implemented travel join system, added notifications page and to navbar
This commit is contained in:
40
views/notifications/notifications.html
Normal file
40
views/notifications/notifications.html
Normal 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>
|
||||
32
views/notifications/notifications.js
Normal file
32
views/notifications/notifications.js
Normal 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");
|
||||
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user