165. Getting profile image and click save button (#22)
This commit is contained in:
@ -219,8 +219,8 @@
|
||||
</div>
|
||||
<div class="custom-file">
|
||||
<input type="file" accept="image/*" name="profileImage"
|
||||
(change)="onProfileImageChange($event)"
|
||||
class="custom-file-input" >
|
||||
(change)="onProfileImageChange($any($event).target.files)"
|
||||
class="custom-file-input">
|
||||
<label class="custom-file-label">
|
||||
<span [hidden]="true"> fileName </span>
|
||||
<span [hidden]="false">Choose File</span>
|
||||
@ -247,7 +247,7 @@
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal" id="new-user-close">Close</button>
|
||||
<button type="button" class="btn btn-primary">Save changes</button>
|
||||
<button type="button" class="btn btn-primary" (click)="saveNewUser()">Save changes</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -20,6 +20,8 @@ export class UserComponent implements OnInit, OnDestroy {
|
||||
public refreshing: boolean;
|
||||
private subscriptions: Subscription[] = [];
|
||||
public selectedUser: User;
|
||||
public profileImageFileName: string;
|
||||
public profileImage: File;
|
||||
|
||||
constructor(private userService: UserService,
|
||||
private notificationService: NotificationService) {
|
||||
@ -64,11 +66,16 @@ export class UserComponent implements OnInit, OnDestroy {
|
||||
document.getElementById('openUserInfo')?.click();
|
||||
}
|
||||
|
||||
public onProfileImageChange(event: any): void {
|
||||
console.log(event);
|
||||
public onProfileImageChange(fileList: FileList): void {
|
||||
this.profileImageFileName = fileList[0].name;
|
||||
this.profileImage = fileList[0];
|
||||
}
|
||||
|
||||
private sendErrorNotification(message: string) {
|
||||
this.notificationService.notify(NotificationType.ERROR, message ? message : 'An error occurred. Please try again')
|
||||
}
|
||||
|
||||
public saveNewUser(): void {
|
||||
document.getElementById('new-user-save')?.click();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user