<section class="content">
  <div class="container-fluid">
    <div class="row align-items-center">
      <!-- Left-hand side: Title -->
      <div class="col-md-6 mb-2">
        <span class="mb-0 page-title">{{'ACTIONS' | translate}}</span>
        <app-page-help-text [code]="'ACTIONS'"></app-page-help-text>
      </div>
      <!-- Right-hand side: Buttons -->
      <div class="col-md-6 d-flex justify-content-end mb-2">
        <button *hasClaim="'action_add'" class="btn btn-success btn-sm" (click)="manageAction()">
          <i-feather name="plus"></i-feather>
          {{'ADD_ACTION' | translate}}
        </button>
      </div>
    </div>
<div class="loading-shade" *ngIf="!loading">
  <mat-spinner></mat-spinner>
</div>
<div class="card">
  <div class="body">
    <div class="table-responsive">
      <div class="grid-height-large">
      <table mat-table [dataSource]="actions" class="table">
        <!-- Action Column -->
        <ng-container matColumnDef="action">
          <th style="width:30%" mat-header-cell *matHeaderCellDef> {{"ACTION" | translate}} </th>
          <td style="width:30%" mat-cell *matCellDef="let element">
            <button *hasClaim="'action_edit'" (click)="manageAction(element)" class="btn btn-success btn-sm me-2"
              type="button">
              <i-feather name="edit" class="small-icon"></i-feather>
              <span class="d-none d-sm-inline"> {{"EDIT" | translate}}</span>
            </button>
            <button *hasClaim="'action_delete'" (click)="deleteAction(element)" class="btn btn-danger btn-sm"
              type="button">
              <i-feather name="trash" class="small-icon"></i-feather>
              <span class="d-none d-sm-inline"> {{"DELETE" | translate}}</span>
            </button>
          </td>
        </ng-container>
        <!-- Name Column -->
        <ng-container matColumnDef="name">
          <th mat-header-cell *matHeaderCellDef> {{"NAME" | translate}} </th>
          <td mat-cell *matCellDef="let element"> {{element.name}} </td>
        </ng-container>

        <tr mat-header-row *matHeaderRowDef="displayedColumns;sticky: true"></tr>
        <tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
      </table>
      </div>
    </div>
  </div>
</div>
  </div>
</section>

