Add the quoted amount and completion time to customer jobs
- Jobs get a budget / quoted amount (cents, VAT 0). Only users who may see quotes see and edit it on the job form and page, and only they see its changes in the history. Others' saves keep the stored amount: the server decides whether the amount is set, not the browser. - Jobs record when they were done: set when a job first reaches a status that locks its hours, kept through the billing statuses, cleared when management opens the lock. The billing export will use it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -8,6 +8,7 @@ use App\Modules\Jobs\Domain\Contracts\CustomerJobRepository;
|
||||
use App\Modules\Jobs\Domain\Enums\JobStatus;
|
||||
use App\Modules\Jobs\Domain\Exceptions\CustomerJobNotFound;
|
||||
use App\Modules\Shared\Application\Contracts\TransactionManager;
|
||||
use App\Modules\Users\Application\Contracts\Clock;
|
||||
|
||||
/**
|
||||
* Moves a job to another status (e.g. on the Kanban board) and records it.
|
||||
@@ -17,6 +18,7 @@ final class ChangeJobStatus
|
||||
public function __construct(
|
||||
private CustomerJobRepository $jobs,
|
||||
private TransactionManager $transactions,
|
||||
private Clock $clock,
|
||||
) {}
|
||||
|
||||
/**
|
||||
@@ -27,6 +29,7 @@ final class ChangeJobStatus
|
||||
$this->transactions->run(function () use ($jobId, $status, $actorUserId): void {
|
||||
$job = $this->jobs->findById($jobId) ?? throw new CustomerJobNotFound($jobId);
|
||||
$changes = $job->changeStatus($status);
|
||||
$job->recordCompletion($this->clock->now());
|
||||
|
||||
if ($changes === []) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user