<table mat-table [dataSource]="fund" class="mat-elevation-z8 full-width-table no-right-padding">

    <!--- Note that these columns can be defined in any order.
          The actual rendered columns are set as a property on the row definition" -->
  
    <!-- Date Column -->
    <ng-container matColumnDef="date">
      <th mat-header-cell *matHeaderCellDef> Datum </th>
      <td mat-cell *matCellDef="let element"> {{element.date | date:"d.M.Y"}} </td>
    </ng-container>

    <!-- School Column -->
    <ng-container matColumnDef="description">
        <th mat-header-cell *matHeaderCellDef> Popis </th>
        <td mat-cell *matCellDef="let element"> {{element.description}} </td> 
      </ng-container>
  
    <!-- Class Column -->
    <ng-container matColumnDef="amount">
      <th mat-header-cell *matHeaderCellDef> Částka </th>
      <td mat-cell *matCellDef="let element"> <span class="{{element.amount > 0 ? 'positive' : (element.amount < 0 ? 'negative' : '')}}">{{element.amount}} Kč</span> </td>
    </ng-container>

    <!-- Class Column -->
    <ng-container matColumnDef="delete">
      <th mat-header-cell *matHeaderCellDef> Odstranit </th>
      <td mat-cell *matCellDef="let element">
        <button mat-button color="accent" class="narrow-button" (click)="removeFundRecord(element.ID)" matTooltip="Vymazat tuto transakci">
          <mat-icon fontSet="material-icons-outlined">delete_forever</mat-icon>
        </button>
      </td>
    </ng-container>

    <!-- Footer -->
    <ng-container matColumnDef="footer">
        <td mat-footer-cell *matFooterCellDef colspan="3" class="table-item-counter">
            Celkem záznamů: {{fund.length}}
        </td>
    </ng-container>
  
    <tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
    <tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
    <tr mat-footer-row *matFooterRowDef="['footer']" class="footer-row"></tr>
</table>
