perbaikan profil data

This commit is contained in:
Fuzi_fauzia 2024-07-04 15:30:46 +07:00
parent ae74cf2332
commit 79b6300bf0
3 changed files with 36 additions and 17 deletions

View File

@ -27,15 +27,23 @@
[routerLink]="['/dashboard/sales']" [routerLink]="['/dashboard/sales']"
class="navbar-brand" class="navbar-brand"
routerLink="/dashboard/sales" routerLink="/dashboard/sales"
> >
<img <img
class="brand-logo" class="brand-logo"
alt="modern admin logo" alt="modern admin logo"
src="../../../../assets/images/logo/smart2.png" src="../../../../assets/images/logo/smart2.png"
/> />
<!-- <h3 class="brand-text" style="color: #ffffff;">{{_themeSettingsConfig.brand.brand_name}}</h3> --> <!-- <h3 class="brand-text" style="color: #ffffff;">{{_themeSettingsConfig.brand.brand_name}}</h3> -->
<div class="brand-text-wrapper" style="max-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;"> <div
<h3 class="brand-text" style="color: #ffffff; margin: 0;"> class="brand-text-wrapper"
style="
max-width: 200px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
"
>
<h3 class="brand-text" style="color: #ffffff; margin: 0">
Smart Building Smart Building
</h3> </h3>
</div> </div>
@ -322,16 +330,7 @@
>John Doe</span >John Doe</span
> >
<span class="avatar avatar-online"> <span class="avatar avatar-online">
<img <img src="{{ urlImage }}" alt="avatar" />
*ngIf="currentUser.photoURL"
src="{{ currentUser.photoURL }}"
alt="avatar"
/>
<img
*ngIf="!currentUser.photoURL"
src="../../../assets/images/portrait/small/avatar-s-19.png"
alt="avatar"
/>
<i></i> <i></i>
</span> </span>
</a> </a>

View File

@ -9,6 +9,7 @@ import { AuthService } from 'src/app/_services/auth.service';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { PerfectScrollbarConfigInterface, PerfectScrollbarComponent, PerfectScrollbarDirective } from 'ngx-perfect-scrollbar'; import { PerfectScrollbarConfigInterface, PerfectScrollbarComponent, PerfectScrollbarDirective } from 'ngx-perfect-scrollbar';
import { AppConstants } from 'src/app/_helpers/app.constants'; 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 & { const docElmWithBrowsersFullScreenFunctions = document.documentElement as HTMLElement & {
mozRequestFullScreen(): Promise<void>; mozRequestFullScreen(): Promise<void>;
@ -30,6 +31,8 @@ export class VerticalComponent implements OnInit, AfterViewInit {
insideTm: any; insideTm: any;
outsideTm: any; outsideTm: any;
urlImage: string = 'https://www.w3schools.com/howto/img_avatar.png';
dataAccount: any;
private _unsubscribeAll: Subject<any>; private _unsubscribeAll: Subject<any>;
private _unsubscribeAllMenu: Subject<any>; private _unsubscribeAllMenu: Subject<any>;
public _themeSettingsConfig: any; public _themeSettingsConfig: any;
@ -57,7 +60,8 @@ export class VerticalComponent implements OnInit, AfterViewInit {
private _menuSettingsService: MenuSettingsService, private _menuSettingsService: MenuSettingsService,
public authService: AuthService, public authService: AuthService,
private router: Router, private router: Router,
private elementRef: ElementRef private elementRef: ElementRef,
private authServiceLogin: LoginService,
) { ) {
this._unsubscribeAll = new Subject(); this._unsubscribeAll = new Subject();
this._unsubscribeAllMenu = new Subject(); this._unsubscribeAllMenu = new Subject();
@ -82,6 +86,13 @@ export class VerticalComponent implements OnInit, AfterViewInit {
if (localStorage.getItem('currentUser')) { if (localStorage.getItem('currentUser')) {
this.currentUser = JSON.parse(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 // Subscribe to config changes
this._themeSettingsService.config this._themeSettingsService.config
.pipe(takeUntil(this._unsubscribeAll)) .pipe(takeUntil(this._unsubscribeAll))
@ -101,6 +112,14 @@ export class VerticalComponent implements OnInit, AfterViewInit {
this.email = this._themeSettingsConfig.headerIcons.email; 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 { ngAfterViewInit(): void {
this.refreshView(); this.refreshView();
} }

View File

@ -16,7 +16,7 @@ export class ProfilInformationComponent {
storedData: any; storedData: any;
disableButton: boolean = false disableButton: boolean = false
url: any = ''; url: any = 'https://www.w3schools.com/howto/img_avatar.png';
fileSelected: any = null; fileSelected: any = null;
constructor( constructor(
@ -46,9 +46,10 @@ export class ProfilInformationComponent {
phone: data.data.phone, phone: data.data.phone,
image: [null] 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) { onSelectFile(event) {