<!--

    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" [formGroup]="tripAnimationPointSettingsFormGroup">
  <fieldset class="fields-group fields-group-slider">
    <legend class="group-title" translate>widgets.maps.points-settings</legend>
    <mat-expansion-panel class="tb-settings" [expanded]="tripAnimationPointSettingsFormGroup.get('showPoints').value">
      <mat-expansion-panel-header class="flex-wrap">
        <mat-panel-title>
          <mat-slide-toggle formControlName="showPoints" (click)="$event.stopPropagation()">
            {{ 'widgets.maps.show-points' | translate }}
          </mat-slide-toggle>
        </mat-panel-title>
        <mat-panel-description class="justify-end xs:!hidden" translate>
          widget-config.advanced-settings
        </mat-panel-description>
      </mat-expansion-panel-header>
      <ng-template matExpansionPanelContent>
        <section class="flex flex-col gt-xs:flex-row gt-xs:gap-2">
          <tb-color-input
            class="flex-1"
            formControlName="pointColor"
            icon="format_color_fill"
            label="{{ 'widgets.maps.point-color' | translate }}" openOnInput colorClearButton>
          </tb-color-input>
          <mat-form-field class="flex-1">
            <mat-label translate>widgets.maps.point-size</mat-label>
            <input matInput type="number" min="1" formControlName="pointSize">
          </mat-form-field>
        </section>
        <mat-expansion-panel class="tb-settings" [expanded]="tripAnimationPointSettingsFormGroup.get('useColorPointFunction').value">
          <mat-expansion-panel-header class="flex-wrap">
            <mat-panel-title>
              <mat-slide-toggle formControlName="useColorPointFunction" (click)="$event.stopPropagation()">
                {{ 'widgets.maps.use-point-color-function' | translate }}
              </mat-slide-toggle>
            </mat-panel-title>
            <mat-panel-description class="justify-end xs:!hidden" translate>
              widget-config.advanced-settings
            </mat-panel-description>
          </mat-expansion-panel-header>
          <ng-template matExpansionPanelContent>
            <tb-js-func formControlName="colorPointFunction"
                        withModules
                        [globalVariables]="functionScopeVariables"
                        [functionArgs]="['data', 'dsData', 'dsIndex']"
                        functionTitle="{{ 'widgets.maps.point-color-function' | translate }}"
                        helpId="widget/lib/map-legacy/path_point_color_fn">
            </tb-js-func>
          </ng-template>
        </mat-expansion-panel>
        <mat-expansion-panel class="tb-settings" [expanded]="tripAnimationPointSettingsFormGroup.get('usePointAsAnchor').value">
          <mat-expansion-panel-header class="flex-wrap">
            <mat-panel-title>
              <mat-slide-toggle formControlName="usePointAsAnchor" (click)="$event.stopPropagation()">
                {{ 'widgets.maps.use-point-as-anchor' | translate }}
              </mat-slide-toggle>
            </mat-panel-title>
            <mat-panel-description class="justify-end xs:!hidden" translate>
              widget-config.advanced-settings
            </mat-panel-description>
          </mat-expansion-panel-header>
          <ng-template matExpansionPanelContent>
            <tb-js-func formControlName="pointAsAnchorFunction"
                        withModules
                        [globalVariables]="functionScopeVariables"
                        [functionArgs]="['data', 'dsData', 'dsIndex']"
                        functionTitle="{{ 'widgets.maps.point-as-anchor-function' | translate }}"
                        helpId="widget/lib/map-legacy/trip_point_as_anchor_fn">
            </tb-js-func>
          </ng-template>
        </mat-expansion-panel>
        <mat-slide-toggle formControlName="pointTooltipOnRightPanel" class="slide-block">
          {{ 'widgets.maps.independent-point-tooltip' | translate }}
        </mat-slide-toggle>
      </ng-template>
    </mat-expansion-panel>
  </fieldset>
</section>
