authorize('dashboard.management'); } #[Computed] public function overview(): ManagementOverview { return app(ManagementOverviewQuery::class)->execute(app(Clock::class)->today()); } public function placeholder(): string { return '

'.e(__('dashboard.management.loading')).'

'; } /** * E.g. "+12,5 % edelliseen", or "ei vertailukohtaa" when the earlier value was zero. */ public function change(int $current, int $previous): string { $ratio = (new Change($current, $previous))->ratio(); if ($ratio === null) { return __('dashboard.management.no_comparison'); } return __('dashboard.management.change', ['change' => ($ratio > 0 ? '+' : ($ratio < 0 ? '−' : '±')).$this->percent(abs($ratio))]); } public function load(Workload $load): string { $ratio = $load->ratio(); return $ratio === null ? '–' : $this->percent($ratio); } public function render(): mixed { return $this->view(); } }; ?>
@php($overview = $this->overview)

{{ __('dashboard.management.title') }}

{{ __('dashboard.todo.title') }}

    @can('time.approve-others')
  • {{ trans_choice('dashboard.todo.approvals', count($overview->pendingApprovals), ['count' => count($overview->pendingApprovals)]) }} @if ($overview->pendingApprovals !== [])
      @foreach ($overview->pendingApprovals as $pending)
    • {{ __('dashboard.todo.approval_line', ['name' => $pending->name, 'hours' => $this->hours($pending->quarters), 'weeks' => $pending->weekCount]) }}
    • @endforeach
    @endif
  • @endcan @can('billing.manage')
  • {{ trans_choice('dashboard.todo.done_jobs', $overview->doneJobCount, ['count' => $overview->doneJobCount]) }}
  • @if ($overview->draftExportId !== null)
  • {{ __('dashboard.todo.draft') }}
  • @endif @endcan @can('sales.close-day') @if ($overview->unclosedCashDays !== [])
  • {{ trans_choice('dashboard.todo.cash_days', count($overview->unclosedCashDays), ['count' => count($overview->unclosedCashDays), 'first' => $this->dateLabel($overview->unclosedCashDays[0])]) }}
  • @endif @endcan @can('machines.use') @if ($overview->lateMaintenance !== [])
  • {{ trans_choice('dashboard.todo.maintenance', count($overview->lateMaintenance), ['count' => count($overview->lateMaintenance)]) }}
      @foreach ($overview->lateMaintenance as $late)
    • {{ __('dashboard.todo.maintenance_line', ['machine' => $late['machine'], 'item' => $late['item']]) }}
    • @endforeach
  • @endif @endcan @can('inventory.view') @if ($overview->stockItemsToOrder > 0)
  • {{ trans_choice('dashboard.todo.stock', $overview->stockItemsToOrder, ['count' => $overview->stockItemsToOrder]) }}
  • @endif @endcan @can('reports.view')
  • {{ __('dashboard.todo.unbilled', ['amount' => $this->money($overview->unbilledValueCents)]) }}
  • @endcan
@can('reports.view')

{{ __('dashboard.month.title') }}

{{ __('dashboard.month.period', [ 'from' => $this->dateLabel($overview->monthFrom), 'to' => $this->dateLabel($overview->monthTo), 'previous_from' => $this->dateLabel($overview->previousFrom), 'previous_to' => $this->dateLabel($overview->previousTo), ]) }}

@php($month = $overview->month) @php($previous = $overview->previousMonth)
@foreach ([ ['label' => 'customer_hours', 'value' => $this->hours($month->customerQuarters).' h', 'current' => $month->customerQuarters, 'previous' => $previous->customerQuarters, 'route' => 'reports.hours'], ['label' => 'internal_hours', 'value' => $this->hours($month->internalQuarters).' h', 'current' => $month->internalQuarters, 'previous' => $previous->internalQuarters, 'route' => 'reports.hours'], ['label' => 'billed', 'value' => $this->money($month->billedCents), 'current' => $month->billedCents, 'previous' => $previous->billedCents, 'route' => 'reports.profitability'], ['label' => 'margin', 'value' => $month->marginCents === null ? __('dashboard.month.no_cost') : $this->money($month->marginCents), 'current' => $month->marginCents, 'previous' => $previous->marginCents, 'route' => 'reports.profitability'], ['label' => 'sales', 'value' => $this->money($month->salesCents), 'current' => $month->salesCents, 'previous' => $previous->salesCents, 'route' => 'reports.sales'], ] as $figure)
{{ __('dashboard.month.'.$figure['label']) }}
{{ $figure['value'] }}
@if ($figure['current'] !== null && $figure['previous'] !== null)
{{ $this->change($figure['current'], $figure['previous']) }}
@endif
@endforeach

{{ __('dashboard.month.billing_note') }}

@endcan

{{ __('dashboard.stock.title') }}

@foreach ($overview->jobCounts as $status => $count) @endforeach
{{ __('dashboard.stock.caption') }}
{{ __('dashboard.stock.status') }} {{ __('dashboard.stock.count') }}
{{ __('jobs.statuses.'.$status) }} {{ $count }}

@if ($overview->overdueJobCount > 0)

@if ($overview->overdueTaskCount > 0)

@if ($overview->oldestOverdueTasks !== [])

{{ __('dashboard.stock.oldest_overdue') }}

    @foreach ($overview->oldestOverdueTasks as $task)
  • {{ $task->title }} {{ $task->jobNumber }} {{ $task->jobName }} · {{ $task->assigneeName ?? __('dashboard.stock.no_assignee') }} · {{ __('dashboard.tasks.due', ['date' => $this->dateLabel((string) $task->dueOn)]) }}
  • @endforeach
@endif

{{ __('dashboard.load.title') }}

@if ($overview->workloads === [])

{{ __('dashboard.load.none') }}

@else
@foreach ($overview->workloads as $person) @foreach ([$person->thisWeek, $person->nextWeek] as $index => $load) @endforeach @endforeach
{{ __('dashboard.load.caption') }}
{{ __('dashboard.load.person') }} {{ __('dashboard.load.week', ['from' => $this->dateLabel($overview->thisMonday)]) }} {{ __('dashboard.load.week', ['from' => $this->dateLabel($overview->nextMonday)]) }}
{{ $person->name }} {{ __('dashboard.load.value', ['booked' => $this->hours(intdiv($load->bookedMinutes, 15)), 'capacity' => $this->hours(intdiv($load->capacityMinutes, 15)), 'ratio' => $this->load($load)]) }} @if ($load->isOverloaded()) @endif

{{ __('dashboard.load.note') }}

{{ __('dashboard.load.to_calendar') }}

@endif