{{-- One part of the time sheet (docs/ui-timesheet.md 4): "Aikataulutettu" or "Lukitut työt" as its own card, a native table (an input grid is a form, not a data table) with customer → job → task rows. Every day cell has −15 min, the HH:MM field, +15 min and the entry button; today's column has the timer button on its left. Props: `section` ('scheduled' or 'pinned'), `groups`, `days`, `today` (Y-m-d or null when another week is shown), `readOnly`, `cells` (shown HH:MM values by task and day), `rejected`, `labels` (day labels). --}} @props(['section', 'groups', 'days', 'today', 'readOnly' => false, 'cells' => [], 'rejected' => [], 'labels' => [], 'collapsible' => false]) @use('App\Modules\TimeTracking\Domain\ValueObjects\WorkedHours') @use('App\Modules\Shared\Domain\ValueObjects\HexColor') @php $columnCount = 1 + count($days) + 2; $pinned = $section === 'pinned'; $taskCount = array_sum(array_map(fn ($customer) => $customer->taskCount(), $groups)); $symbolClass = fn ($model) => match ($model->value) { 'fixed' => 'border-sky-600 bg-sky-100 text-sky-900 dark:border-sky-400/60 dark:bg-sky-500/20 dark:text-sky-100', 'hourly' => 'border-emerald-600 bg-emerald-100 text-emerald-900 dark:border-emerald-400/60 dark:bg-emerald-500/20 dark:text-emerald-100', default => 'border-zinc-500 bg-zinc-100 text-zinc-800 dark:border-zinc-400/60 dark:bg-zinc-500/20 dark:text-zinc-100', }; @endphp
@foreach ($days as $day) $day === $today, 'w-[124px]' => $day !== $today]) /> @endforeach @foreach ($days as $day) @endforeach {{-- Section header row --}} @if ($taskCount === 0) @endif @foreach ($groups as $customer) @php $color = new HexColor($customer->headerColor ?? '#374151'); @endphp {{-- Level 1: customer --}} @foreach ($customer->jobs as $job) {{-- Level 2: customer job --}} @foreach ($job->rows as $row) @php $taskId = $row->task->taskId; $locked = $row->task->isLocked(); $model = $row->defaultBillingModel(); @endphp {{-- Level 3: task --}} @foreach ($days as $day) @php $cell = $row->cell($day); $quarters = $cell?->quarters ?? 0; $dayLabel = $labels[$day] ?? $day; $editable = ! $readOnly && ! $locked && ! ($cell?->approved ?? false); $fieldId = 'cell-'.$section.'-'.$taskId.'-'.$day; $errorKey = 'cells.'.$taskId.'.'.$day; @endphp @endforeach @endforeach @endforeach @endforeach
{{ __('time.sheet.caption_'.$section) }}
{{ __('time.sheet.column_task') }} $day === $today, 'border-l border-zinc-700' => $day !== $today, ])> @if ($day === $today) {{ __('time.sheet.column_total') }} {{ __('time.sheet.column_actions') }}

@if ($collapsible) @else @endif

@if ($pinned && ! $readOnly) @endif
{{ __('time.sheet.'.$section.'_empty') }}
@if (! $readOnly && Gate::allows('customers.use')) @endif
#{{ $job->number }} {{ $job->name }} @if ($job->isContinuing()) {{ __('time.sheet.live') }} @endif {{ __('time.sheet.models.'.$job->billingModel()->value) }}
{{ __('time.sheet.accumulated', ['hours' => WorkedHours::formatClock($job->accumulatedQuarters)]) }} @if (! $pinned && ! $readOnly && ! $job->status->locksTime()) @endif
{{ __('time.sheet.models.'.$model->value) }}: {{ $row->task->taskTitle }} @if ($locked) @endif $day === $today, 'border-l border-slate-200 bg-white dark:border-[#36393f] dark:bg-[#282a2e]' => $day !== $today, ])>
@if ($day === $today && $editable)
@endif @if ($editable) $quarters > 0, 'border-slate-400 bg-slate-50 text-slate-700 dark:border-[#5a5e66] dark:bg-[#1b1d20] dark:text-zinc-200' => $quarters === 0, ]) /> @else {{ WorkedHours::formatClock($quarters) }} @if ($cell?->approved)
@error($errorKey)

{{ $message }}

@enderror
{{ WorkedHours::formatClock($row->totalQuarters) }} @unless ($readOnly) @if ($pinned) @elseif (! $locked) @endif @endunless