Replace the demo home page with a dashboard

Everyone sees their open tasks on an agenda, their open jobs, this
week's hours and quick links. Admin and management also get a lazily
loaded management panel: things to do, the month so far against the
previous month, jobs and late work, and everyone's workload.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
2026-11-25 09:20:02 +02:00
co-authored by Claude Sonnet 5.5
parent d4251d00d7
commit 487a7d34ba
46 changed files with 2032 additions and 62 deletions
@@ -0,0 +1,38 @@
<?php
namespace App\Modules\Dashboard\Infrastructure\Adapters;
use App\Modules\Dashboard\Application\Contracts\DashboardTime;
use App\Modules\Dashboard\Application\DTOs\PendingApproval;
use App\Modules\Dashboard\Application\DTOs\WeekHours;
use App\Modules\TimeTracking\Application\Contracts\TimeEntryQueries;
/**
* Hours for the home page through the TimeTracking module.
*/
class TimeForDashboard implements DashboardTime
{
public function __construct(private TimeEntryQueries $entries) {}
public function week(int $userId, string $monday): WeekHours
{
$sheet = $this->entries->week($userId, $monday);
return new WeekHours($monday, $sheet->dayTotals, $sheet->totalQuarters, $sheet->unapprovedQuarters);
}
public function pendingApprovals(): array
{
$people = [];
foreach ($this->entries->pendingWeeks() as $week) {
$current = $people[$week->userId] ?? new PendingApproval($week->userId, $week->userName, 0, 0);
$people[$week->userId] = new PendingApproval($week->userId, $week->userName, $current->quarters + $week->quarters, $current->weekCount + 1);
}
$people = array_values($people);
usort($people, fn (PendingApproval $a, PendingApproval $b): int => strnatcasecmp($a->name, $b->name));
return $people;
}
}