Removes collaborator from submit form

This commit is contained in:
apapachristou 2019-05-29 10:58:08 +03:00
parent f6be85a8f2
commit eeffcc9b28
2 changed files with 12 additions and 4 deletions

View File

@ -20,7 +20,7 @@
<td>{{user.email}}</td>
<td>{{roleDisplay(user)}}</td>
<td *ngIf="isOwner()">
<div *ngIf="user.role" class="remove_user" (click)="removeCollaborator()">
<div *ngIf="user.role" class="remove_user" (click)="removeCollaborator(user.id)">
<mat-icon>delete</mat-icon>
</div>
</td>

View File

@ -8,6 +8,7 @@ import { TranslateService } from '@ngx-translate/core';
import { Principal } from '../../../../core/model/auth/Principal';
import { AuthService } from '../../../../core/services/auth/auth.service';
import { ConfirmationDialogComponent } from '../../../../library/confirmation-dialog/confirmation-dialog.component';
import { DmpService } from '../../../../core/services/dmp/dmp.service';
@Component({
selector: 'app-people-tab',
@ -23,7 +24,8 @@ export class PeopleTabComponent implements OnInit {
private dialog: MatDialog,
private translate: TranslateService,
private authentication: AuthService,
private language: TranslateService
private language: TranslateService,
private dmpService: DmpService
) { }
ngOnInit() {
@ -65,7 +67,7 @@ export class PeopleTabComponent implements OnInit {
return isOwner;
}
removeCollaborator() {
removeCollaborator(id: string) {
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
maxWidth: '300px',
data: {
@ -74,7 +76,13 @@ export class PeopleTabComponent implements OnInit {
cancelButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CANCEL')
}
});
// dialogRef.afterClosed();
dialogRef.afterClosed().subscribe(result => {
if (result) {
this.people = this.people.filter(function(value, index, arr) {
return value.id !== id;
});
}
});
}
}