<table mat-table [dataSource]="courses" class="mat-elevation-z8 full-width-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>

    <!-- Theme Column -->
    <ng-container matColumnDef="themeName">
        <th mat-header-cell *matHeaderCellDef> Téma </th>
        <td mat-cell *matCellDef="let element"> {{ getThemeNameById(element.themeId) }} </td>
      </ng-container>

    <!-- Link Column -->
    <ng-container matColumnDef="link">
      <th mat-header-cell *matHeaderCellDef> Detail </th>
      <td mat-cell *matCellDef="let element"><a mat-flat-button routerLink="/{{detailLink}}/{{element.ID}}"><mat-icon color="primary">article</mat-icon></a></td>
    </ng-container>

    <!-- Footer -->
    <ng-container matColumnDef="footer">
        <td mat-footer-cell *matFooterCellDef colspan="4" class="table-item-counter">
            Celkem kurzů: {{courses.length}}
        </td>
    </ng-container>

    <!-- Decision Column -->
    <ng-container matColumnDef="decision">
        <th mat-header-cell *matHeaderCellDef> Schválit rezervaci? </th>
        <td mat-cell *matCellDef="let element">
            <span *ngIf="element.state != 'zamitnuty'">
                <span class="decision-button">
                    <a mat-raised-button color="success" #tooltip="matTooltip" matTooltip="Potvrdit rezervaci tohoto kurzu." (click)="approveCourse(element)"><mat-icon>done</mat-icon></a>
                </span>
                <span class="decision-button">
                    <a mat-raised-button color="fail" #tooltip="matTooltip" matTooltip="Zamítnout tuto rezervaci." (click)="denyCourse(element)"><mat-icon>clear</mat-icon></a>
                </span>
            </span>
            <span *ngIf="element.state == 'zamitnuty'">
                <span class="decision-button">
                    <a mat-raised-button color="success" #tooltip="matTooltip" matTooltip="Obnovit tento kurz a zařadit ho mezi plánované." (click)="approveCourse(element)"><mat-icon>done</mat-icon></a>
                </span>
            </span>
        </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>
  
  <!-- class: '9.A',
  dateStart: new Date('2021-05-10 09:35:00'),
  dateEnd: new Date('2021-05-12 14:15:00'),
  information: 'další poznámky ke kurzu',
  themeName: 'Moje třída, moje parta!',
  themeDescription: 'Kurz s cílem stmelit kolektiv. Poznat se víc. Něco společně dokázat. Zažít spolu neopakovatelné.', 
  schoolName: 'Církevní základní škola Zlín' -->
