Bug fixed on remove collaborator
This commit is contained in:
parent
2453cde47f
commit
9159ba2d9b
|
@ -62,7 +62,7 @@
|
|||
<mat-icon class="mr-2">person</mat-icon>
|
||||
{{ 'DMP-LISTING.COLUMNS.PEOPLE' | translate }}
|
||||
</ng-template>
|
||||
<app-people-tab [people]="people" [dmp]="dmp"></app-people-tab>
|
||||
<app-people-tab [formGroup]="formGroup" [dmp]="dmp"></app-people-tab>
|
||||
</mat-tab>
|
||||
<!-- <mat-tab>
|
||||
<ng-template mat-tab-label>
|
||||
|
|
|
@ -3,19 +3,19 @@
|
|||
<div class="col-12 pt-4 pb-4 pl-4">
|
||||
<div class="table-header col-auto d-flex">
|
||||
<span class="table-title">Collaborators</span>
|
||||
<div class="table-action" (click)="openShareDialog(dmp.id,dmp.label)">
|
||||
<div class="table-action" (click)="openShareDialog(dmp.id, dmp.label)">
|
||||
<mat-icon>add</mat-icon><span>{{'DMP-LISTING.ACTIONS.INVITE' | translate}}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="table-container">
|
||||
<table *ngIf="people">
|
||||
<table *ngIf="formGroup.get('users')">
|
||||
<tr>
|
||||
<th>{{'USERS.LISTING.NAME' | translate}}</th>
|
||||
<th>{{'USERS.LISTING.EMAIL' | translate}}</th>
|
||||
<th>{{'USERS.LISTING.PERMISSIONS' | translate}}</th>
|
||||
<th *ngIf="isOwner()"></th>
|
||||
</tr>
|
||||
<tr *ngFor="let user of people">
|
||||
<tr *ngFor="let user of formGroup.get('users')?.value">
|
||||
<td>{{user.name}}</td>
|
||||
<td>{{user.email}}</td>
|
||||
<td>{{roleDisplay(user)}}</td>
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
import { Component, OnInit, Input } from '@angular/core';
|
||||
import { UserModel } from '../../../../core/model/user/user';
|
||||
import { DmpEditorModel } from '../dmp-editor.model';
|
||||
import { Component, Input, OnInit } from '@angular/core';
|
||||
import { FormGroup } from '@angular/forms';
|
||||
import { MatDialog } from '@angular/material';
|
||||
import { DmpInvitationDialogComponent } from '../../invitation/dmp-invitation.component';
|
||||
import { UserInfoListingModel } from '../../../../core/model/user/user-info-listing';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { Principal } from '../../../../core/model/auth/Principal';
|
||||
import { UserInfoListingModel } from '../../../../core/model/user/user-info-listing';
|
||||
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';
|
||||
import { ConfirmationDialogComponent } from '../../../../library/confirmation-dialog/confirmation-dialog.component';
|
||||
import { DmpInvitationDialogComponent } from '../../invitation/dmp-invitation.component';
|
||||
import { DmpEditorModel } from '../dmp-editor.model';
|
||||
|
||||
@Component({
|
||||
selector: 'app-people-tab',
|
||||
|
@ -17,9 +17,9 @@ import { DmpService } from '../../../../core/services/dmp/dmp.service';
|
|||
})
|
||||
export class PeopleTabComponent implements OnInit {
|
||||
|
||||
@Input() associatedUsers: Array<UserModel>;
|
||||
@Input() people: Array<UserInfoListingModel>;
|
||||
@Input() formGroup: FormGroup;
|
||||
@Input() dmp: DmpEditorModel;
|
||||
|
||||
constructor(
|
||||
private dialog: MatDialog,
|
||||
private translate: TranslateService,
|
||||
|
@ -58,7 +58,7 @@ export class PeopleTabComponent implements OnInit {
|
|||
const principal: Principal = this.authentication.current();
|
||||
var isOwner: boolean = false;
|
||||
if (principal) {
|
||||
this.people.forEach(element => {
|
||||
this.formGroup.get('users').value.forEach(element => {
|
||||
if (principal.id === element.id && element.role === 0) {
|
||||
isOwner = true;
|
||||
}
|
||||
|
@ -78,11 +78,10 @@ export class PeopleTabComponent implements OnInit {
|
|||
});
|
||||
dialogRef.afterClosed().subscribe(result => {
|
||||
if (result) {
|
||||
this.people = this.people.filter(function(value, index, arr) {
|
||||
return value.id !== id;
|
||||
});
|
||||
this.formGroup.get('users').setValue(this.formGroup.get('users').value.filter(function (val, index, arr) {
|
||||
return val.id !== id;
|
||||
}));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue