<!--

    Copyright © 2016-2026 The Thingsboard Authors

    Licensed 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]="simpleCardWidgetConfigForm">
  @if (displayTimewindowConfig) {
    <tb-timewindow-config-panel
      [onlyHistoryTimewindow]="onlyHistoryTimewindow()"
      formControlName="timewindowConfig">
    </tb-timewindow-config-panel>
  }
  <tb-datasources
    [configMode]="basicMode"
    hideDataKeyLabel
    hideDataKeyColor
    hideDataKeyUnits
    hideDataKeyDecimals
    formControlName="datasources">
  </tb-datasources>
  <div class="tb-form-panel">
    <div class="tb-form-panel-title" translate>widget-config.appearance</div>
    <div class="tb-form-row">
      <div class="fixed-title-width" translate>widgets.simple-card.label</div>
      <tb-string-pattern-autocomplete class="flex-1"
                                      appearance="outline"
                                      brackets="curly"
                                      subscriptSizing="dynamic"
                                      predefinedValuesButton="true"
                                      [predefinedValues]="predefinedValues"
                                      placeholderText="{{ 'widget-config.set' | translate }}"
                                      formControlName="label"
      ></tb-string-pattern-autocomplete>
    </div>
    <div class="tb-form-row space-between">
      <div translate>widgets.simple-card.label-position</div>
      <mat-form-field appearance="outline" subscriptSizing="dynamic">
        <mat-select formControlName="labelPosition">
          <mat-option [value]="'left'">
            {{ 'widgets.simple-card.label-position-left' | translate }}
          </mat-option>
          <mat-option [value]="'top'">
            {{ 'widgets.simple-card.label-position-top' | translate }}
          </mat-option>
        </mat-select>
      </mat-form-field>
    </div>
    <div class="tb-form-row space-between">
      <div translate>widget-config.units-short</div>
      <tb-unit-input
        formControlName="units">
      </tb-unit-input>
    </div>
    <div class="tb-form-row space-between">
      <div translate>widget-config.decimals-short</div>
      <mat-form-field appearance="outline" class="number" subscriptSizing="dynamic">
        <input matInput formControlName="decimals" type="number" min="0" max="15" step="1" placeholder="{{ 'widget-config.set' | translate }}">
      </mat-form-field>
    </div>
    <div class="tb-form-row space-between column-lt-md">
      <div translate>widget-config.show-card-buttons</div>
      <mat-chip-listbox multiple formControlName="cardButtons">
        <mat-chip-option value="fullscreen">{{ 'fullscreen.fullscreen' | translate }}</mat-chip-option>
      </mat-chip-listbox>
    </div>
    <div class="tb-form-row space-between">
      <div>{{ 'widget-config.text-color' | translate }}</div>
      <tb-color-input asBoxInput
                      formControlName="color">
      </tb-color-input>
    </div>
    <div class="tb-form-row space-between">
      <div>{{ 'widget-config.background' | translate }}</div>
      <tb-color-input asBoxInput
                      formControlName="backgroundColor">
      </tb-color-input>
    </div>
  </div>
  <tb-widget-actions-panel
    formControlName="actions">
  </tb-widget-actions-panel>
</ng-container>
