mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
Profile picture, notifications, chat romms
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Component, OnInit, ChangeDetectorRef } from '@angular/core';
|
||||
import { Component, OnInit, ChangeDetectorRef, NgZone } from '@angular/core';
|
||||
import { AnimationController, ModalController, Platform } from '@ionic/angular';
|
||||
import { SearchPage } from 'src/app/pages/search/search.page';
|
||||
import { Router } from '@angular/router';
|
||||
@@ -14,6 +14,7 @@ import { PermissionService } from 'src/app/services/permission.service';
|
||||
import { EventTrigger } from 'src/app/services/eventTrigger.service'
|
||||
import { ActiveTabService } from 'src/app/services/active-tab.service';
|
||||
import { NotificationsService } from 'src/app/services/notifications.service';
|
||||
import { AttachmentsService } from 'src/app/services/attachments.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-header',
|
||||
@@ -55,6 +56,8 @@ export class HeaderPage implements OnInit {
|
||||
private notificationService: NotificationsService,
|
||||
private cdRef: ChangeDetectorRef,
|
||||
private storageService: StorageService,
|
||||
private zone: NgZone,
|
||||
private attachmentService: AttachmentsService
|
||||
) {
|
||||
this.loggeduser = SessionStore.user;
|
||||
router.events.subscribe((val) => {
|
||||
@@ -65,7 +68,7 @@ export class HeaderPage implements OnInit {
|
||||
});
|
||||
|
||||
this.updateReciveNotification();
|
||||
this.updateDeleteNotification();
|
||||
this.updateDeleteNotification();
|
||||
|
||||
/* this.notificationService.notificationReceived.subscribe(() => {
|
||||
console.log('header', 'event.notification')
|
||||
@@ -75,23 +78,49 @@ export class HeaderPage implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
ngOnInit() {
|
||||
this.hideSearch();
|
||||
|
||||
this.getProfilpicture();
|
||||
|
||||
console.log('Profile picture guid ', this.SessionStore.user.UserPhoto)
|
||||
this.getProfilpicture();
|
||||
|
||||
}
|
||||
|
||||
ng
|
||||
reloadComponent(self: boolean, urlToNavigateTo?: string) {
|
||||
//skipLocationChange:true means dont update the url to / when navigating
|
||||
console.log("Current route I am on header:", this.router.url);
|
||||
const url = self ? this.router.url : urlToNavigateTo;
|
||||
this.zone.run(() => this.router.navigateByUrl('/', { skipLocationChange: true }).then(() => {
|
||||
this.zone.run(() => this.router.navigate([`/${url}`]).then(() => {
|
||||
console.log(`After navigation I am on header:${this.router.url}`)
|
||||
}))
|
||||
}))
|
||||
}
|
||||
|
||||
|
||||
getProfilpicture() {
|
||||
this.storageService.get(this.SessionStore.user.RoleID.toString()).then((picture) => {
|
||||
console.log(picture)
|
||||
this.profilePicture = 'data:image/jpeg;base64,' +picture
|
||||
}).catch((error ) => {
|
||||
this.profilePicture = "";
|
||||
|
||||
this.attachmentService.getUserProfilePhoto(this.SessionStore.user.UserPhoto).subscribe((base) => {
|
||||
|
||||
this.storageService.store(this.SessionStore.user.RoleID.toString(), 'data:image/jpeg;base64,' + base).then((value) => {
|
||||
this.profilePicture = 'data:image/jpeg;base64,' + base;
|
||||
|
||||
console.log('picture saved', value)
|
||||
}).catch((error) => {
|
||||
console.log('picture not saved')
|
||||
});
|
||||
}, (error) => {
|
||||
console.log('profile picture errro: ', error)
|
||||
this.storageService.get(this.SessionStore.user.RoleID.toString()).then((picture) => {
|
||||
console.log(picture)
|
||||
this.profilePicture = picture
|
||||
}).catch((error) => {
|
||||
this.profilePicture = "";
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
updateReciveNotification() {
|
||||
@@ -118,10 +147,11 @@ export class HeaderPage implements OnInit {
|
||||
console.log('Call notification data')
|
||||
await this.storageservice.get("Notifications").then((value) => {
|
||||
|
||||
console.log('Get notification data', )
|
||||
|
||||
console.log('Get notification data',)
|
||||
|
||||
this.notificationLength = value.length;
|
||||
console.log('Call notification data',this.notificationLength)
|
||||
console.log('Call notification data', this.notificationLength)
|
||||
|
||||
|
||||
}).catch((error) => {
|
||||
if (!error) {
|
||||
|
||||
Reference in New Issue
Block a user