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,88 @@
<?php
declare(strict_types=1);
namespace App\Modules\Jobs\Application\Services;
use App\Modules\Jobs\Application\DTOs\BoardCard;
use App\Modules\Jobs\Domain\Enums\BoardColumn;
use App\Modules\Jobs\Domain\Enums\BoardView;
use App\Modules\Jobs\Domain\Enums\ColumnSort;
use App\Modules\Jobs\Domain\Enums\JobStatus;
use App\Modules\Jobs\Domain\ValueObjects\BoardPreferences;
/**
* Places Kanban cards in the columns of a view and orders each column
* (docs/ui-kanban-board.md 3–4):
*
* - jobs in production go to the urgent column when their priority meets
* the user's threshold, to the normal one otherwise;
* - continuing jobs only ever stand in "Jatkuvat & Kausi";
* - a pinned task stands in Jonossa, Työn alla or Valmis by its status;
* - a manual column is in drag order, a due-date column has the earliest
* due date on top and cards without one last.
*/
final class BoardLayout
{
/**
* @param list<BoardCard> $cards
* @return array<string, list<BoardCard>> by BoardColumn value, in the view's column order
*/
public function arrange(array $cards, BoardView $view, BoardPreferences $preferences): array
{
$columns = [];
foreach ($view->columns() as $column) {
$columns[$column->value] = [];
}
foreach ($cards as $card) {
$column = $this->columnOf($card, $view, $preferences);
if ($column !== null && array_key_exists($column->value, $columns)) {
$columns[$column->value][] = $card;
}
}
foreach ($columns as $value => $columnCards) {
$columns[$value] = $this->sorted($columnCards, $preferences->sortOf(BoardColumn::from($value)));
}
return $columns;
}
public function columnOf(BoardCard $card, BoardView $view, BoardPreferences $preferences): ?BoardColumn
{
if ($card->isTaskCard()) {
return $card->taskStatus === null ? null : BoardColumn::forTask($card->taskStatus);
}
if ($card->jobStatus === JobStatus::Ongoing) {
return BoardColumn::Ongoing;
}
return BoardColumn::forJob($card->jobStatus, $card->priority, $preferences->urgentThreshold, $view->gathersQuotes());
}
/**
* @param list<BoardCard> $cards
* @return list<BoardCard>
*/
private function sorted(array $cards, ColumnSort $sort): array
{
usort($cards, function (BoardCard $a, BoardCard $b) use ($sort): int {
if ($sort === ColumnSort::DueDate) {
$byDue = ($a->dueOn ?? '9999-12-31') <=> ($b->dueOn ?? '9999-12-31');
if ($byDue !== 0) {
return $byDue;
}
}
return [$a->boardPosition, $a->isTaskCard() ? 1 : 0, $a->taskId ?? $a->jobId]
<=> [$b->boardPosition, $b->isTaskCard() ? 1 : 0, $b->taskId ?? $b->jobId];
});
return $cards;
}
}