blob: 258d4c6b66adc2258db3042b127999a772a50eaf [file] [log] [blame]
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<ng-container [formGroup]="form">
<div layout="row">
<fims-id-input [form]="form" controlName="identifier"></fims-id-input>
<fims-text-input [form]="form" controlName="label" placeholder="{{'Label' | translate}}"></fims-text-input>
</div>
<fims-text-input [form]="form" controlName="hint" placeholder="{{'Hint(Optional)' | translate}}"></fims-text-input>
<div layout="row">
<mat-form-field layout-margin flex>
<textarea matInput placeholder="{{'Description(Optional)' | translate}}" formControlName="description"></textarea>
</mat-form-field>
</div>
<mat-checkbox layout-margin formControlName="mandatory" translate>Mandatory?</mat-checkbox>
<mat-radio-group formControlName="dataType">
<mat-radio-button *ngFor="let type of dataTypeOptions" [value]="type.type" layout-margin>
{{type.label}}
</mat-radio-button>
</mat-radio-group>
<div layout="row">
<fims-text-input [hideIfDisabled]="true" type="number" [form]="form" controlName="length" placeholder="{{'Length' | translate}}"></fims-text-input>
<fims-text-input [hideIfDisabled]="true" type="number" [form]="form" controlName="precision" placeholder="{{'Max digits' | translate}}"></fims-text-input>
<fims-text-input [hideIfDisabled]="true" type="number" [form]="form" controlName="minValue" placeholder="{{'Min value' | translate}}"></fims-text-input>
<fims-text-input [hideIfDisabled]="true" type="number" [form]="form" controlName="maxValue" placeholder="{{'Max value' | translate}}"></fims-text-input>
</div>
<div layout-gt-xs="column" layout-margin formArrayName="options" *ngIf="options.enabled">
<h4 translate>Options</h4>
<div *ngFor="let option of options.controls; let i=index" [formGroupName]="i" layout="row">
<fims-text-input [form]="option" controlName="label" placeholder="{{'Label' | translate}}"></fims-text-input>
<fims-text-input type="number" [form]="option" controlName="value" placeholder="{{'Value' | translate}}"></fims-text-input>
<button mat-button (click)="removeOption(i)">{{'Remove option' | translate}}</button>
</div>
<p *ngIf="form.get('options').hasError('optionValueUnique')" class="tc-red-600" translate>
Values can't overlap with other values.
</p>
<button mat-button (click)="addOption()">{{'Add option' | translate}}</button>
</div>
</ng-container>