|
|
@@ -10,8 +10,11 @@ import { LoginService } from 'angularlib/login/login.service';
|
|
|
import { CommonModule } from '@angular/common';
|
|
|
import { ChangeTheme } from 'angularlib/ui.state/ui.state.actions';
|
|
|
import { ChangeLanguage } from 'angularlib/labels/label.actions';
|
|
|
-import { Label } from 'angularlib/labels/label.interface';
|
|
|
import { ComponentService } from 'angularlib/component.service';
|
|
|
+import { NotificationModule } from 'angularlib/notification/notification.module';
|
|
|
+import { NotificationState } from 'angularlib/notification/notification.state';
|
|
|
+import { Notification } from 'angularlib/notification/notification.actions';
|
|
|
+import { generateId } from 'angularlib/base.service';
|
|
|
|
|
|
@Component({
|
|
|
selector: 'app-root',
|
|
|
@@ -21,7 +24,8 @@ import { ComponentService } from 'angularlib/component.service';
|
|
|
RouterOutlet,
|
|
|
MatModule,
|
|
|
RouterModule,
|
|
|
- Angularlib
|
|
|
+ Angularlib,
|
|
|
+ NotificationModule
|
|
|
],
|
|
|
templateUrl: './app.component.html',
|
|
|
styleUrls: [
|
|
|
@@ -31,6 +35,9 @@ import { ComponentService } from 'angularlib/component.service';
|
|
|
export class AppComponent extends BaseComponent implements OnInit {
|
|
|
title = 'FIS App';
|
|
|
|
|
|
+ /**current date */
|
|
|
+ protected currentDate = new Date();
|
|
|
+
|
|
|
/**login timeout duration in milliseconds
|
|
|
* @default 5 minutes
|
|
|
*/
|
|
|
@@ -46,6 +53,9 @@ export class AppComponent extends BaseComponent implements OnInit {
|
|
|
/**current theme of application */
|
|
|
protected theme;
|
|
|
|
|
|
+ /**number of notifications */
|
|
|
+ protected notificationCount: number = 0;
|
|
|
+
|
|
|
constructor(
|
|
|
private router: Router,
|
|
|
private store: Store,
|
|
|
@@ -65,7 +75,6 @@ export class AppComponent extends BaseComponent implements OnInit {
|
|
|
|
|
|
ngOnInit(): void {
|
|
|
this.setDefaultTheme();
|
|
|
-
|
|
|
this.router.events.pipe(untilDestroy(this),
|
|
|
filter((event) => event instanceof RoutesRecognized),
|
|
|
map((res:any) => {
|
|
|
@@ -85,6 +94,12 @@ export class AppComponent extends BaseComponent implements OnInit {
|
|
|
this.timeout.pipe(untilDestroy(this),takeUntil(this.loginService.loggedOut)).subscribe();
|
|
|
}
|
|
|
});
|
|
|
+
|
|
|
+ this.store.select(NotificationState).pipe(untilDestroy(this)).subscribe({
|
|
|
+ next: (state:any) => {
|
|
|
+ this.notificationCount = state.notifications.length;
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -115,4 +130,10 @@ export class AppComponent extends BaseComponent implements OnInit {
|
|
|
localStorage.setItem('theme',this.theme);
|
|
|
this.store.dispatch(new ChangeTheme(this.theme));
|
|
|
}
|
|
|
+
|
|
|
+ protected addNotification() {
|
|
|
+ this.store.dispatch(new Notification.Add({
|
|
|
+ message:{title:generateId(),desc:generateId(),timestamp: new Date()}
|
|
|
+ }));
|
|
|
+ }
|
|
|
}
|