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. --}}
{{ __('reports.filters.all_service_units') }}
@foreach ($report->serviceUnits as $id => $name)
{{ $name }}
@endforeach
{{ __('reports.filters.all_customers') }}
@foreach ($report->customers as $id => $name)
{{ $name }}
@endforeach
{{ $this->periodLabel() }}
@if ($report->people === [])
{{ __('reports.hours.none') }}
@else
{{ __('reports.hours.table', ['period' => $this->periodLabel()]) }}
{{ __('reports.hours.person') }}
{{ __('reports.hours.total') }}
{{ __('reports.hours.customer') }}
{{ __('reports.hours.internal') }}
{{ __('reports.hours.unapproved') }}
{{ __('reports.hours.billed') }}
@foreach ($report->people as $person)
{{ $person->name }}
{{ $this->hours($person->quarters) }}
{{ $this->hours($person->customerQuarters) }}
{{ $this->hours($person->internalQuarters) }}
{{ $this->hours($person->unapprovedQuarters) }}
{{ $this->hours($person->billedQuarters) }}
@endforeach
{{ __('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)]) }}
{{ __('reports.hours.by_work_type') }}
{{ __('reports.hours.work_type') }}
{{ __('reports.hours.hours') }}
@foreach ($person->byWorkType as $row)
{{ $row->label }}
{{ $this->hours($row->quarters) }}
@endforeach
{{ __('reports.hours.by_job') }}
{{ __('reports.hours.job') }}
{{ __('reports.hours.hours') }}
@foreach ($person->byJob as $row)
{{ $row->label }}
{{ $this->hours($row->quarters) }}
@endforeach
@endforeach
@endif
@endif