Files
petriandClaude Opus 5.5 f4b58f6b1d 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]>
2026-11-30 06:11:49 +02:00

92 lines
2.2 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Modules\Jobs\Domain\Enums;
/**
* Tila (spec 5.3). The cases are in their usual order; any status may be
* chosen. The statuses are also the columns of the job Kanban board.
*/
enum JobStatus: string
{
case Prospect = 'prospect';
case Tentative = 'tentative';
case QuoteRequest = 'quote_request';
case Order = 'order';
case InProduction = 'in_production';
case OnHold = 'on_hold';
case Done = 'done';
case Invoiced = 'invoiced';
case Billed = 'billed';
case Ongoing = 'ongoing';
case Archived = 'archived';
/**
* Statuses set when the job is invoiced: only management and the
* job's biller may set them.
*/
public function isBillingStatus(): bool
{
return $this === self::Invoiced || $this === self::Billed;
}
/**
* Tasks can be added from a quote request on (K36), not to an archived job.
*/
public function allowsTasks(): bool
{
return ! in_array($this, [self::Prospect, self::Tentative, self::Archived], true);
}
/**
* Once a job is done its hours and expenses are locked (K21).
*/
public function locksTime(): bool
{
return in_array($this, [self::Done, self::Invoiced, self::Billed, self::Archived], true);
}
/**
* Work still to be done: a job past its due date in such a status is late.
*/
public function isOpen(): bool
{
return ! $this->locksTime();
}
/**
* @return list<self>
*/
public static function openStatuses(): array
{
return array_values(array_filter(self::cases(), fn (self $status): bool => $status->isOpen()));
}
/**
* Whether moving from this status to $to opens the lock on hours and expenses.
*/
public function unlocksTo(self $to): bool
{
return $this->locksTime() && ! $to->locksTime();
}
/**
* The Kanban columns: every status except archived.
*
* @return list<self>
*/
public static function kanbanStatuses(): array
{
$statuses = [];
foreach (self::cases() as $status) {
if ($status !== self::Archived) {
$statuses[] = $status;
}
}
return $statuses;
}
}