@php $periodMeta = [ 'weekly' => ['label' => __('Week'), 'icon' => 'calendar-days'], 'monthly' => ['label' => __('Month'), 'icon' => 'calendar-days'], 'quarterly' => ['label' => __('Quarter'), 'icon' => 'calendar-days'], 'yearly' => ['label' => __('Year'), 'icon' => 'calendar-days'], ]; $viewMeta = [ 'managed' => ['label' => __('Managed'), 'icon' => 'briefcase', 'hint' => __('Opportunities they own')], 'originated' => ['label' => __('Originated'), 'icon' => 'flag', 'hint' => __('Opportunities they brought in')], 'supported' => ['label' => __('Supported'), 'icon' => 'users', 'hint' => __('Opportunities they collaborate on')], ]; $statusMeta = [ 'met' => ['label' => __('Met'), 'color' => 'emerald'], 'on_track' => ['label' => __('On track'), 'color' => 'sky'], 'behind' => ['label' => __('Behind'), 'color' => 'rose'], 'no_target' => ['label' => __('No target set'), 'color' => 'slate'], 'not_available' => ['label' => __('Not available'), 'color' => 'slate'], ]; $kpiMeta = [ ['label' => __('Officers'), 'value' => $kpis['officers'], 'icon' => 'users', 'accent' => '#6366f1', 'sub' => $windowLabel], ['label' => __('Targets in force'), 'value' => $kpis['targets'], 'icon' => 'flag', 'accent' => '#0ea5e9', 'sub' => __('Approved for this period')], ['label' => __('Met or on track'), 'value' => $kpis['met'], 'icon' => 'check-circle', 'accent' => '#10b981', 'sub' => __(':pct% of the period gone', ['pct' => number_format($expected, 0)])], ['label' => __('Behind'), 'value' => $kpis['behind'], 'icon' => 'exclamation-triangle', 'accent' => '#e11d48', 'sub' => __('Below the pace for today')], ['label' => __('Awaiting approval'), 'value' => $kpis['awaiting'], 'icon' => 'clock', 'accent' => '#f59e0b', 'sub' => __('Targets not yet in force')], ]; $fmt = fn (?float $v, bool $percent = false): string => $v === null ? __('Not available') : rtrim(rtrim(number_format($v, 1), '0'), '.').($percent ? '%' : ''); @endphp
@if ($canSetTargets) {{ __('Set targets') }} @endif {{ __('Weekly reports') }} {{-- Period, view and officer --}}
@foreach ($periodMeta as $key => $meta) @endforeach
{{ $windowLabel }} @if ($offset < 0) @endif
@foreach ($viewMeta as $key => $meta) @endforeach
@if ($seesTeam) @endif

{{ __('The view decides whose opportunities count: :hint. Activity figures always count whoever did the work. The three views overlap and are never added together.', ['hint' => mb_strtolower($viewMeta[$view]['hint'])]) }}

@foreach ($kpiMeta as $m)

{{ $m['label'] }}

{{ number_format($m['value']) }}

{{ $m['sub'] }}
@endforeach
@forelse ($cards as $card)

{{ $card['user']->name }}

{{ $card['role'] ?? __('No role') }}

{{ __('Active pipeline') }}
{{ number_format($card['pipeline']['count']) }} ยท {{ $card['pipeline']['value_base'] === null ? __('Not estimated') : number_format($card['pipeline']['value_base'], 0) }}
{{ __('Win rate') }}
{{ $card['winRate'] === null ? __('Not applicable') : number_format($card['winRate'] * 100, 0).'%' }}
{{ __('Gone quiet') }}
{{ number_format($card['stale']) }}
{{ __('Wins: originated / managed / supported') }}
{{ $card['credit']['originated'] }} / {{ $card['credit']['managed'] }} / {{ $card['credit']['supported'] }}
@forelse ($card['rows'] as $row) @empty @endforelse
{{ __('Measure') }} {{ __('Target') }} {{ __('Actual') }} {{ __('Remaining') }} {{ __('Progress') }} {{ __('Status') }}

{{ __($row['label']) }}

{{ __($row['definition']) }}

@if ($row['target'] === null) {{ __('Not set') }} @else {{ $fmt($row['target'], $row['percent']) }} @if ($row['revision'] > 1) {{ __('Revision :n', ['n' => $row['revision']]) }} @endif @endif @if ($row['pending']) {{ __('Change awaiting approval') }} @endif {{ $fmt($row['actual'], $row['percent']) }} {{ $row['remaining'] === null ? __('Not applicable') : $fmt($row['remaining'], $row['percent']) }} @if ($row['pct'] !== null)
{{ number_format($row['pct'], 0) }}%
@else {{ __('Not applicable') }} @endif
{{ $statusMeta[$row['status']]['label'] }}
@empty @endforelse