diff --git a/src/app/_layout/header/vertical/vertical.component.html b/src/app/_layout/header/vertical/vertical.component.html index 0a9d62b..79e215a 100644 --- a/src/app/_layout/header/vertical/vertical.component.html +++ b/src/app/_layout/header/vertical/vertical.component.html @@ -27,15 +27,23 @@ [routerLink]="['/dashboard/sales']" class="navbar-brand" routerLink="/dashboard/sales" - > + > -
-

+
+

Smart Building

@@ -322,16 +330,7 @@ >John Doe - avatar - avatar + avatar diff --git a/src/app/_layout/header/vertical/vertical.component.ts b/src/app/_layout/header/vertical/vertical.component.ts index 6d2705d..a6f915e 100644 --- a/src/app/_layout/header/vertical/vertical.component.ts +++ b/src/app/_layout/header/vertical/vertical.component.ts @@ -9,6 +9,7 @@ import { AuthService } from 'src/app/_services/auth.service'; import { Router } from '@angular/router'; import { PerfectScrollbarConfigInterface, PerfectScrollbarComponent, PerfectScrollbarDirective } from 'ngx-perfect-scrollbar'; import { AppConstants } from 'src/app/_helpers/app.constants'; +import { LoginService } from 'src/app/content/hemat-app/service/login.service'; const docElmWithBrowsersFullScreenFunctions = document.documentElement as HTMLElement & { mozRequestFullScreen(): Promise; @@ -30,6 +31,8 @@ export class VerticalComponent implements OnInit, AfterViewInit { insideTm: any; outsideTm: any; + urlImage: string = 'https://www.w3schools.com/howto/img_avatar.png'; + dataAccount: any; private _unsubscribeAll: Subject; private _unsubscribeAllMenu: Subject; public _themeSettingsConfig: any; @@ -57,7 +60,8 @@ export class VerticalComponent implements OnInit, AfterViewInit { private _menuSettingsService: MenuSettingsService, public authService: AuthService, private router: Router, - private elementRef: ElementRef + private elementRef: ElementRef, + private authServiceLogin: LoginService, ) { this._unsubscribeAll = new Subject(); this._unsubscribeAllMenu = new Subject(); @@ -82,6 +86,13 @@ export class VerticalComponent implements OnInit, AfterViewInit { if (localStorage.getItem('currentUser')) { this.currentUser = JSON.parse(localStorage.getItem('currentUser')); } + + if (localStorage.getItem('account_info')) { + this.dataAccount = JSON.parse(localStorage.getItem('account_info')); + this.dataProfil(this.dataAccount.sub); + } + + // Subscribe to config changes this._themeSettingsService.config .pipe(takeUntil(this._unsubscribeAll)) @@ -101,6 +112,14 @@ export class VerticalComponent implements OnInit, AfterViewInit { this.email = this._themeSettingsConfig.headerIcons.email; } + dataProfil(userId){ + this.authServiceLogin.getDataProfil(userId).subscribe(data => { + if (data.data.image_path !== "https://kapi.absys.ninja/hemat/image/null") { + this.urlImage = data.data.image_path + } + }); + } + ngAfterViewInit(): void { this.refreshView(); } diff --git a/src/app/content/hemat-app/user-profile/profil-information/profil-information.component.ts b/src/app/content/hemat-app/user-profile/profil-information/profil-information.component.ts index 821fae1..8c6f2c1 100644 --- a/src/app/content/hemat-app/user-profile/profil-information/profil-information.component.ts +++ b/src/app/content/hemat-app/user-profile/profil-information/profil-information.component.ts @@ -16,7 +16,7 @@ export class ProfilInformationComponent { storedData: any; disableButton: boolean = false - url: any = ''; + url: any = 'https://www.w3schools.com/howto/img_avatar.png'; fileSelected: any = null; constructor( @@ -46,9 +46,10 @@ export class ProfilInformationComponent { phone: data.data.phone, image: [null] }); - this.url = data.data.image_path + if (data.data.image_path !== "https://kapi.absys.ninja/hemat/image/null") { + this.url = data.data.image_path + } }); - } onSelectFile(event) {