38 lines
914 B
PHP
38 lines
914 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Modules\TimeTracking\Application\DTOs;
|
|
|
|
use App\Modules\Jobs\Application\DTOs\BookableTask;
|
|
use App\Modules\TimeTracking\Domain\Enums\EntryBillingModel;
|
|
|
|
/**
|
|
* A task row of the time sheet (level 3): its entries by day.
|
|
*/
|
|
final readonly class TimesheetTaskRow
|
|
{
|
|
/**
|
|
* @param array<string, TimesheetCell> $cells by Y-m-d
|
|
*/
|
|
public function __construct(
|
|
public BookableTask $task,
|
|
public array $cells,
|
|
public int $totalQuarters,
|
|
public bool $pinned,
|
|
) {}
|
|
|
|
public function cell(string $day): ?TimesheetCell
|
|
{
|
|
return $this->cells[$day] ?? null;
|
|
}
|
|
|
|
/**
|
|
* The laskutusperuste new entries get: from the job's payment basis.
|
|
*/
|
|
public function defaultBillingModel(): EntryBillingModel
|
|
{
|
|
return EntryBillingModel::forPaymentBasis($this->task->paymentBasis);
|
|
}
|
|
}
|