<div fxLayout="column" fxFlex="100" fxLayoutAlign="start start" class="card-content-gap">
  <div fxLayout="column" fxLayout.gt-xs="row" fxLayoutAlign.gt-xs="start center" fxLayoutAlign="start stretch" fxFlex="100" class="page-sub-title-container w-100">
    <div fxFlex="70">
      <fa-icon [icon]="faHistory" class="page-title-img mr-1"></fa-icon>
      <span class="page-title">Transaction History</span>
    </div>
    <mat-form-field fxFlex="30">
      <input matInput (keyup)="applyFilter($event.target.value)" placeholder="Filter">
    </mat-form-field>
  </div>
  <div fxLayout="row" fxLayoutAlign="start center" class="w-100">
    <div perfectScrollbar class="table-container" fxFlex="100">
      <mat-progress-bar *ngIf="flgLoading[0]===true" mode="indeterminate"></mat-progress-bar>
      <table mat-table #table [dataSource]="listTransactions" matSort
        [ngClass]="{'overflow-auto error-border': flgLoading[0]==='error','overflow-auto': true}">
        <ng-container matColumnDef="time_stamp_str">
          <th mat-header-cell *matHeaderCellDef mat-sort-header> Date/Time </th>
          <td mat-cell *matCellDef="let transaction">{{transaction.time_stamp_str}}</td>
        </ng-container>
        <ng-container matColumnDef="amount">
          <th mat-header-cell *matHeaderCellDef mat-sort-header arrowPosition="before"> Amount (Sats) </th>
          <td mat-cell *matCellDef="let transaction">
            <span fxLayoutAlign="end center" *ngIf="transaction.amount > 0 || transaction.amount === 0">{{transaction.amount | number}}</span>
            <span fxLayoutAlign="end center" class="red" *ngIf="transaction.amount < 0">({{transaction.amount * -1 | number}})</span>
          </td>
        </ng-container>
        <ng-container matColumnDef="total_fees">
          <th mat-header-cell *matHeaderCellDef mat-sort-header arrowPosition="before"> Fees (Sats) </th>
          <td mat-cell *matCellDef="let transaction"><span fxLayoutAlign="end center">{{transaction.total_fees | number}}</span></td>
        </ng-container>
        <ng-container matColumnDef="block_height">
          <th mat-header-cell *matHeaderCellDef mat-sort-header arrowPosition="before"> Block Height </th>
          <td mat-cell *matCellDef="let transaction"><span fxLayoutAlign="end center">{{transaction.block_height | number}}</span></td>
        </ng-container>
        <ng-container matColumnDef="num_confirmations">
          <th mat-header-cell *matHeaderCellDef mat-sort-header arrowPosition="before"> Confirmations </th>
          <td mat-cell *matCellDef="let transaction"><span fxLayoutAlign="end center">
              {{transaction?.num_confirmations | number}} </span></td>
        </ng-container>
        <ng-container matColumnDef="actions">
          <th mat-header-cell *matHeaderCellDef class="pl-3 pr-3"><span fxLayoutAlign="end center">Actions</span></th>          
          <td mat-cell *matCellDef="let transaction" class="pl-3">
            <button mat-stroked-button color="primary" type="button" tabindex="4"
              (click)="onTransactionClick(transaction, $event)">View Info</button>
          </td>
        </ng-container>
        <ng-container matColumnDef="no_transaction">
          <td mat-footer-cell *matFooterCellDef colspan="4">
            <p *ngIf="!listTransactions.data || listTransactions.data.length<1">No transactions available.</p>
          </td>
        </ng-container>
        <tr mat-footer-row *matFooterRowDef="['no_transaction']" [ngClass]="{'display-none': listTransactions.data && listTransactions.data.length>0}"></tr>
        <tr mat-header-row *matHeaderRowDef="displayedColumns; sticky: flgSticky;"></tr>
        <tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
      </table>
      <mat-paginator [pageSize]="pageSize" [pageSizeOptions]="pageSizeOptions" [showFirstLastButtons]="screenSize === screenSizeEnum.XS ? false : true" class="mb-4"></mat-paginator>
    </div>
  </div>
</div>