<table mat-table [dataSource]="courses" class="mat-elevation-z8 full-width-table dense-table">

    <!--- 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> Termín </th>
      <td mat-cell *matCellDef="let element"> {{element.dateStart | date:"d.M."}} - {{element.dateEnd | date:"d.M.Y"}} </td>
    </ng-container>

    <!-- School Column -->
    <ng-container matColumnDef="schoolName">
        <th mat-header-cell *matHeaderCellDef> Škola </th>
        <!-- <td mat-cell *matCellDef="let element"> {{ var school = getSchoolById(element.schoolId) ? school != null ? school.name : '' : '' }} </td> -->
        <td mat-cell *matCellDef="let element"> {{ getSchoolNameById(element.schoolId) }} </td>  
      </ng-container>
  
    <!-- Class Column -->
    <ng-container matColumnDef="class">
      <th mat-header-cell *matHeaderCellDef> Třída </th>
      <td mat-cell *matCellDef="let element"> {{element.class}} </td>
    </ng-container>

    <!-- School Column -->
    <ng-container matColumnDef="role">
        <th mat-header-cell *matHeaderCellDef> Role </th>
        <!-- <td mat-cell *matCellDef="let element"> {{ var school = getSchoolById(element.schoolId) ? school != null ? school.name : '' : '' }} </td> -->
        <td mat-cell *matCellDef="let element"> {{ getInstructorRole(element.instructors) }} </td>  
      </ng-container>

    <!-- Link Column -->
    <ng-container matColumnDef="link">
      <th mat-header-cell *matHeaderCellDef> Detail kurzu </th>
      <td mat-cell *matCellDef="let element"><a mat-flat-button routerLink="/{{detailLink}}/{{element.ID}}" target="_blank" #tooltip="matTooltip" matTooltip="Stránka s podrobnostmi o kurzu"><mat-icon color="primary">article</mat-icon></a></td>
    </ng-container>
 
    <tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
    <tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
</table>
