Files
Toiminnanohjaus/app/Modules/Jobs/Domain/Enums/BoardColumn.php
T
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

156 lines
4.8 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
declare(strict_types=1);
namespace App\Modules\Jobs\Domain\Enums;
/**
* A column of the Kanban board (docs/ui-kanban-board.md 2–3). Most columns
* are one job status; "Tarjoukset" gathers the three sales statuses, and
* jobs in production are split into a normal and an urgent column by the
* user's urgent threshold. Continuing jobs have a column of their own.
*/
enum BoardColumn: string
{
case Quotes = 'quotes';
case Prospect = 'prospect';
case Tentative = 'tentative';
case QuoteRequest = 'quote_request';
case Order = 'order';
case InProduction = 'in_production';
case InProductionUrgent = 'in_production_urgent';
case OnHold = 'on_hold';
case Done = 'done';
case Invoiced = 'invoiced';
case Billed = 'billed';
case Ongoing = 'ongoing';
/**
* @return list<JobStatus>
*/
public function statuses(): array
{
return match ($this) {
self::Quotes => [JobStatus::Prospect, JobStatus::Tentative, JobStatus::QuoteRequest],
self::InProduction, self::InProductionUrgent => [JobStatus::InProduction],
default => [JobStatus::from($this->value)],
};
}
/**
* The status a card gets when it is dropped into this column from
* another one.
*/
public function targetStatus(): JobStatus
{
return match ($this) {
self::Quotes => JobStatus::QuoteRequest,
self::InProduction, self::InProductionUrgent => JobStatus::InProduction,
default => JobStatus::from($this->value),
};
}
public function isOngoing(): bool
{
return $this === self::Ongoing;
}
public function isUrgentLane(): bool
{
return $this === self::InProductionUrgent;
}
public function isNormalProductionLane(): bool
{
return $this === self::InProduction;
}
/**
* Whether a promoted (pinned) task card may be in or dropped into this
* column: its column follows the task's status.
*/
public function acceptsTasks(): bool
{
return in_array($this, [self::Order, self::InProduction, self::Done], true);
}
/**
* The column header colour before the user picks one (the design's
* default palette).
*/
public function defaultColor(): string
{
return match ($this) {
self::Quotes, self::Tentative => '#4338ca',
self::Prospect => '#374151',
self::QuoteRequest => '#6d28d9',
self::Order => '#23476a',
self::InProduction, self::InProductionUrgent => '#1d4ed8',
self::OnHold => '#78350f',
self::Done => '#14532d',
self::Invoiced => '#0f5c63',
self::Billed => '#065f46',
self::Ongoing => '#3b2d5e',
};
}
/**
* A Heroicon name for the column header.
*/
public function icon(): string
{
return match ($this) {
self::Quotes, self::QuoteRequest => 'document-text',
self::Prospect => 'light-bulb',
self::Tentative => 'pencil-square',
self::Order => 'inbox-stack',
self::InProduction => 'play-circle',
self::InProductionUrgent => 'fire',
self::OnHold => 'clock',
self::Done => 'check-circle',
self::Invoiced => 'credit-card',
self::Billed => 'check-badge',
self::Ongoing => 'arrow-path',
};
}
/**
* The column a job card stands in. A sales status is in "Tarjoukset" in
* views that gather them, in its own column otherwise.
*/
public static function forJob(JobStatus $status, Priority $priority, UrgentThreshold $threshold, bool $gatherQuotes): ?self
{
return match ($status) {
JobStatus::Prospect, JobStatus::Tentative, JobStatus::QuoteRequest => $gatherQuotes ? self::Quotes : self::from($status->value),
JobStatus::InProduction => $threshold->includes($priority) ? self::InProductionUrgent : self::InProduction,
JobStatus::Archived => null,
default => self::from($status->value),
};
}
/**
* The column a promoted task card stands in, by the task's status.
*/
public static function forTask(TaskStatus $status): self
{
return match ($status) {
TaskStatus::Waiting => self::Order,
TaskStatus::InProgress, TaskStatus::InReview => self::InProduction,
TaskStatus::Done => self::Done,
};
}
/**
* The task status a promoted task card gets when dropped here.
*/
public function taskStatus(): ?TaskStatus
{
return match ($this) {
self::Order => TaskStatus::Waiting,
self::InProduction => TaskStatus::InProgress,
self::Done => TaskStatus::Done,
default => null,
};
}
}