startPeriod($clock); } #[Computed] public function report(): ?HoursReport { $period = $this->period(); if ($period === null) { return null; } return app(HoursByPerson::class)->execute( $period, ctype_digit($this->serviceUnit) ? (int) $this->serviceUnit : null, ctype_digit($this->customer) ? (int) $this->customer : null, ); } public function updated(): void { $this->authorize('reports.view'); unset($this->report); } public function csv(): string { return $this->csvUrl('hours', ['yksikko' => $this->serviceUnit, 'asiakas' => $this->customer]); } public function chartSummary(HoursReport $report): string { return implode(', ', array_map( fn ($person): string => $person->name.' '.$this->hours($person->quarters).' h', array_slice($report->people, 0, 15), )); } public function render(): mixed { return $this->view()->title(__('reports.hours.title')); } }; ?>
{{ __('reports.hours.title') }} @php($report = $this->report) @if ($report !== null)
{{-- TallStackUI's native select does not tie its label to the control, so aria-label names it. --}} @foreach ($report->serviceUnits as $id => $name) @endforeach @foreach ($report->customers as $id => $name) @endforeach

{{ $this->periodLabel() }}

@if ($report->people === []) {{ __('reports.hours.none') }} @else
@foreach ($report->people as $person) @endforeach
{{ __('reports.hours.table', ['period' => $this->periodLabel()]) }}
{{ __('reports.hours.person') }} {{ __('reports.hours.total') }} {{ __('reports.hours.customer') }} {{ __('reports.hours.internal') }} {{ __('reports.hours.unapproved') }} {{ __('reports.hours.billed') }}
{{ $person->name }} {{ $this->hours($person->quarters) }} {{ $this->hours($person->customerQuarters) }} {{ $this->hours($person->internalQuarters) }} {{ $this->hours($person->unapprovedQuarters) }} {{ $this->hours($person->billedQuarters) }}
{{ __('reports.total') }} {{ $this->hours($report->total->quarters) }} {{ $this->hours($report->total->customerQuarters) }} {{ $this->hours($report->total->internalQuarters) }} {{ $this->hours($report->total->unapprovedQuarters) }} {{ $this->hours($report->total->billedQuarters) }}

{{ __('reports.hours.breakdown') }}

@foreach ($report->people as $person)
{{ __('reports.hours.person_summary', ['name' => $person->name, 'hours' => $this->hours($person->quarters)]) }}
@foreach ($person->byWorkType as $row) @endforeach
{{ __('reports.hours.by_work_type') }}
{{ __('reports.hours.work_type') }} {{ __('reports.hours.hours') }}
{{ $row->label }} {{ $this->hours($row->quarters) }}
@foreach ($person->byJob as $row) @endforeach
{{ __('reports.hours.by_job') }}
{{ __('reports.hours.job') }} {{ __('reports.hours.hours') }}
{{ $row->label }} {{ $this->hours($row->quarters) }}
@endforeach
@endif @endif