<mat-card class="card-normal mat-elevation-z8 animated fadeIn fast">
  <mat-grid-list cols="12" rowHeight="55px" class="card-title">
    <mat-grid-tile colspan="12">
      <mat-card-title>Organigrama</mat-card-title>
    </mat-grid-tile>
    <mat-grid-tile colspan="12" class="card-title" *ngIf="dataSource.data.length != 0">
      <mat-form-field appearance="legacy" class="searcher">
        <mat-label>Buscador</mat-label>
        <input
          matInput
          placeholder="Ingrese lo que necesite buscar"
          (keyup)="applyFilter($event)"
        />
        <mat-icon matSuffix>search</mat-icon>
      </mat-form-field>
    </mat-grid-tile>
  </mat-grid-list>

  <div *ngIf="data_empty" class="data-empty">
    No hay datos registrados en el organigrama
  </div>

  <mat-progress-bar *ngIf="loading" mode="indeterminate"></mat-progress-bar>
  <table
    mat-table
    [dataSource]="dataSource"
    class="animated fadeIn"
    *ngIf="dataSource.data.length != 0"
  >
    <ng-container matColumnDef="nombre">
      <th mat-header-cell *matHeaderCellDef>Nombre Completo</th>
      <td mat-cell *matCellDef="let element">
        {{ element.ORGA_IDUS }}
      </td>
    </ng-container>

    <ng-container matColumnDef="jefe_directo">
      <th mat-header-cell *matHeaderCellDef>Jefe Directo</th>
      <td mat-cell *matCellDef="let element">
        {{ element.ORGA_JEDI }}
      </td>
    </ng-container>

    <ng-container matColumnDef="jefe_sustituto">
      <th mat-header-cell *matHeaderCellDef>Jefe Sustituto</th>
      <td mat-cell *matCellDef="let element">
        {{ element.ORGA_JESU == null ? "No aplica" : element.ORGA_JESU }}
      </td>
    </ng-container>

    <ng-container matColumnDef="accion">
      <th mat-header-cell *matHeaderCellDef class="centre">Acciones</th>
      <td mat-cell *matCellDef="let element" class="table-action centre">
        <button
          mat-mini-fab
          class="mr-1 secondary"
          matTooltip="Modificar"
          [disabled]="edit_disabled"
          (click)="openDialogForm('Modificar', element)"
        >
          <mat-icon>edit</mat-icon>
        </button>
      </td>
    </ng-container>

    <tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
    <tr mat-row *matRowDef="let row; columns: displayedColumns"></tr>
  </table>
  <mat-paginator
    [pageSizeOptions]="[10, 20, 50]"
    showFirstLastButtons
    aria-label="Seleccione"
  >
  </mat-paginator>
</mat-card>
