add dmp user type

This commit is contained in:
amentis 2024-02-21 13:10:18 +02:00
parent 4738a92f6e
commit 38eef575d0
5 changed files with 37 additions and 3 deletions

View File

@ -0,0 +1,4 @@
export enum DmpUserType {
Internal = 0,
External = 1
}

View File

@ -37,6 +37,7 @@ import { DmpStatus } from '../../common/enum/dmp-status';
import { ValidationType } from '../../common/enum/validation-type';
import { DescriptionTemplateExternalSelectAuthType } from '@app/core/common/enum/description-template-external-select-auth-type';
import { DmpBlueprintFieldCategory } from '@app/core/common/enum/dmp-blueprint-field-category';
import { DmpUserType } from '@app/core/common/enum/dmp-user-type';
@Injectable()
export class EnumUtils {
@ -369,6 +370,13 @@ export class EnumUtils {
}
}
public toDmpUserTypeString(value: DmpUserType): string {
switch (value) {
case DmpUserType.Internal: return this.language.instant('TYPES.DMP-USER-TYPE.INTERNAL');
case DmpUserType.External: return this.language.instant('TYPES.DMP-USER-TYPE.EXTERNAL');
}
}
public toDescriptionTemplateExternalSelectHttpMethodTypeString(value: DescriptionTemplateExternalSelectHttpMethodType): string {
switch (value) {
case DescriptionTemplateExternalSelectHttpMethodType.GET: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-EXTERNAL-SELECT-HTTP-METHOD-TYPE.GET');

View File

@ -249,16 +249,31 @@
<span style="font-size: 15px;">{{userIndex + 1}}</span>
</div>
<div class="col-auto d-flex"><mat-icon [ngClass]="{'drag-handle-disabled': formGroup.disabled}" cdkDragHandle class="drag-handle">drag_indicator</mat-icon></div>
<div class="col-auto">
<mat-button-toggle-group name="fontStyle" aria-label="Font Style" [formControl]="user.get('userType')">
<div *ngFor="let userType of dmpUserTypeEnumValues">
<mat-button-toggle class="lang-button" [value]="userType">{{enumUtils.toDmpUserTypeString(userType)}}</mat-button-toggle>
</div>
</mat-button-toggle-group>
</div>
<div class="col pt-4">
<div class="row">
<div class="col">
<div class="col" *ngIf="user.get('userType').value == dmpUserTypeEnum.Internal">
<mat-form-field class="w-100">
<mat-label>{{'DMP-EDITOR.FIELDS1.USER' | translate}}</mat-label>
<app-single-auto-complete [required]= "true" [formControl]="user.get('user')" [hidePlaceholder]="true" [configuration]="userService.singleAutocompleteConfiguration"></app-single-auto-complete>
<mat-label>{{'DMP-EDITOR.FIELDS1.USER' | translate}}*</mat-label>
<app-single-auto-complete [formControl]="user.get('user')" [hidePlaceholder]="true" [configuration]="userService.singleAutocompleteConfiguration"></app-single-auto-complete>
<mat-error *ngIf="user.get('user').hasError('backendError')">{{user.get('user').getError('backendError').message}}</mat-error>
<mat-error *ngIf="user.get('user').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>
</div>
<div class="col" *ngIf="user.get('userType').value == dmpUserTypeEnum.External">
<mat-form-field class="w-100">
<mat-label>{{'DMP-EDITOR.FIELDS1.EMAIL' | translate}}*</mat-label>
<input matInput type="text" name="email" [formControl]="user.get('email')">
<mat-error *ngIf="user.get('email').hasError('backendError')">{{user.get('email').getError('backendError').message}}</mat-error>
<mat-error *ngIf="user.get('email').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.USER-ROLE' | translate}}</mat-label>

View File

@ -45,6 +45,7 @@ import { DmpEditorModel } from './dmp-editor.model';
import { DmpEditorResolver } from './dmp-editor.resolver';
import { DmpEditorService } from './dmp-editor.service';
import { DmpUserRole } from '@app/core/common/enum/dmp-user-role';
import { DmpUserType } from '@app/core/common/enum/dmp-user-type';
@Component({
selector: 'app-dmp-editor',
@ -68,6 +69,8 @@ export class DmpEditorComponent extends BaseEditor<DmpEditorModel, Dmp> implemen
dmpAccessTypeEnumValues = this.enumUtils.getEnumValues<DmpAccessType>(DmpAccessType);
dmpContactTypeEnum = DmpContactType;
dmpContactTypeEnumValues = this.enumUtils.getEnumValues<DmpContactType>(DmpContactType);
dmpUserTypeEnum = DmpUserType;
dmpUserTypeEnumValues = this.enumUtils.getEnumValues<DmpUserType>(DmpUserType);
dmpUserRoleEnumValues = this.enumUtils.getEnumValues<DmpUserRole>(DmpUserRole);
singleAutocompleteBlueprintConfiguration: SingleAutoCompleteConfiguration = {
initialItems: (data?: any) => this.dmpBlueprintService.query(this.dmpBlueprintService.buildAutocompleteLookup(null, null, null, [DmpBlueprintStatus.Finalized])).pipe(map(x => x.items)),

View File

@ -2421,6 +2421,10 @@
"INTERNAL": "Internal",
"EXTERNAL": "External"
},
"DMP-USER-TYPE": {
"INTERNAL": "Internal",
"EXTERNAL": "External"
},
"DMP-BLUEPRINT-FIELD-CATEGORY": {
"SYSTEM": "System",
"EXTRA": "Custom",