<div>
  <app-header [current_page]="'staff-pt'" height="200px" background_image="/public/img/backgrounds/staff.png"
              [overlay_gradient]="0.5">

  </app-header>
  <section class="darkmodeSection full-height">
    <div class="staff-pt-container centered">
      <div class="week-header">
        <button mat-icon-button (click)="prevWeek()" matTooltip="Previous week" aria-label="Previous week">
          <mat-icon style="color: var(--font-color)">chevron_left</mat-icon>
        </button>

        <div class="week-title"><span style="color: var(--font-color)">{{ weekLabel() }}</span></div>

        <button mat-icon-button (click)="nextWeek()" [disabled]="!canGoNextWeek()"
                matTooltip="Next week" aria-label="Next week">
          <mat-icon style="color: var(--font-color)">chevron_right</mat-icon>
        </button>
      </div>

      <table mat-table [dataSource]="sortedStaffPt()" class="mat-elevation-z2 full-width" matSort
             (matSortChange)="sort.set($event)"
             [matSortActive]="sort().active" [matSortDirection]="sort().direction" [matSortDisableClear]="true">
        <ng-container matColumnDef="staff_member">
          <th mat-header-cell *matHeaderCellDef mat-sort-header="staff_member">Staff Member</th>
          <td mat-cell *matCellDef="let row"> {{ row.staff_member }}</td>
        </ng-container>

        <ng-container matColumnDef="playtime">
          <th mat-header-cell *matHeaderCellDef mat-sort-header="playtime">Playtime</th>
          <td mat-cell *matCellDef="let row"
              [style.color]="row.playtime < 420 ? 'red' : ''"> {{ minutesToHm(row.playtime) }}
          </td>
        </ng-container>

        <ng-container matColumnDef="role">
          <th mat-header-cell *matHeaderCellDef mat-sort-header="role">Rank</th>
          <td mat-cell *matCellDef="let row"> {{ row.role }}</td>
        </ng-container>

        <tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
        <tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>

        @if (!staffPt().length) {
          <tr class="no-data">
            <td colspan="3">No data for this week.</td>
          </tr>
        }
      </table>
    </div>
  </section>
</div>
