<main class="main-container animated fadeIn">
  <app-btn-navigate navigate="/sam/GIST" nameButton="Gestión de Inventario y/o Stock" />
  <mat-card class="override-card override-elevation-z8">
    <section class="override-section">
      <nav class="override-nav">
        <div class="w-100 align-center pv-15">
          <span class="title-card">Gestión de emplazamiento del stock</span>
        </div>
        <div class="override-actions">
          <app-search-card 
          [dataSource]="dataSource" 
          [disabled]="isLoading || isLoadingForm" 
          (dataValue)="dataSource = $event" />

          <div class="override-buttons">
            <!-- <app-btn-resize 
            class="mr-8"
            (click)="goForm('REG')"
            [disabled]="isLoading || isLoadingForm"
            [backgroundColor]="'primary'" 
            [textColor]="'white_font'" 
            [nameButton]="'Nuevo'" 
            [icon]="'add'"/> -->
            <button 
            mat-mini-fab 
            matTooltip="Actualizar datos"
            (click)="getLocationStock()"
            class="orange_primary_background white_font override_no_shadow ml-8">
              <mat-icon>refresh</mat-icon>
            </button>
          </div>
        </div>
      </nav>

      <app-loading-card 
        [isLoading]="isLoading" 
        [isLoadingForm]="isLoadingForm" 
        [txtLoading]="'Cargando información del emplazamiento del stock'"
      />

      <div class="override-table">
        <table mat-table matSort [dataSource]="dataSource" class="animated fadeIn" [style.display]="isLoading ? 'none' : 'revert'">
          <ng-container matColumnDef="ID_STOCK">
            <th mat-header-cell *matHeaderCellDef mat-sort-header> No </th>
            <td mat-cell *matCellDef="let element"> {{ element.ID_STOCK }} </td>
          </ng-container>
          <ng-container matColumnDef="ID_UBICACION">
            <th mat-header-cell *matHeaderCellDef mat-sort-header> ID Ubicación </th>
            <td mat-cell *matCellDef="let element"> {{ element.ID_UBICACION  }} </td>
          </ng-container>
          <ng-container matColumnDef="CODIGO_EQUIPAMIENTO">
            <th mat-header-cell *matHeaderCellDef mat-sort-header> Código equipamiento </th>
            <td mat-cell *matCellDef="let element"> {{ element.CODIGO_EQUIPAMIENTO }} </td>
          </ng-container>
          <ng-container matColumnDef="USUARIO_MODIFICA">
            <th mat-header-cell *matHeaderCellDef mat-sort-header> Usuario modificación </th>
            <td mat-cell *matCellDef="let element"> {{ element.USUARIO_MODIFICA }} </td>
          </ng-container>
          <ng-container matColumnDef="FECHA_MODIFICA">
            <th mat-header-cell *matHeaderCellDef mat-sort-header> Fecha de actualización </th>
            <td mat-cell *matCellDef="let element"> {{ element.FECHA_MODIFICA }} </td>
          </ng-container>
          <ng-container matColumnDef="ESTADO">
            <th mat-header-cell *matHeaderCellDef mat-sort-header> Estado </th>
            <td mat-cell *matCellDef="let element"> 
              <button mat-flat-button class="white_font" [class]="resourcesService.setChipList(element.ESTADO)">
                {{ element.ESTADO }}
              </button>
            </td>
          </ng-container>
          <ng-container matColumnDef="ACCIONES">
            <th mat-header-cell *matHeaderCellDef mat-sort-header> Acciones </th>
            <td mat-cell *matCellDef="let element">
              <button 
              mat-mini-fab 
              color="primary" 
              matTooltip="Historial de emplazamientos" 
              class="override_no_shadow pink_primary_background white_font" 
              (click)="openHistoryLocationStock(element.ID_STOCK)">
                <mat-icon>history</mat-icon>
              </button>
            </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, 20, 50]" class="override-paginator" showFirstLastButtons></mat-paginator>
  </mat-card>
</main>