mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
Profile picture, notifications, chat romms
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
||||
import { Component, EventEmitter, Input, OnInit, Output,ViewContainerRef } from '@angular/core';
|
||||
import { ModalController, PickerController, PopoverController } from '@ionic/angular';
|
||||
import { ChatSystemService } from 'src/app/services/chat/chat-system.service';
|
||||
import { DataService } from 'src/app/services/data.service';
|
||||
@@ -49,6 +49,7 @@ export class NewGroupPage implements OnInit{
|
||||
private toastService: ToastService,
|
||||
public ThemeService: ThemeService,
|
||||
private RouteService: RouteService,
|
||||
private viewContainerRef: ViewContainerRef
|
||||
)
|
||||
{
|
||||
this.loggedUserChat = SessionStore.user.ChatData['data'];
|
||||
@@ -56,9 +57,16 @@ export class NewGroupPage implements OnInit{
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
console.log(this.dataService.get("task"))
|
||||
|
||||
this.task = this.dataService.get("task");
|
||||
this.event = this.dataService.get("event");
|
||||
|
||||
console.log(this.task)
|
||||
|
||||
this
|
||||
|
||||
if(this.task) {
|
||||
this.link = this.dataService.get("link");
|
||||
this.groupName = this.task.Folio;
|
||||
@@ -93,12 +101,15 @@ export class NewGroupPage implements OnInit{
|
||||
|
||||
close() {
|
||||
if(this.link) {
|
||||
this.viewContainerRef.clear();
|
||||
this.RouteService.goBack();
|
||||
this.dataService.set("link", false);
|
||||
} else {
|
||||
if(this.roomId) {
|
||||
this.backToChat.emit({roomId: this.roomId});
|
||||
this.viewContainerRef.clear();
|
||||
} else {
|
||||
this.viewContainerRef.clear();
|
||||
this.closeAllDesktopComponents.emit();
|
||||
}
|
||||
|
||||
|
||||
@@ -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