Darken the dark canvas, add customer colours, the ongoing status and the board model

- Dark theme page background is #5a5e60; text on it is lifted to zinc-200 /
  primary-100 and TallStackUI's dark labels, hints and checkbox labels are
  lightened so everything stays at 4.5:1.
- Shared HexColor picks white or black text by the higher WCAG contrast; a
  native-dialog colour picker and a large work dialog component.
- Customers get a header colour (customers.header_color), set on the
  customer page.
- New job status Jatkuvat / Kausi (ongoing): open, never late, billed
  monthly like running jobs.
- Kanban model: board columns and views, urgent threshold, per-user board
  preferences (density, column colours and sort), card positions, tasks of
  continuing jobs pinned to the board, MoveBoardCard and board queries with
  logged hours from TimeTracking.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-11-30 06:11:49 +02:00
co-authored by Claude Opus 5.5
parent de168619b3
commit f4b58f6b1d
140 changed files with 2845 additions and 170 deletions
@@ -0,0 +1,135 @@
<?php
declare(strict_types=1);
namespace App\Modules\Jobs\Domain\ValueObjects;
use App\Modules\Jobs\Domain\Enums\BoardColumn;
use App\Modules\Jobs\Domain\Enums\BoardDensity;
use App\Modules\Jobs\Domain\Enums\ColumnSort;
use App\Modules\Jobs\Domain\Enums\UrgentThreshold;
use App\Modules\Shared\Domain\ValueObjects\HexColor;
/**
* One user's Kanban board settings: card density, the urgent threshold,
* and their own colour and order for each column. A column without a
* colour of its own uses the design's default colour.
*/
final readonly class BoardPreferences
{
/**
* @param array<string, HexColor> $columnColors by BoardColumn value
* @param array<string, ColumnSort> $columnSorts by BoardColumn value
*/
public function __construct(
public BoardDensity $density = BoardDensity::Normal,
public UrgentThreshold $urgentThreshold = UrgentThreshold::Urgent,
public array $columnColors = [],
public array $columnSorts = [],
) {}
public static function defaults(): self
{
return new self;
}
/**
* Rebuilds stored settings, dropping unknown columns and invalid values
* so a bad stored value never breaks the board.
*
* @param array<array-key, mixed> $colors
* @param array<array-key, mixed> $sorts
*/
public static function fromStored(?string $density, ?string $threshold, array $colors, array $sorts): self
{
$columnColors = [];
foreach ($colors as $column => $color) {
if (BoardColumn::tryFrom((string) $column) !== null && is_string($color) && preg_match('/^#[0-9a-f]{6}$/i', $color) === 1) {
$columnColors[(string) $column] = new HexColor($color);
}
}
$columnSorts = [];
foreach ($sorts as $column => $sort) {
$parsed = is_string($sort) ? ColumnSort::tryFrom($sort) : null;
if (BoardColumn::tryFrom((string) $column) !== null && $parsed !== null) {
$columnSorts[(string) $column] = $parsed;
}
}
return new self(
BoardDensity::tryFrom((string) $density) ?? BoardDensity::Normal,
UrgentThreshold::tryFrom((string) $threshold) ?? UrgentThreshold::Urgent,
$columnColors,
$columnSorts,
);
}
public function colorOf(BoardColumn $column): HexColor
{
return $this->columnColors[$column->value] ?? new HexColor($column->defaultColor());
}
public function hasOwnColor(BoardColumn $column): bool
{
return isset($this->columnColors[$column->value]);
}
public function sortOf(BoardColumn $column): ColumnSort
{
return $this->columnSorts[$column->value] ?? ColumnSort::Manual;
}
public function withDensity(BoardDensity $density): self
{
return new self($density, $this->urgentThreshold, $this->columnColors, $this->columnSorts);
}
public function withUrgentThreshold(UrgentThreshold $threshold): self
{
return new self($this->density, $threshold, $this->columnColors, $this->columnSorts);
}
/**
* Null returns the column to its default colour.
*/
public function withColumnColor(BoardColumn $column, ?HexColor $color): self
{
$colors = $this->columnColors;
if ($color === null) {
unset($colors[$column->value]);
} else {
$colors[$column->value] = $color;
}
return new self($this->density, $this->urgentThreshold, $colors, $this->columnSorts);
}
public function withColumnSort(BoardColumn $column, ColumnSort $sort): self
{
$sorts = $this->columnSorts;
$sorts[$column->value] = $sort;
return new self($this->density, $this->urgentThreshold, $this->columnColors, $sorts);
}
/**
* @return array<string, string>
*/
public function colorValues(): array
{
return array_map(fn (HexColor $color): string => $color->value, $this->columnColors);
}
/**
* @return array<string, string>
*/
public function sortValues(): array
{
return array_map(fn (ColumnSort $sort): string => $sort->value, $this->columnSorts);
}
}
@@ -102,6 +102,18 @@ final readonly class JobDetails
);
}
public function withPriority(Priority $priority): self
{
return new self(
$this->name, $this->description, $this->customerId, $this->serviceUnitIds,
$this->startsOn, $this->dueOn, $this->plannedFrom, $this->plannedTo,
$this->kind, $this->status, $priority, $this->paymentBasis, $this->estimatedHours,
$this->customerReference, $this->instructions, $this->responsibleUserId, $this->contactUserId,
$this->customerContactId, $this->billerUserId, $this->billingUnitId, $this->memberUserIds,
$this->tags, $this->links, $this->quotedAmount, $this->monthlyFee,
);
}
public function withServiceUnit(int $serviceUnitId): self
{
return new self(