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