@php $money = fn (?float $v): string => $v === null ? __('Not available') : trim($base.' '.number_format($v, 2)); $viewMeta = [ 'originated' => ['icon' => 'flag', 'hint' => __('Credited to the person who brought each sale in.')], 'managed' => ['icon' => 'briefcase', 'hint' => __('Credited to the owner who managed each sale.')], 'supported' => ['icon' => 'users', 'hint' => __('Credited to every collaborator who supported each sale.')], ]; $kpis = [ ['label' => __('Won'), 'value' => number_format($company['count']), 'icon' => 'trophy', 'accent' => '#6366f1', 'sub' => __('Win rate :r', ['r' => $winRate === null ? __('not applicable') : number_format($winRate * 100, 1).'%'])], ['label' => __('Confirmed'), 'value' => $money($company['confirmed']), 'icon' => 'check-circle', 'accent' => '#0ea5e9', 'sub' => __('Each sale once')], ['label' => __('Invoiced'), 'value' => $money($company['invoiced']), 'icon' => 'document-text', 'accent' => '#8b5cf6', 'sub' => __('Less voids and credit notes')], ['label' => __('Received'), 'value' => $money($company['received']), 'icon' => 'banknotes', 'accent' => '#10b981', 'sub' => __('Less refunds')], ['label' => __('Outstanding'), 'value' => $money($company['outstanding']), 'icon' => 'clock', 'accent' => '#f59e0b', 'sub' => __('Invoiced, not yet received')], ]; $selectClass = 'rounded-xl border-slate-300 text-sm shadow-sm focus:border-indigo-500 focus:ring-indigo-500'; @endphp
{{ $m['label'] }}
{{ $m['value'] }}
{{ $m['sub'] }}{{ $viewMeta[$view]['hint'] }} {{ __('There is deliberately no total row: one sale can sit with several people, so their figures overlap. The company figures above count each sale once.') }}
| {{ __('Person') }} | {{ __('Sales') }} | {{ __('Confirmed') }} | {{ __('Invoiced') }} | {{ __('Received') }} | {{ __('Outstanding') }} |
|---|---|---|---|---|---|
| {{ $person['name'] }} | {{ $person['count'] }} | @foreach (['confirmed', 'invoiced', 'received', 'outstanding'] as $key){{ $money($person[$key]) }} | @endforeach|||
|
|
|||||
{{ __('Each sale once, with everyone credited for it.') }}
| {{ __('Opportunity') }} | {{ __('Originated') }} | {{ __('Managed') }} | {{ __('Supported') }} | {{ __('Confirmed') }} | {{ __('Invoiced') }} | {{ __('Received') }} |
|---|---|---|---|---|---|---|
|
{{ $o->title }}
{{ $o->customer?->name }}
|
{{ $o->originator?->name ?? __('Nobody recorded') }} | {{ $o->owner?->name ?? __('Nobody recorded') }} | {{ $o->collaborators->map(fn ($c) => $c->user?->name)->filter()->unique()->implode(', ') ?: __('None') }} | @foreach (['confirmed', 'invoiced', 'received'] as $key){{ $money($f[$key]) }} | @endforeach||
|
|
||||||
| {{ __('Company total, each sale once') }} | @foreach (['confirmed', 'invoiced', 'received'] as $key){{ $money($company[$key]) }} | @endforeach|||||