Badged notification added

This commit is contained in:
Eudes Inácio
2021-08-19 18:28:00 +01:00
parent 6d13772720
commit 69e7c67d80
4 changed files with 77 additions and 34 deletions
+48 -24
View File
@@ -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<object> = [];
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') {