Phase 1, item 8 (last of phase 1). New TimeTracking module:
- One entry per user, task and day (0.25-24 h in quarters, with a note);
the job and work type are copied from the task. A user's day cannot
exceed 24 h, and hours on a done, invoiced, billed or archived job
cannot be added or changed.
- Weekly sheet /time: tasks as rows (own open tasks, tasks with hours
that week, tasks added by search), days as columns, row, day and week
totals, week navigation. A cell saves on change and an empty cell
removes the entry; on phones one day at a time. Saves and errors are
announced, errors are tied to their cell.
- Task booking page /time/tasks/{task}: date, hours and note, added to
the day's entry; own entries with edit and remove.
- Anyone but subcontractors may book on any unlocked task;
subcontractors only on jobs they are attached to.
Jobs module:
- JobStatus::locksTime(), BookableTask and task queries for booking.
- A task with time entries cannot be removed (TaskUsage contract,
provided by TimeTracking); the job page links tasks to booking.
- The "involved in a job" rule is shared in JobInvolvement.
Spec and CLAUDE.md updated.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
67 lines
1.6 KiB
PHP
67 lines
1.6 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 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);
|
|
}
|
|
|
|
/**
|
|
* 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;
|
|
}
|
|
}
|