You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
69 lines
3.9 KiB
HTML
69 lines
3.9 KiB
HTML
<div class="dmp-profile-editor">
|
|
<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>
|
|
|
|
</mat-card-header>
|
|
<mat-card-content>
|
|
|
|
<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').hasError('backendError')">{{baseErrorModel.label}}</mat-error>
|
|
<mat-error *ngIf="formGroup.get('label').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
|
</mat-form-field>
|
|
|
|
<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').hasError('required')">{{baseErrorModel.label}}</mat-error>
|
|
<mat-error *ngIf="formGroup.get('definition').get('fields').get(''+i).get('label').hasError('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').hasError('required')">{{baseErrorModel.type}}</mat-error>
|
|
<mat-error *ngIf="formGroup.get('definition').get('fields').get(''+i).get('type').hasError('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').hasError('required')">{{baseErrorModel.dataType}}</mat-error>
|
|
<mat-error *ngIf="formGroup.get('definition').get('fields').get(''+i).get('dataType').hasError('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>
|
|
|
|
</mat-card-content>
|
|
</mat-card>
|
|
</form>
|
|
</div>
|