<!--

    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.

-->
<section class="tb-widget-settings flex flex-col" [formGroup]="dateRangeNavigatorWidgetSettingsForm">
  <fieldset class="fields-group fields-group-slider">
    <legend class="group-title" translate>widgets.date-range-navigator.date-range-picker-settings</legend>
    <mat-expansion-panel class="tb-settings" [expanded]="!dateRangeNavigatorWidgetSettingsForm.get('hidePicker').value">
      <mat-expansion-panel-header class="flex flex-row flex-wrap">
        <mat-panel-title>
          <mat-slide-toggle formControlName="hidePicker" (click)="$event.stopPropagation()"
                            class="flex items-stretch justify-center">
            {{ 'widgets.date-range-navigator.hide-date-range-picker' | translate }}
          </mat-slide-toggle>
        </mat-panel-title>
        <mat-panel-description class="flex items-center justify-end xs:!hidden" translate>
          widget-config.advanced-settings
        </mat-panel-description>
      </mat-expansion-panel-header>
      <ng-template matExpansionPanelContent>
        <section class="flex flex-1 flex-col">
          <mat-checkbox formControlName="onePanel">
            {{ 'widgets.date-range-navigator.picker-one-panel' | translate }}
          </mat-checkbox>
          <mat-checkbox formControlName="autoConfirm">
            {{ 'widgets.date-range-navigator.picker-auto-confirm' | translate }}
          </mat-checkbox>
          <mat-checkbox formControlName="showTemplate">
            {{ 'widgets.date-range-navigator.picker-show-template' | translate }}
          </mat-checkbox>
          <mat-form-field class="mat-block flex-1" appearance="outline">
            <mat-label translate>widgets.date-range-navigator.first-day-of-week</mat-label>
            <input matInput type="number" min="1" max="7" step="1" formControlName="firstDayOfWeek">
          </mat-form-field>
        </section>
      </ng-template>
    </mat-expansion-panel>
  </fieldset>
  <fieldset class="fields-group fields-group-slider">
    <legend class="group-title" translate>widgets.date-range-navigator.interval-settings</legend>
    <mat-expansion-panel class="tb-settings" [expanded]="!dateRangeNavigatorWidgetSettingsForm.get('hideInterval').value">
      <mat-expansion-panel-header class="flex flex-row flex-wrap">
        <mat-panel-title>
          <mat-slide-toggle formControlName="hideInterval" (click)="$event.stopPropagation()"
                            class="flex items-stretch justify-center">
            {{ 'widgets.date-range-navigator.hide-interval' | translate }}
          </mat-slide-toggle>
        </mat-panel-title>
        <mat-panel-description class="flex items-center justify-end xs:!hidden" translate>
          widget-config.advanced-settings
        </mat-panel-description>
      </mat-expansion-panel-header>
      <ng-template matExpansionPanelContent>
        <mat-form-field class="mat-block flex-1" appearance="outline">
          <mat-label translate>widgets.date-range-navigator.initial-interval</mat-label>
          <mat-select formControlName="initialInterval">
            <mat-option [value]="'hour'">
              {{ 'widgets.date-range-navigator.interval-hour' | translate }}
            </mat-option>
            <mat-option [value]="'day'">
              {{ 'widgets.date-range-navigator.interval-day' | translate }}
            </mat-option>
            <mat-option [value]="'week'">
              {{ 'widgets.date-range-navigator.interval-week' | translate }}
            </mat-option>
            <mat-option [value]="'twoWeeks'">
              {{ 'widgets.date-range-navigator.interval-two-weeks' | translate }}
            </mat-option>
            <mat-option [value]="'month'">
              {{ 'widgets.date-range-navigator.interval-month' | translate }}
            </mat-option>
            <mat-option [value]="'threeMonths'">
              {{ 'widgets.date-range-navigator.interval-three-months' | translate }}
            </mat-option>
            <mat-option [value]="'sixMonths'">
              {{ 'widgets.date-range-navigator.interval-six-months' | translate }}
            </mat-option>
          </mat-select>
        </mat-form-field>
      </ng-template>
    </mat-expansion-panel>
  </fieldset>
  <fieldset class="fields-group fields-group-slider">
    <legend class="group-title" translate>widgets.date-range-navigator.step-settings</legend>
    <mat-expansion-panel class="tb-settings" [expanded]="!dateRangeNavigatorWidgetSettingsForm.get('hideStepSize').value">
      <mat-expansion-panel-header class="flex flex-row flex-wrap">
        <mat-panel-title>
          <mat-slide-toggle formControlName="hideStepSize" (click)="$event.stopPropagation()"
                            class="flex items-stretch justify-center">
            {{ 'widgets.date-range-navigator.hide-step-size' | translate }}
          </mat-slide-toggle>
        </mat-panel-title>
        <mat-panel-description class="flex items-center justify-end xs:!hidden" translate>
          widget-config.advanced-settings
        </mat-panel-description>
      </mat-expansion-panel-header>
      <ng-template matExpansionPanelContent>
        <mat-form-field class="mat-block flex-1" appearance="outline">
          <mat-label translate>widgets.date-range-navigator.initial-step-size</mat-label>
          <mat-select formControlName="stepSize">
            <mat-option [value]="'hour'">
              {{ 'widgets.date-range-navigator.interval-hour' | translate }}
            </mat-option>
            <mat-option [value]="'day'">
              {{ 'widgets.date-range-navigator.interval-day' | translate }}
            </mat-option>
            <mat-option [value]="'week'">
              {{ 'widgets.date-range-navigator.interval-week' | translate }}
            </mat-option>
            <mat-option [value]="'twoWeeks'">
              {{ 'widgets.date-range-navigator.interval-two-weeks' | translate }}
            </mat-option>
            <mat-option [value]="'month'">
              {{ 'widgets.date-range-navigator.interval-month' | translate }}
            </mat-option>
            <mat-option [value]="'threeMonths'">
              {{ 'widgets.date-range-navigator.interval-three-months' | translate }}
            </mat-option>
            <mat-option [value]="'sixMonths'">
              {{ 'widgets.date-range-navigator.interval-six-months' | translate }}
            </mat-option>
          </mat-select>
        </mat-form-field>
      </ng-template>
    </mat-expansion-panel>
  </fieldset>
  <mat-slide-toggle formControlName="hideLabels" class="slide-block">
    {{ 'widgets.date-range-navigator.hide-labels' | translate }}
  </mat-slide-toggle>
  <mat-slide-toggle formControlName="useSessionStorage" class="slide-block">
    {{ 'widgets.date-range-navigator.use-session-storage' | translate }}
  </mat-slide-toggle>
</section>
