Remove "Last Played" column from Staff Playtime view and enhance time formatting in minutesToHm method to include days.
This commit is contained in:
parent
6292d0cacf
commit
06a1cd64e3
|
|
@ -29,11 +29,6 @@
|
|||
<td mat-cell *matCellDef="let row"> {{ minutesToHm(row.playtime) }}</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="last_played">
|
||||
<th mat-header-cell *matHeaderCellDef> Last Played</th>
|
||||
<td mat-cell *matCellDef="let row"> {{ row.last_played | date:'medium' }}</td>
|
||||
</ng-container>
|
||||
|
||||
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import {Component, computed, inject, OnInit, signal} from '@angular/core';
|
||||
import {CommonModule, DatePipe} from '@angular/common';
|
||||
import {CommonModule} from '@angular/common';
|
||||
import {MatTableModule} from '@angular/material/table';
|
||||
import {MatButtonModule} from '@angular/material/button';
|
||||
import {MatIconModule} from '@angular/material/icon';
|
||||
|
|
@ -10,7 +10,7 @@ import {HeaderComponent} from '@header/header.component';
|
|||
@Component({
|
||||
selector: 'app-staff-pt',
|
||||
standalone: true,
|
||||
imports: [CommonModule, MatTableModule, MatButtonModule, MatIconModule, MatTooltipModule, DatePipe, HeaderComponent],
|
||||
imports: [CommonModule, MatTableModule, MatButtonModule, MatIconModule, MatTooltipModule, HeaderComponent],
|
||||
templateUrl: './staff-pt.component.html',
|
||||
styleUrl: './staff-pt.component.scss'
|
||||
})
|
||||
|
|
@ -24,7 +24,7 @@ export class StaffPtComponent implements OnInit {
|
|||
|
||||
todayStart = signal<Date>(this.startOfDay(new Date()));
|
||||
|
||||
displayedColumns = ['staff_member', 'playtime', 'last_played'];
|
||||
displayedColumns = ['staff_member', 'playtime'];
|
||||
|
||||
ngOnInit(): void {
|
||||
this.loadCurrentWeek();
|
||||
|
|
@ -70,9 +70,14 @@ export class StaffPtComponent implements OnInit {
|
|||
|
||||
minutesToHm(mins?: number): string {
|
||||
if (mins == null) return '';
|
||||
const h = Math.floor(mins / 60);
|
||||
const d = Math.floor(mins / 1440);
|
||||
const h = Math.floor((mins % 1440) / 60);
|
||||
const m = mins % 60;
|
||||
return `${h}:${m.toString().padStart(2, '0')}`;
|
||||
const parts = [];
|
||||
if (d > 0) parts.push(`${d}d`);
|
||||
if (h > 0 || d > 0) parts.push(`${h}h`);
|
||||
if (m > 0 || (h === 0 && d === 0)) parts.push(`${m}m`);
|
||||
return parts.join(' ');
|
||||
}
|
||||
|
||||
private loadStaffData(from: Date, to: Date) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user