46 lines
1.2 KiB
PHP
46 lines
1.2 KiB
PHP
<?php
|
||
|
||
declare(strict_types=1);
|
||
|
||
namespace App\Modules\Jobs\Application\DTOs;
|
||
|
||
use App\Modules\Jobs\Domain\Enums\JobStatus;
|
||
use App\Modules\Jobs\Domain\Enums\TaskStatus;
|
||
|
||
/**
|
||
* A task as time is recorded on it: which job, customer and work type it
|
||
* belongs to, the job's payment basis (a PaymentBasis value) and whether
|
||
* the job is locked for time entries.
|
||
*/
|
||
final readonly class BookableTask
|
||
{
|
||
public function __construct(
|
||
public int $taskId,
|
||
public int $jobId,
|
||
public string $jobNumber,
|
||
public string $jobName,
|
||
public string $taskTitle,
|
||
public int $workTypeId,
|
||
public string $workTypeName,
|
||
public JobStatus $jobStatus,
|
||
public TaskStatus $taskStatus,
|
||
public int $customerId = 0,
|
||
public string $customerName = '',
|
||
public ?string $customerHeaderColor = null,
|
||
public ?string $paymentBasis = null,
|
||
) {}
|
||
|
||
public function isLocked(): bool
|
||
{
|
||
return $this->jobStatus->locksTime();
|
||
}
|
||
|
||
/**
|
||
* E.g. "2026-0005 Messuvideo – Mainoskuvat".
|
||
*/
|
||
public function label(): string
|
||
{
|
||
return $this->jobNumber.' '.$this->jobName.' – '.$this->taskTitle;
|
||
}
|
||
}
|