2018-03-28 15:24:47 +02:00
|
|
|
<div class="dmp-profile-editor">
|
2018-10-05 17:00:54 +02:00
|
|
|
<form *ngIf="formGroup" (ngSubmit)="formSubmit()" [formGroup]="formGroup">
|
|
|
|
<mat-card>
|
|
|
|
<mat-card-header>
|
|
|
|
<mat-card-title *ngIf="isNew">{{'DMP-PROFILE-EDITOR.TITLE.NEW' | translate}}</mat-card-title>
|
|
|
|
<mat-card-title *ngIf="!isNew">{{formGroup.get('label').value}}</mat-card-title>
|
2018-03-28 15:24:47 +02:00
|
|
|
|
2018-10-05 17:00:54 +02:00
|
|
|
</mat-card-header>
|
|
|
|
<mat-card-content>
|
2018-03-28 15:24:47 +02:00
|
|
|
|
2018-10-05 17:00:54 +02:00
|
|
|
<mat-form-field class="full-width">
|
|
|
|
<input matInput placeholder="{{'DMP-PROFILE-EDITOR.FIELDS.LABEL' | translate}}" type="text" name="label"
|
|
|
|
formControlName="label" required>
|
|
|
|
<mat-error *ngIf="formGroup.get('label').errors?.backendError">{{baseErrorModel.label}}</mat-error>
|
|
|
|
<mat-error *ngIf="formGroup.get('label').errors?.required">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
|
|
|
</mat-form-field>
|
2018-03-28 15:24:47 +02:00
|
|
|
|
2018-10-05 17:00:54 +02:00
|
|
|
<div formGroupName="definition">
|
|
|
|
<mat-list formArrayName="fields">
|
|
|
|
<mat-list-item *ngFor="let field of formGroup.controls.definition.controls.fields.controls;let i=index">
|
|
|
|
<div [formGroupName]="i">
|
|
|
|
<mat-form-field>
|
|
|
|
<input matInput placeholder="{{'DMP-PROFILE-EDITOR.FIELDS.LABEL' | translate}}" type="text" name="label"
|
|
|
|
formControlName="label" required>
|
|
|
|
<mat-error *ngIf="formGroup.get('definition').get('fields').get(''+i).get('label').errors?.required">{{baseErrorModel.label}}</mat-error>
|
|
|
|
<mat-error *ngIf="formGroup.get('definition').get('fields').get(''+i).get('label').errors?.backendError">{{'GENERAL.VALIDATION.REQUIRED'
|
|
|
|
| translate}}</mat-error>
|
|
|
|
</mat-form-field>
|
|
|
|
<mat-form-field>
|
|
|
|
<mat-select placeholder="{{'DMP-PROFILE-EDITOR.FIELDS.TYPE' | translate}}" formControlName="type">
|
|
|
|
<mat-option *ngFor="let fieldType of getDMPProfileFieldTypeValues()" [value]="fieldType">{{
|
|
|
|
getDMPProfileFieldTypeWithLanguage(fieldType) | translate}}</mat-option>
|
|
|
|
</mat-select>
|
|
|
|
<mat-error *ngIf="formGroup.get('definition').get('fields').get(''+i).get('type').errors?.required">{{baseErrorModel.type}}</mat-error>
|
|
|
|
<mat-error *ngIf="formGroup.get('definition').get('fields').get(''+i).get('type').errors?.backendError">{{'GENERAL.VALIDATION.REQUIRED'
|
|
|
|
| translate}}</mat-error>
|
|
|
|
</mat-form-field>
|
|
|
|
<mat-form-field>
|
|
|
|
<mat-select placeholder="{{'DMP-PROFILE-EDITOR.FIELDS.DATATYPE' | translate}}" formControlName="dataType">
|
|
|
|
<mat-option *ngFor="let fieldDataType of getDMPProfileFieldDataTypeValues()" [value]="fieldDataType">{{
|
|
|
|
getDMPProfileFieldDataTypeWithLanguage(fieldDataType) | translate}}</mat-option>
|
|
|
|
</mat-select>
|
|
|
|
<mat-error *ngIf="formGroup.get('definition').get('fields').get(''+i).get('dataType').errors?.required">{{baseErrorModel.dataType}}</mat-error>
|
|
|
|
<mat-error *ngIf="formGroup.get('definition').get('fields').get(''+i).get('dataType').errors?.backendError">{{'GENERAL.VALIDATION.REQUIRED'
|
|
|
|
| translate}}</mat-error>
|
|
|
|
</mat-form-field>
|
|
|
|
<mat-checkbox formControlName="required">
|
|
|
|
{{'DMP-PROFILE-EDITOR.FIELDS.REQUIRED' | translate}}
|
|
|
|
</mat-checkbox>
|
|
|
|
</div>
|
|
|
|
</mat-list-item>
|
|
|
|
<button mat-fab class="mat-fab-bottom-right" color="primary" type="button" (click)="addField()">
|
|
|
|
<mat-icon class="mat-24">add</mat-icon>
|
|
|
|
</button>
|
|
|
|
</mat-list>
|
|
|
|
</div>
|
|
|
|
<div layout="row" class="full-width text-right" align="end">
|
|
|
|
<button mat-raised-button color="primary" (click)="cancel()" type="button">{{'DMP-PROFILE-EDITOR.ACTIONS.CANCEL' |
|
|
|
|
translate}}</button>
|
|
|
|
<button mat-raised-button color="primary" type="submit">{{'DMP-PROFILE-EDITOR.ACTIONS.SAVE' | translate}}</button>
|
|
|
|
<button *ngIf="!isNew" mat-raised-button color="primary" type="button" (click)="delete()">{{'DMP-PROFILE-EDITOR.ACTIONS.DELETE'
|
|
|
|
| translate}}</button>
|
|
|
|
</div>
|
2018-03-28 15:24:47 +02:00
|
|
|
|
2018-10-05 17:00:54 +02:00
|
|
|
</mat-card-content>
|
|
|
|
</mat-card>
|
|
|
|
</form>
|
|
|
|
</div>
|