<div fxLayout="row wrap" fxLayoutAlign="start start" fxLayout.gt-sm="column" fxFlex="100" fxLayoutAlign.gt-sm="start stretch" class="padding-gap-x-large">
  <div fxLayout="column" fxLayout.gt-xs="row wrap" fxLayoutAlign.gt-xs="start center" fxLayoutAlign="start stretch" class="page-sub-title-container">
    <div fxFlex="70">
      <fa-icon [icon]="faHistory" class="page-title-img mr-1"></fa-icon>
      <span class="page-title">UTXOs</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 start">
    <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="txid">
          <th mat-header-cell *matHeaderCellDef mat-sort-header> Transaction ID </th>
          <td mat-cell *matCellDef="let transaction">
            <div class="ellipsis-parent" [ngStyle]="{'max-width': (screenSize === screenSizeEnum.XS) ? '10rem' : '50rem'}">
              <span *ngIf="transaction.status === 'confirmed'" class="dot green" matTooltip="Confirmed" matTooltipPosition="right"></span>
              <span *ngIf="transaction.status !== 'confirmed'" class="dot yellow" matTooltip="{{transaction.status | titlecase}}" matTooltipPosition="right"></span>
              <span class="ellipsis-child">{{transaction.txid}}</span>
            </div>
          </td>
        </ng-container>
        <ng-container matColumnDef="output">
          <th mat-header-cell *matHeaderCellDef mat-sort-header arrowPosition="before"> Output </th>
          <td mat-cell *matCellDef="let transaction"><span fxLayoutAlign="end center">
              {{transaction?.output | number}} </span></td>
        </ng-container>
        <ng-container matColumnDef="value">
          <th mat-header-cell *matHeaderCellDef mat-sort-header arrowPosition="before"> Value (Sats) </th>
          <td mat-cell *matCellDef="let transaction">
            <span fxLayoutAlign="end center" *ngIf="transaction.value > 0 || transaction.value === 0">{{transaction.value | number}}</span>
            <span fxLayoutAlign="end center" class="red" *ngIf="transaction.value < 0">({{transaction.value * -1 | number}})</span>
          </td>
        </ng-container>
        <ng-container matColumnDef="blockheight">
          <th mat-header-cell *matHeaderCellDef mat-sort-header arrowPosition="before"> Blockheight </th>
          <td mat-cell *matCellDef="let transaction"><span fxLayoutAlign="end center">
              {{transaction?.blockheight | number}} </span></td>
        </ng-container>
        <ng-container matColumnDef="actions">
          <th mat-header-cell *matHeaderCellDef class="px-3">
            <div class="bordered-box table-actions-select">
              <mat-select placeholder="Actions" tabindex="1" class="mr-0">
                <mat-select-trigger></mat-select-trigger>
                <mat-option (click)="onDownloadCSV()">Download CSV</mat-option>
              </mat-select>
            </div>
          </th>
          <td mat-cell *matCellDef="let transaction" class="pl-3" fxLayoutAlign="end center">
            <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>