<!--

    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 tb-form-panel no-border no-padding" [formGroup]="mobileAppQRCodeWidgetSettingsForm">
  <div class="tb-form-panel no-border no-padding">
    <div class="tb-form-row no-border no-padding-bottom">
      <mat-slide-toggle class="mat-slide" formControlName="useSystemSettings" (click)="$event.stopPropagation()">
        {{ 'admin.mobile-app.use-system-settings' | translate }}
      </mat-slide-toggle>
    </div>
  </div>
  @if (!mobileAppQRCodeWidgetSettingsForm.get('useSystemSettings').value) {
    <div class="tb-form-panel no-border no-padding">
      <div class="tb-form-panel" formGroupName="qrCodeConfig">
        <div class="tb-form-panel-title" translate>widget-config.card-style</div>
        <div class="tb-form-hint tb-primary-fill">{{ 'widgets.mobile-app-qr-code.configuration-hint' | translate }}</div>
        <div class="tb-form-panel stroked no-padding no-gap">
          <div class="tb-form-row space-between no-border no-padding-bottom column-xs">
            <mat-slide-toggle class="mat-slide fixed-title-width-230" formControlName="badgeEnabled"
                              (click)="$event.stopPropagation()">
              {{ 'admin.mobile-app.badges' | translate }}
            </mat-slide-toggle>
            <mat-form-field class="flex" appearance="outline" subscriptSizing="dynamic">
              <mat-select formControlName="badgePosition" appearance="outline" subscriptSizing="dynamic">
                @for (badgePosition of badgePositionTranslationsMap | keyvalue; track badgePosition) {
                  <mat-option [value]="badgePosition.key">
                    {{ badgePosition.value | translate }}
                  </mat-option>
                }
              </mat-select>
            </mat-form-field>
          </div>
        </div>
        <div class="tb-form-panel stroked no-padding no-gap">
          <div class="tb-form-row space-between no-border no-padding-bottom column-xs">
            <mat-slide-toggle class="mat-slide fixed-title-width-230" formControlName="qrCodeLabelEnabled" (click)="$event.stopPropagation()">
              {{ 'admin.mobile-app.label' | translate }}
            </mat-slide-toggle>
            <mat-form-field class="flex" appearance="outline" subscriptSizing="dynamic">
              <input matInput formControlName="qrCodeLabel" placeholder="{{'admin.mobile-app.set' | translate}}">
            </mat-form-field>
          </div>
        </div>
      </div>
      <div class="tb-form-panel no-border no-padding">
        <div class="tb-form-row space-between">
          <div>{{ 'widgets.background.background' | translate }}</div>
          <tb-background-settings formControlName="background">
          </tb-background-settings>
        </div>
      </div>
      <div class="tb-form-row space-between">
        <div>{{ 'widget-config.card-padding' | translate }}</div>
        <mat-form-field appearance="outline" subscriptSizing="dynamic">
          <input matInput formControlName="padding" placeholder="{{ 'widget-config.set' | translate }}">
        </mat-form-field>
      </div>
    </div>
  }
</section>
