<div [formGroup]="optionsFormGroup">
  <div *ngFor="let option of options; let last = last">
    <div class="form-group"
         [ngClass]="{'has-error': optionsForm.showError(option.name, optionsFormDir)}"
         *ngIf="option.type === 'bool'">
      <label class="col-sm-6 control-label"
             [for]="option.name">
        {{ option.text }}
        <br>
        <span class="text-muted">
          {{ option.desc }}
          <cd-helper *ngIf="option.long_desc">
            {{ option.long_desc }}</cd-helper>
        </span>
      </label>
      <div class="col-sm-6 checkbox-primary checkbox">
        <input type="checkbox"
               [id]="option.name"
               [formControlName]="option.name">
        <label></label>
      </div>
    </div>
    <div class="form-group"
         [ngClass]="{'has-error': optionsForm.showError(option.name, optionsFormDir)}"
         *ngIf="option.type !== 'bool'">
      <label class="col-sm-6 control-label"
             [for]="option.name">{{ option.text }}
        <br>
        <span class="text-muted">
          {{ option.desc }}
          <cd-helper *ngIf="option.long_desc">
            {{ option.long_desc }}</cd-helper>
        </span>
      </label>
      <div class="col-sm-6">
        <div class="input-group">
          <input class="form-control"
                 [type]="option.additionalTypeInfo.inputType"
                 [id]="option.name"
                 [placeholder]="option.additionalTypeInfo.humanReadable"
                 [formControlName]="option.name"
                 [step]="getStep(option.type, optionsForm.getValue(option.name))">
          <span class="input-group-btn"
                *ngIf="optionsFormShowReset">
            <button class="btn btn-default"
                    type="button"
                    data-toggle="button"
                    title="Remove the custom configuration value. The default configuration will be inherited and used instead."
                    (click)="resetValue(option.name)"
                    i18n-title>
              <i class="fa fa-eraser"
                 aria-hidden="true"></i>
            </button>
          </span>
        </div>
        <span class="help-block"
              *ngIf="optionsForm.showError(option.name, optionsFormDir, 'pattern')">
          {{ option.additionalTypeInfo.patternHelpText }}</span>
        <span class="help-block"
              *ngIf="optionsForm.showError(option.name, optionsFormDir, 'invalidUuid')">
          {{ option.additionalTypeInfo.patternHelpText }}</span>
        <span class="help-block"
              *ngIf="optionsForm.showError(option.name, optionsFormDir, 'max')"
              i18n>The entered value is too high! It must not be greater than {{ option.maxValue }}.</span>
        <span class="help-block"
              *ngIf="optionsForm.showError(option.name, optionsFormDir, 'min')"
              i18n>The entered value is too low! It must not be lower than {{ option.minValue }}.</span>
      </div>
    </div>
    <hr *ngIf="!last">
  </div>
</div>
