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,45 @@
<?php
namespace App\Modules\Dashboard\Infrastructure\Adapters;
use App\Modules\Dashboard\Application\Contracts\DashboardFigures;
use App\Modules\Dashboard\Application\DTOs\PeriodFigures;
use App\Modules\Reports\Application\UseCases\HoursByPerson;
use App\Modules\Reports\Application\UseCases\ProfitabilityByJob;
use App\Modules\Reports\Application\UseCases\QuickSalesReport;
use App\Modules\Reports\Application\UseCases\UnbilledHoursReport;
use App\Modules\Reports\Domain\ValueObjects\ReportPeriod;
/**
* Key figures through the Reports module's reports, so the panel shows the
* same numbers as the reports.
*/
class FiguresForDashboard implements DashboardFigures
{
public function __construct(
private HoursByPerson $hours,
private ProfitabilityByJob $profitability,
private QuickSalesReport $sales,
private UnbilledHoursReport $unbilled,
) {}
public function between(string $from, string $to): PeriodFigures
{
$period = new ReportPeriod($from, $to);
$hours = $this->hours->execute($period)->total;
$profit = $this->profitability->execute($period)->total;
return new PeriodFigures(
$hours->customerQuarters,
$hours->internalQuarters,
$profit->revenueCents(),
$profit->marginCents(),
$this->sales->execute($period)->totalCents(),
);
}
public function unbilledValueCents(string $day): int
{
return $this->unbilled->execute($day)->valueCents;
}
}