diff --git a/src/app/core/users/users.component.html b/src/app/core/users/users.component.html index 3e163796049abe0d9d7c1b94b4f845957ea66ece..f852c42f0fa6c3b80443c318ee8e97172c42fc9b 100644 --- a/src/app/core/users/users.component.html +++ b/src/app/core/users/users.component.html @@ -9,8 +9,21 @@ <div class='border-top mt-3 pt-3' *ngIf='!users'> Nincs </div> - <div class='border-top mt-3 pt-3' *ngFor='let user of users; TrackBy: trackById'> - {{user.fullName}} - {{user.email}} + <div class='border-top mt-3 pt-3 d-flex justify-content-between' *ngFor='let user of users; TrackBy: trackById'> + <div> + <div> + {{user.fullName}} - {{user.schacc}} + </div> + <div> + {{user.email}} + </div> + </div> + <div> + {{user.isApproved ? "Elfogadott": "Jelentkezett"}} + <button class='btn btn-link' *ngIf='!user.isApproved' + (click)='approve(user.id)'>Elfogadás + </button> + </div> </div> </div> <div class='mt-3'> diff --git a/src/app/core/users/users.component.ts b/src/app/core/users/users.component.ts index 9d05e5e2a3ba1b07f3ff6381cee0555ce4497c9c..8f299db8334798aee40a4ae2270aeb1b6233de2a 100644 --- a/src/app/core/users/users.component.ts +++ b/src/app/core/users/users.component.ts @@ -17,15 +17,24 @@ export class UsersComponent implements OnInit { constructor(private usersService: UsersService) {} ngOnInit(): void { - this.usersService.listUsers().subscribe((u) => { - this.users = u; - this.isLoading = false; - }, error => { - this.isLoading = false; - }); + this.usersService.listUsers().subscribe( + (u) => { + this.users = u; + this.isLoading = false; + }, + (error) => { + this.isLoading = false; + } + ); } public trackById(index: number, item: User): number { return item.id; } + + approve(userId: number): void { + this.usersService.approveUser(userId).subscribe((u) => { + window.location.reload(); + }); + } }