added an all option for section field of plan invite

This commit is contained in:
Diamantis Tziotzios 2024-05-15 20:29:21 +03:00
parent 6bdc6d5c09
commit 41de3292af
4 changed files with 13 additions and 11 deletions

View File

@ -140,7 +140,7 @@ export interface DmpUserPersist {
user: Guid;
role: DmpUserRole;
email: string;
sectionId: Guid;
sectionId: string;
}
export interface DmpUserRemovePersist {

View File

@ -526,7 +526,7 @@ export class DmpUserEditorModel implements DmpUserPersist {
role: DmpUserRole;
email: string;
userType: DmpUserType = DmpUserType.Internal;
sectionId: Guid;
sectionId: string = '';
protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder();
@ -539,7 +539,7 @@ export class DmpUserEditorModel implements DmpUserPersist {
this.role = item.role;
// TODO this.email = item.email;
this.userType = (item == null || this.user != null) ? DmpUserType.Internal : DmpUserType.External;
this.sectionId = item.sectionId;
this.sectionId = item.sectionId?.toString() || ''; //Trick to allow a null option for all items.
return this;
}

View File

@ -1,18 +1,18 @@
<div class="p-2">
<div cdkDropList (cdkDropListDropped)="dropUsers($event)" *ngIf="enableSorting===true; else sortingDisabled" class="row">
<div class="col-12">
<div *ngFor="let user of form.get('users').controls; let userIndex = index" cdkDrag class="row align-items-center user-fields" [cdkDragDisabled]="form.disabled" (mouseenter)="onUserHover(userIndex)" (mouseleave)="clearHoveredUser()">
<ng-container *ngTemplateOutlet="userForm; context: {$implicit: user, index: userIndex}" ></ng-container>
<ng-container *ngTemplateOutlet="userForm; context: {$implicit: user, index: userIndex}"></ng-container>
</div>
</div>
</div>
<ng-template #sortingDisabled>
<div class="row">
<div class="col-12">
<div *ngFor="let user of form.get('users').controls; let userIndex = index" class="row align-items-center user-fields">
<ng-container *ngTemplateOutlet="userForm; context: {$implicit: user, index: userIndex}" ></ng-container>
<ng-container *ngTemplateOutlet="userForm; context: {$implicit: user, index: userIndex}"></ng-container>
</div>
</div>
</div>
@ -26,7 +26,7 @@
</div>
</div>
</div>
<ng-template #userForm let-user let-userIndex="index">
@ -69,8 +69,9 @@
</div>
<div class="col-12 col-xl mt-3" *ngIf="sections">
<mat-form-field class="w-100">
<mat-label>{{'DMP-EDITOR.FIELDS.SECTION' | translate}}</mat-label>
<mat-label>{{'DMP-EDITOR.FIELDS.SECTIONS' | translate}}</mat-label>
<mat-select [formControl]="user.get('sectionId')">
<mat-option value="">{{'DMP-EDITOR.FIELDS.ALL-SECTIONS' | translate}}</mat-option>
<mat-option *ngFor="let section of sections" [value]="section.id">
{{ section.label }}
</mat-option>
@ -87,4 +88,4 @@
<mat-error *ngIf="form.get('users').dirty && form.get('users').hasError('required')">{{'DMP-EDITOR.USERS-REQUIRED' | translate}}</mat-error>
<mat-error *ngIf="form.get('users').hasError('backendError')">{{form.get('users').getError('backendError').message}}</mat-error>
</ng-template>
</ng-template>

View File

@ -1525,7 +1525,8 @@
"EMAIL": "Email",
"USER": "User",
"USER-ROLE": "Role",
"SECTION": "Specific DMP Section",
"SECTIONS": "Plan Sections",
"ALL-SECTIONS": "All",
"DMP-BLUEPRINT-VERSION": "Version"
},
"ACTIONS": {