add dmpUser section ui
This commit is contained in:
parent
38eef575d0
commit
cc6359e0fc
|
@ -56,6 +56,7 @@ export interface DmpUser extends BaseEntity {
|
|||
dmp: Dmp;
|
||||
user: User;
|
||||
role: DmpUserRole;
|
||||
sectionId: Guid;
|
||||
}
|
||||
|
||||
export interface DmpDescriptionTemplate extends BaseEntity {
|
||||
|
@ -132,6 +133,7 @@ export interface DmpUserPersist {
|
|||
user: Guid;
|
||||
role: DmpUserRole;
|
||||
email: string;
|
||||
sectionId: Guid;
|
||||
}
|
||||
|
||||
export interface DmpUserRemovePersist {
|
||||
|
|
|
@ -284,6 +284,18 @@
|
|||
<mat-error *ngIf="user.get('role').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="col">
|
||||
<mat-form-field class="w-100">
|
||||
<mat-label>{{'DMP-EDITOR.FIELDS1.SECTION' | translate}}</mat-label>
|
||||
<mat-select [formControl]="user.get('sectionId')">
|
||||
<mat-option *ngFor="let section of selectedBlueprint.definition.sections" [value]="section.id">
|
||||
{{ section.label }}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
<mat-error *ngIf="user.get('sectionId').hasError('backendError')">{{user.get('sectionId').getError('backendError').message}}</mat-error>
|
||||
<mat-error *ngIf="user.get('sectionId').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' |translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
|
|
|
@ -466,6 +466,7 @@ export class DmpUserEditorModel implements DmpUserPersist {
|
|||
role: DmpUserRole;
|
||||
email: string;
|
||||
userType: DmpUserType= DmpUserType.Internal;
|
||||
sectionId: Guid;
|
||||
|
||||
protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder();
|
||||
|
||||
|
@ -478,6 +479,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;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
@ -499,6 +501,7 @@ export class DmpUserEditorModel implements DmpUserPersist {
|
|||
user: [{ value: this.user, disabled: disabled }, context.getValidation('user').validators],
|
||||
role: [{ value: this.role, disabled: disabled }, context.getValidation('role').validators],
|
||||
email: [{ value: this.role, disabled: disabled }, context.getValidation('email').validators],
|
||||
sectionId: [{ value: this.role, disabled: disabled }, context.getValidation('sectionId').validators],
|
||||
userType: [{ value: this.userType, disabled: disabled }, context.getValidation('userType').validators],
|
||||
});
|
||||
}
|
||||
|
@ -514,6 +517,7 @@ export class DmpUserEditorModel implements DmpUserPersist {
|
|||
baseValidationArray.push({ key: 'user', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}user`)] });
|
||||
baseValidationArray.push({ key: 'role', validators: [Validators.required, BackendErrorValidator(validationErrorModel, `${rootPath}role`)] });
|
||||
baseValidationArray.push({ key: 'email', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}email`)] });
|
||||
baseValidationArray.push({ key: 'sectionId', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}sectionId`)] });
|
||||
baseValidationArray.push({ key: 'userType', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}userType`)] });
|
||||
|
||||
baseContext.validation = baseValidationArray;
|
||||
|
@ -532,7 +536,7 @@ export class DmpUserEditorModel implements DmpUserPersist {
|
|||
validationErrorModel
|
||||
});
|
||||
|
||||
['user', 'role', 'email'].forEach(keyField => {
|
||||
['user', 'role', 'email', 'sectionId'].forEach(keyField => {
|
||||
const control = formGroup?.get(keyField);
|
||||
control?.clearValidators();
|
||||
control?.addValidators(context.getValidation(keyField).validators);
|
||||
|
|
|
@ -1746,7 +1746,8 @@
|
|||
"FIRST-NAME": "First Name",
|
||||
"LAST-NAME": "Last Name",
|
||||
"EMAIL": "Email",
|
||||
"USER-ROLE": "Role"
|
||||
"USER-ROLE": "Role",
|
||||
"SECTION": "Specific DMP Section"
|
||||
},
|
||||
"ACTIONS1": {
|
||||
"GO-TO-GRANT": "Go To DMP Grant",
|
||||
|
|
Loading…
Reference in New Issue