Removes collaborator from submit form
This commit is contained in:
parent
f6be85a8f2
commit
eeffcc9b28
|
@ -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>
|
||||
|
|
|
@ -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;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue