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