<!--

    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.

-->
<button color="primary"
        matTooltip="{{buttonDisplayValue}}"
        matTooltipPosition="above"
        mat-stroked-button
        (click)="toggleAuditLogFilterPanel($event)">
  <mat-icon>filter_list</mat-icon>{{buttonDisplayValue}}
</button>
<ng-template #auditLogFilterPanel>
  <form class="tb-audit-log-config-component mat-content mat-padding flex flex-col" [formGroup]="auditLogFilterForm" (ngSubmit)="update()">
    <div class="tb-form-panel no-padding no-border flex-1">
      <div class="tb-form-row space-between column-xs flex-1">
        <div class="fixed-title-width" translate>audit-log.filter-types</div>
        <tb-string-items-list appearance="outline"
                              class="flex flex-1 gt-xs:w-64"
                              subscriptSizing="dynamic"
                              placeholder="{{ !auditLogFilterForm.get('actionTypes').value?.length ? ('audit-log.any-type' | translate) : '' }}"
                              [predefinedValues]="predefinedTypeValues"
                              formControlName="actionTypes">
        </tb-string-items-list>
      </div>
    </div>
    <div class="tb-panel-actions flex flex-row items-center justify-end">
      <button type="button"
              mat-button
              color="primary"
              (click)="reset()">
        {{ 'action.reset' | translate }}
      </button>
      <span class="flex-1"></span>
      <button type="button"
              mat-button
              (click)="cancel()">
        {{ 'action.cancel' | translate }}
      </button>
      <button type="submit"
              mat-raised-button
              color="primary"
              [disabled]="auditLogFilterForm.invalid || !auditLogFilterForm.dirty">
        {{ 'action.update' | translate }}
      </button>
    </div>
  </form>
</ng-template>
