Kanban / timesheet update

This commit is contained in:
2026-11-30 06:56:14 +02:00
parent 6332ff0fa9
commit a4dbe8ce09
46 changed files with 8091 additions and 331 deletions
@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace App\Modules\TimeTracking\Domain\Entities;
use App\Modules\TimeTracking\Domain\Enums\EntryBillingModel;
use App\Modules\TimeTracking\Domain\Exceptions\TimeApproved;
use App\Modules\TimeTracking\Domain\ValueObjects\WorkedHours;
use DateTimeImmutable;
@@ -28,6 +29,8 @@ final class TimeEntry
private ?int $approvedBy = null,
private ?DateTimeImmutable $approvedAt = null,
private ?int $billingExportId = null,
private ?EntryBillingModel $billingModel = null,
private ?string $internalComment = null,
) {}
public static function create(int $userId, int $taskId, int $jobId, int $workTypeId, DateTimeImmutable $workedOn, WorkedHours $hours, ?string $note = null): self
@@ -35,9 +38,39 @@ final class TimeEntry
return new self(null, $userId, $taskId, $jobId, $workTypeId, $workedOn, $hours, self::text($note));
}
public static function reconstitute(int $id, int $userId, int $taskId, int $jobId, int $workTypeId, DateTimeImmutable $workedOn, WorkedHours $hours, ?string $note, ?int $approvedBy = null, ?DateTimeImmutable $approvedAt = null, ?int $billingExportId = null): self
public static function reconstitute(int $id, int $userId, int $taskId, int $jobId, int $workTypeId, DateTimeImmutable $workedOn, WorkedHours $hours, ?string $note, ?int $approvedBy = null, ?DateTimeImmutable $approvedAt = null, ?int $billingExportId = null, ?EntryBillingModel $billingModel = null, ?string $internalComment = null): self
{
return new self($id, $userId, $taskId, $jobId, $workTypeId, $workedOn, $hours, $note, $approvedBy, $approvedAt, $billingExportId);
return new self($id, $userId, $taskId, $jobId, $workTypeId, $workedOn, $hours, $note, $approvedBy, $approvedAt, $billingExportId, $billingModel, $internalComment);
}
/**
* The entry's laskutusperuste, billing note (shown to the customer or in
* fixed-price follow-up, required before the week is approved) and
* internal comment. A null billing model follows the job.
*
* @throws TimeApproved
*/
public function describe(?EntryBillingModel $billingModel, ?string $billingNote, ?string $internalComment): void
{
$this->ensureNotApproved();
$this->billingModel = $billingModel;
$this->note = self::text($billingNote);
$this->internalComment = self::text($internalComment);
}
public function hasBillingNote(): bool
{
return $this->note !== null;
}
public function billingModel(): ?EntryBillingModel
{
return $this->billingModel;
}
public function internalComment(): ?string
{
return $this->internalComment;
}
/**