Add sorting functionality to staff playtime table and include roles in UI and database mapping

This commit is contained in:
2025-11-24 01:08:43 +01:00
parent fb01fc7571
commit 2bc5c41435
5 changed files with 48 additions and 9 deletions
@@ -18,21 +18,22 @@
</button>
</div>
<table mat-table [dataSource]="staffPt()" class="mat-elevation-z2 full-width">
<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>Staff Member</th>
<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>Playtime</th>
<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>Rank</th>
<th mat-header-cell *matHeaderCellDef mat-sort-header="role">Rank</th>
<td mat-cell *matCellDef="let row"> {{ row.role }}</td>
</ng-container>