<div class="main-container animated fadeIn" (window:resize)="onResize($event)">
    <div [class]="card_size">
        <h1 class="title-card">Seguimiento de avances</h1>

        <!-- BUSCADOR Y BOTÓN DE REGISTRP -->
        <div align="center" class="w-100 mb-10">
            <div style="display: inline-block; width: 80%">
                <!-- PAGINADOR -->
                <mat-form-field appearance="fill">
                    <mat-label>Buscador</mat-label>
                    <input matInput (keyup)="applyFilter($event)" placeholder="Ingrese la palabra a buscar">
                    <mat-icon matSuffix>search</mat-icon>
                </mat-form-field>
            </div>
        </div>

        <div class="is-loading animated fadeIn fast" *ngIf="isLoading">
            <mat-spinner align="center"></mat-spinner>
            <h3>Cargando datos ...</h3>
        </div>

        <mat-progress-bar mode="indeterminate" *ngIf="isLoadingForm"></mat-progress-bar>

        <table mat-table [dataSource]="dataSource" class="animated fadeIn" *ngIf="!isLoading">
            <ng-container matColumnDef="name">
                <th mat-header-cell *matHeaderCellDef>
                    Workflow
                </th>
                <td mat-cell *matCellDef="let element">
                    {{ element.workflow.name }}
                </td>
            </ng-container>

            <ng-container matColumnDef="module">
                <th mat-header-cell *matHeaderCellDef>Modulo</th>
                <td mat-cell *matCellDef="let element">
                    {{ element.module }}
                </td>
            </ng-container>

            <ng-container matColumnDef="created_at">
                <th mat-header-cell *matHeaderCellDef>Fecha de la solicitud</th>
                <td mat-cell *matCellDef="let element">
                    {{ element.created_at }}
                </td>
            </ng-container>

            <ng-container matColumnDef="action">
                <th mat-header-cell *matHeaderCellDef class="">{{ 'workflow.detalle.tabla.acciones' | translate }}
                </th>
                <td mat-cell *matCellDef="let element" class=" table-action">
                    <button mat-mini-fab class="mr-1 secondary" (click)="openAdavanceRequest(element)"
                        matTooltip="{{ 'workflow.historial.notificaciones.tabla.detalle' | translate }}">
                        <mat-icon>remove_red_eye</mat-icon>
                    </button>
                </td>
            </ng-container>

            <ng-container matColumnDef="acciones">
                <th mat-header-cell *matHeaderCellDef style="text-align: center">
                    Acciones
                </th>
                <td mat-cell *matCellDef="let element" style="text-align: center">
                    <div *ngIf="btnSmall">
                        <button mat-mini-fab color="accent" [matMenuTriggerFor]="menu" #menuTrigger
                            class="no-shadow">
                            <mat-icon>settings</mat-icon>
                        </button>
                        <mat-menu #menu="matMenu">
                            <button [disabled]="isLoadingForm" mat-menu-item (click)="openAdavanceRequest(element)">
                                <mat-icon>remove_red_eye</mat-icon>
                                Ver avance
                            </button>
                        </mat-menu>
                    </div>
                    <div *ngIf="!btnSmall">
                        <button mat-mini-fab color="primary" class="button-accion" [disabled]="isLoadingForm"
                            matTooltip="{{ 'workflow.historial.notificaciones.tabla.detalle' | translate }}"
                            (click)="openAdavanceRequest(element)">
                            <mat-icon>remove_red_eye</mat-icon>
                        </button>
                    </div>
                </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-80 centre" colspan="12">
                    <object data="../../assets/img/empty_data.svg" width="300"></object>
                    <h2>Sin datos</h2>
                </td>
            </tr>
        </table>

        <mat-paginator [pageSizeOptions]="[10, 20, 50]" showFirstLastButtons aria-label="Seleccione">
        </mat-paginator>
    </div>
</div>
