diff --git a/src/app/modals/profile/profile.page.ts b/src/app/modals/profile/profile.page.ts index 0dbb39fe9..256fd7574 100644 --- a/src/app/modals/profile/profile.page.ts +++ b/src/app/modals/profile/profile.page.ts @@ -42,7 +42,18 @@ export class ProfilePage implements OnInit { } ngOnInit() { - + this.getNotificationData(); + + } + + close() { + this.modalController.dismiss(); + } + + notImplemented() { } + + async getNotificationData(){ + this.storageservice.get("Notifications").then((value) => { console.log("Init get store", value) @@ -91,17 +102,11 @@ export class ProfilePage implements OnInit { console.log("Notificaaa", this.notificationdata) }) console.log("Notificaaa", this.notificationdata) - - - + /* await new Promise(resolve => setTimeout(resolve, 1000)); + await this.getNotificationData(); */ + console.log('Timer badge count') } - close() { - this.modalController.dismiss(); - } - - notImplemented() { } - notificatinsRoutes = (index, Service, Object, IdObject, FolderId) => { if (Service === "agenda") { this.zone.run(() => this.router.navigate(['/home/agenda', IdObject, 'agenda'])); diff --git a/src/app/shared/header/header.page.html b/src/app/shared/header/header.page.html index a8292744c..789ba42ad 100644 --- a/src/app/shared/header/header.page.html +++ b/src/app/shared/header/header.page.html @@ -11,6 +11,7 @@ logo
+
{{this.notificationLength}}
{{loggeduser.Profile}}
diff --git a/src/app/shared/header/header.page.scss b/src/app/shared/header/header.page.scss index af78e2e72..0d9330924 100644 --- a/src/app/shared/header/header.page.scss +++ b/src/app/shared/header/header.page.scss @@ -39,6 +39,19 @@ border: none !important; } + .icon-badge { + background-color: red; + font-size: 12px; + color: white; + text-align: center; + width:20px; + height:20px; + border-radius: 35%; + position: absolute; /* changed */ + top: 5px; /* changed */ + right: 27px; /* changed */ +} + .profile-text{ font-size: 20px; font-weight: 300; diff --git a/src/app/shared/header/header.page.ts b/src/app/shared/header/header.page.ts index 66dedaef5..ccc77e877 100644 --- a/src/app/shared/header/header.page.ts +++ b/src/app/shared/header/header.page.ts @@ -6,6 +6,8 @@ import { ProfileComponent } from '../headers/header-no-search/profile/profile.pa import { AuthService } from 'src/app/services/auth.service'; import { User } from 'src/app/models/user.model'; import { ProfilePage } from 'src/app/modals/profile/profile.page'; +import { StorageService } from '../../services/storage.service'; +import { NotificationsService } from '../../services/notifications.service' @Component({ selector: 'app-header', @@ -15,29 +17,51 @@ import { ProfilePage } from 'src/app/modals/profile/profile.page'; export class HeaderPage implements OnInit { searchSubject: string = ''; - showSearch=false; + showSearch = false; loggeduser: User; - hideSearchBtn:boolean = false; + hideSearchBtn: boolean = false; + notificationdata: any[] = []; + DataArray: Array = []; + notificationLength: 0; + constructor( private router: Router, private modalController: ModalController, private animationController: AnimationController, + private storageservice: StorageService, + private notificatioservice: NotificationsService, authService: AuthService - ) { - this.loggeduser = authService.ValidatedUser; - router.events.subscribe((val) => { - this.showSearch=false; - //this.modalController.dismiss(); - }); - } + ) { + this.loggeduser = authService.ValidatedUser; + router.events.subscribe((val) => { + this.showSearch = false; + //this.modalController.dismiss(); + }); + } ngOnInit() { this.hideSearch(); + this.notificationLengthData(); + + } - hideSearch(){ - if(this.router.url == '/home/events' || this.router.url == '/home/chat'){ + async notificationLengthData() { + this.storageservice.get("Notifications").then((value) => { + console.log("Init get store", value) + + var data = JSON.parse(value); + this.notificationLength = data.length; + }) + + await new Promise(resolve => setTimeout(resolve, 10000)) + await this.notificationLengthData() + console.log('Timer badge count') + } + + hideSearch() { + if (this.router.url == '/home/events' || this.router.url == '/home/chat') { this.hideSearchBtn = true; } } @@ -49,7 +73,7 @@ export class HeaderPage implements OnInit { async openSearch() { let classs, showSearchInput, type; - if(window.innerWidth < 1366) { + if (window.innerWidth < 1366) { classs = 'modal modal-width-100' showSearchInput = true } else { @@ -59,7 +83,7 @@ export class HeaderPage implements OnInit { - if(window.location.pathname.startsWith('/home/agenda')) { + if (window.location.pathname.startsWith('/home/agenda')) { type = "Agenda" } else if (window.location.pathname.startsWith('/home/gabinete-digital')) { type = "AccoesPresidenciais & ArquivoDespachoElect" @@ -80,7 +104,7 @@ export class HeaderPage implements OnInit { return await modal.present(); } - changeRoute(path){ + changeRoute(path) { this.router.navigateByUrl(path) } @@ -122,28 +146,28 @@ export class HeaderPage implements OnInit { return await modal.present(); } - async dynamicSearch(){ + async dynamicSearch() { window['dynamicSearch'](this.searchSubject) } - async closeSearch(){ + async closeSearch() { this.modalController.dismiss() } - /** - * @description set empty value to searchSubject - */ - clearSearchInput(){ + /** + * @description set empty value to searchSubject + */ + clearSearchInput() { this.searchSubject = ""; window['dynamicSearch'](this.searchSubject) - } + } - async basicSearch() { + async basicSearch() { window['searchTriger']() - } + } - profileLabel(text) { + profileLabel(text) { if (text == 'MDGPR') { return 'MD' } else if (text == 'PR') {