agenda text change again

This commit is contained in:
Eudes Inácio
2023-08-22 11:52:16 +01:00
parent e8adb78b56
commit cb95084c10
3 changed files with 49 additions and 44 deletions
+42 -37
View File
@@ -1,4 +1,4 @@
import { Component, OnInit } from '@angular/core';
import { Component, OnInit, ChangeDetectorRef } from '@angular/core';
import { AnimationController, ModalController, Platform } from '@ionic/angular';
import { SearchPage } from 'src/app/pages/search/search.page';
import { Router } from '@angular/router';
@@ -38,7 +38,7 @@ export class HeaderPage implements OnInit {
showProfileModal = false
permissionList = new PermissionList();
notificationCount: number = 0;
constructor(
private router: Router,
@@ -51,7 +51,8 @@ export class HeaderPage implements OnInit {
public p: PermissionService,
private eventTriger: EventTrigger,
public ActiveTabService: ActiveTabService,
private notificationService: NotificationsService
private notificationService: NotificationsService,
private cdRef: ChangeDetectorRef
) {
this.loggeduser = SessionStore.user;
router.events.subscribe((val) => {
@@ -61,48 +62,52 @@ export class HeaderPage implements OnInit {
this.showProfileModal = false
});
this.eventTriger.getObservable().subscribe((event) => {
if(event.notification == "recive") {
console.log('header', event.notification)
this.notificationLength++
if(window['headerupdate']) {
window['headerupdate']()
}
} else if(event.notification == "deleted") {
console.log('header', event.notification)
this.notificationLength--
if(window['headerupdate']) {
window['headerupdate']()
}
}
});
this.updateReciveNotification();
this.updateDeleteNotification();
/* this.notificationService.notificationReceived.subscribe(() => {
console.log('header', 'event.notification')
this.notificationLengthData()
}); */
}
async ngOnInit() {
this.hideSearch();
this.notificationLengthData();
}
updateReciveNotification() {
this.eventTriger.getObservable().subscribe((event) => {
if (event.notification == "recive") {
console.log('header', event.notification)
this.notificationLength++
}
});
}
updateDeleteNotification() {
this.eventTriger.getObservable().subscribe((event) => {
if (event.notification == "deleted") {
console.log('header', event.notification)
this.notificationLength--
}
});
}
async notificationLengthData() {
await this.storageservice.get("Notifications").then((value) => {
/* var data = JSON.parse(value); */
this.notificationLength = value.length;
}).catch((error) => {
if(!error) {
if (!error) {
this.notificationLength = 0;
} else {
console.error('header storage get notification', error)
@@ -139,9 +144,9 @@ export class HeaderPage implements OnInit {
type = "AccoesPresidenciais"
}
if(this.canOpenSearch) {
if (this.canOpenSearch) {
this.canOpenSearch = false
const modal = await this.modalController.create({
component: SearchPage,
cssClass: classs,
@@ -152,7 +157,7 @@ export class HeaderPage implements OnInit {
}
});
modal.onDidDismiss().then(() => {
@@ -194,7 +199,7 @@ export class HeaderPage implements OnInit {
return enterAnimation(baseEl).direction('reverse');
}
if(!this.showProfileModal) {
if (!this.showProfileModal) {
this.showProfileModal = true
const modal = await this.modalController.create({
component: ProfilePage,
@@ -202,8 +207,8 @@ export class HeaderPage implements OnInit {
componentProps: {
}
});
modal.onDidDismiss().then(() => {
this.notificationLengthData()
this.showProfileModal = false
@@ -211,15 +216,15 @@ export class HeaderPage implements OnInit {
await modal.present();
}
}
async dynamicSearch() {
if(window['dynamicSearch']) {
if (window['dynamicSearch']) {
window['dynamicSearch'](this.searchSubject)
} else {
setTimeout(()=>{
setTimeout(() => {
this.dynamicSearch()
}, 100)
}
@@ -239,11 +244,11 @@ export class HeaderPage implements OnInit {
}
async basicSearch() {
if(window['searchTriger']) {
if (window['searchTriger']) {
window['searchTriger']()
} else {
setTimeout(()=>{
setTimeout(() => {
this.basicSearch()
}, 100)
}