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

@ -34,8 +34,16 @@
src="../../../../assets/images/logo/smart2.png"
/>
<!-- <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;">
<h3 class="brand-text" style="color: #ffffff; margin: 0;">
<div
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
</h3>
</div>
@ -322,16 +330,7 @@
>John Doe</span
>
<span class="avatar avatar-online">
<img
*ngIf="currentUser.photoURL"
src="{{ currentUser.photoURL }}"
alt="avatar"
/>
<img
*ngIf="!currentUser.photoURL"
src="../../../assets/images/portrait/small/avatar-s-19.png"
alt="avatar"
/>
<img src="{{ urlImage }}" alt="avatar" />
<i></i>
</span>
</a>

View File

@ -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<void>;
@ -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<any>;
private _unsubscribeAllMenu: Subject<any>;
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();
}

View File

@ -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]
});
if (data.data.image_path !== "https://kapi.absys.ninja/hemat/image/null") {
this.url = data.data.image_path
}
});
}
onSelectFile(event) {