<main class="main-container animated fadeIn" (window:resize)="onResize()">
    <header id="navigation" class="btn-navigate mb-8">
        <div class="prev-page prevent-select indigo_primary_background
            mat-elevation-z8" matRipple
            [routerLink]="['/sam/GPRS/subcontratist']">
            <mat-icon style="color: white">arrow_back</mat-icon>
            <div class="page-name ml-4">Lista de Subcontratistas</div>
        </div>
    </header>

    <mat-card class="override-card override-elevation-z8">
        <section class="override-section">
            <nav class="override-nav">
                <mat-card-title class="mat-card-title centre">Lista de
                    Equipos de Trabajo</mat-card-title>
                <div class="override-actions">
                    <mat-form-field appearance="outline" class="w-300p mr-8">
                        <mat-label>Buscador</mat-label>
                        <input matInput [(ngModel)]="txtBuscador"
                            (keyup)="applyFilter($event,'INP')"
                            placeholder="Ingrese la palabra a buscar" />
                        <mat-icon *ngIf="txtBuscador.length === 0" matSuffix>search</mat-icon>
                        <mat-icon *ngIf="txtBuscador.length> 0"
                            class="clickable" matTooltip="Eliminar filtro"
                            (click)="applyFilter('', 'EST')" matSuffix>close</mat-icon>
                    </mat-form-field>
                    <div class="override-buttons">
                        <button mat-mini-fab color="info" matTooltip="Actualizar
                            Datos" (click)="getData()" class="override-no-shadow
                            mr-10">
                            <mat-icon>refresh</mat-icon>
                        </button>
                        <button
                            mat-mini-fab
                            color="warn"
                            class="override-no-shadow mr-4"
                            [disabled]="isLoadingForm"
                            matTooltip="Ficha en Pdf"
                            (click)="openDialog('PDF')">
                            <mat-icon>picture_as_pdf</mat-icon>
                        </button>
                        <img src="" alt="">
                        <button
                            mat-mini-fab
                            color="primary"
                            class="override-no-shadow mr-4"
                            [disabled]="isLoadingForm"
                            matTooltip="Ficha en Excel"
                            (click)="openDialog('EXC')"
                            downoload="asd.csv">
                            <mat-icon>text_snippet</mat-icon>
                        </button>
                    </div>
                </div>
            </nav>
            <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>
            </div>
            <div class="override-table">
                <table mat-table [dataSource]="dataSource" matSort
                    [style.display]="isLoading ?
                    'none' : 'revert'"
                    class="animated fadeIn">
                    <ng-container matColumnDef="START_DATE">
                        <th mat-header-cell *matHeaderCellDef mat-sort-header>Fecha
                            de Inicio</th>
                        <td mat-cell *matCellDef="let element">{{
                            element.START_DATE }}</td>
                    </ng-container>
                    <ng-container matColumnDef="END_DATE">
                        <th mat-header-cell *matHeaderCellDef mat-sort-header>Fecha
                            de Término</th>
                        <td mat-cell *matCellDef="let element">{{
                            element.END_DATE }}</td>
                    </ng-container>
                    <ng-container matColumnDef="COST">
                        <th mat-header-cell *matHeaderCellDef mat-sort-header>Valor
                            del Contrato</th>
                        <td mat-cell *matCellDef="let element">${{
                            element.COST }}</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>
            </div>
        </section>
        <mat-paginator [pageSizeOptions]="[10, 50, 100]"
            class="override-paginator"></mat-paginator>
    </mat-card>

</main>