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:
@@ -0,0 +1,155 @@
|
||||
<?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,
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Modules\Jobs\Domain\Enums;
|
||||
|
||||
/**
|
||||
* Card density of a user's Kanban board: normal cards or three-row
|
||||
* compact cards (docs/ui-kanban-board.md 1.1).
|
||||
*/
|
||||
enum BoardDensity: string
|
||||
{
|
||||
case Normal = 'normal';
|
||||
case Compact = 'compact';
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Modules\Jobs\Domain\Enums;
|
||||
|
||||
/**
|
||||
* Näkymäputki of the Kanban board (docs/ui-kanban-board.md 2.2).
|
||||
*/
|
||||
enum BoardView: string
|
||||
{
|
||||
/** Päivittäinen työputki: quotes gathered, production, continuing jobs. */
|
||||
case Production = 'production';
|
||||
|
||||
/** Myynti & Tarjoukset: the three sales statuses apart. */
|
||||
case Sales = 'sales';
|
||||
|
||||
/** Täysi tilaputki: every status from prospect to billed, plus continuing jobs. */
|
||||
case Full = 'full';
|
||||
|
||||
/**
|
||||
* @return list<BoardColumn>
|
||||
*/
|
||||
public function columns(): array
|
||||
{
|
||||
return match ($this) {
|
||||
self::Production => [
|
||||
BoardColumn::Quotes, BoardColumn::Order, BoardColumn::InProduction, BoardColumn::InProductionUrgent,
|
||||
BoardColumn::OnHold, BoardColumn::Done, BoardColumn::Ongoing,
|
||||
],
|
||||
self::Sales => [BoardColumn::Prospect, BoardColumn::Tentative, BoardColumn::QuoteRequest],
|
||||
self::Full => [
|
||||
BoardColumn::Prospect, BoardColumn::Tentative, BoardColumn::QuoteRequest, BoardColumn::Order,
|
||||
BoardColumn::InProduction, BoardColumn::InProductionUrgent, BoardColumn::OnHold, BoardColumn::Done,
|
||||
BoardColumn::Invoiced, BoardColumn::Billed, BoardColumn::Ongoing,
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
public function gathersQuotes(): bool
|
||||
{
|
||||
return $this === self::Production;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Modules\Jobs\Domain\Enums;
|
||||
|
||||
/**
|
||||
* Order of cards in one Kanban column: the user's own drag order, or by due
|
||||
* date with the earliest (most overdue) on top and cards without one last.
|
||||
*/
|
||||
enum ColumnSort: string
|
||||
{
|
||||
case Manual = 'manual';
|
||||
case DueDate = 'due_date';
|
||||
}
|
||||
@@ -19,6 +19,7 @@ enum JobStatus: string
|
||||
case Done = 'done';
|
||||
case Invoiced = 'invoiced';
|
||||
case Billed = 'billed';
|
||||
case Ongoing = 'ongoing';
|
||||
case Archived = 'archived';
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Modules\Jobs\Domain\Enums;
|
||||
|
||||
/**
|
||||
* Which priorities lift a job in production into the "Työn alla • Kiire"
|
||||
* column of the Kanban board (docs/ui-kanban-board.md 3.1). Each user
|
||||
* chooses it for their own board.
|
||||
*/
|
||||
enum UrgentThreshold: string
|
||||
{
|
||||
case Immediate = 'immediate';
|
||||
case Urgent = 'urgent';
|
||||
case First = 'first';
|
||||
|
||||
/**
|
||||
* The lowest priority that is urgent at this threshold.
|
||||
*/
|
||||
public function lowestPriority(): Priority
|
||||
{
|
||||
return match ($this) {
|
||||
self::Immediate => Priority::Immediate,
|
||||
self::Urgent => Priority::Urgent,
|
||||
self::First => Priority::First,
|
||||
};
|
||||
}
|
||||
|
||||
public function includes(Priority $priority): bool
|
||||
{
|
||||
return self::rank($priority) >= self::rank($this->lowestPriority());
|
||||
}
|
||||
|
||||
/**
|
||||
* Waiting 1, Normal 2, First 3, Urgent 4, Immediate 5.
|
||||
*/
|
||||
public static function rank(Priority $priority): int
|
||||
{
|
||||
return match ($priority) {
|
||||
Priority::Waiting => 1,
|
||||
Priority::Normal => 2,
|
||||
Priority::First => 3,
|
||||
Priority::Urgent => 4,
|
||||
Priority::Immediate => 5,
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user