<main class="main-container animated fadeIn" >

  <app-btn-navigate [navigate]="'/sam/ANFA'" [nameButton]="'Menú de análisis de fallas'" />

  <mat-card class="override-card override-elevation-z8">  
      <section class="override-section">
          <nav class="override-nav">
              <mat-card-title class="mat-card-title centre">Emisión de alarmas</mat-card-title>
              <div class="override-actions">
                  <app-search-card
                      [dataSource]="dataSource"
                      [disabled]="isLoading"
                      (dataValue)="dataSource = $event"
                  />
                  <div class="override-buttons">
                      <button 
                          mat-mini-fab 
                          class="orange_primary_background white_font override_no_shadow ml-8" 
                          (click)="getAlarmEmissionFromFailures()"
                          matTooltip="Actualizar datos">
                          <mat-icon>refresh</mat-icon>
                      </button>
                  </div>
              </div>
          </nav>

          <app-loading-card 
              [isLoading]="isLoading" 
              [txtLoading]="'Cargando la emisión de alarmas'"
          />

          <div class="override-table">
              <table mat-table [dataSource]="dataSource" matSort class="animated fadeIn" [style.display]="isLoading ? 'none' : 'revert'">

                  <ng-container matColumnDef="NUMERO_FALLA">
                      <th mat-header-cell *matHeaderCellDef mat-sort-header>Número de falla</th>
                      <td mat-cell *matCellDef="let element">{{ element.NUMERO_FALLA }}</td>
                  </ng-container>
                  <ng-container matColumnDef="CODIGO_EQUIPAMIENTO">
                      <th mat-header-cell *matHeaderCellDef mat-sort-header>Código del equipamiento</th>
                      <td mat-cell *matCellDef="let element">{{ element.CODIGO_EQUIPAMIENTO }}</td>
                  </ng-container>
                  <ng-container matColumnDef="ID_ACTIVADOR">
                      <th mat-header-cell *matHeaderCellDef mat-sort-header>ID del activador</th>
                      <td mat-cell *matCellDef="let element">{{ element.ID_ACTIVADOR }}</td>
                  </ng-container>
                  <ng-container matColumnDef="FECHA_FALLA">
                      <th mat-header-cell *matHeaderCellDef mat-sort-header>Fecha de la falla</th>
                      <td mat-cell *matCellDef="let element">{{ element.FECHA_FALLA }}</td>
                  </ng-container>
                  <ng-container matColumnDef="PRIORIDAD">
                      <th mat-header-cell *matHeaderCellDef mat-sort-header>Prioridad</th>
                      <td mat-cell *matCellDef="let element">
                          <button mat-flat-button class="white_font" [class]="resourcesService.setChipList(element.PRIORIDAD)">
                              {{ element.PRIORIDAD }} 
                          </button>
                      </td>
                  </ng-container>
                  <ng-container matColumnDef="TIPO_ACTIVADOR">
                      <th mat-header-cell *matHeaderCellDef mat-sort-header>Tipo de activador</th>
                      <td mat-cell *matCellDef="let element">{{ element.TIPO_ACTIVADOR }}</td>
                  </ng-container>

                  <tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
                  <tr mat-row *matRowDef="let row; columns: displayedColumns"></tr>

                  <tr class="mat-row" *matNoDataRow>
                      <td class="mat-cell p-20 align-center" colspan="12">
                      <object data="assets/img/empty_data.svg" width="150"></object>
                      <h2>Sin datos</h2>
                      </td>
                  </tr>

              </table>
          </div>
      </section>
      <mat-paginator [pageSizeOptions]="[10, 50, 100]" class="override-paginator"></mat-paginator>
  </mat-card>
</main>