@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
{{ __('Reconciliation report') }}
{{ $window }} ยท {{ __('Amounts in :code at the rate frozen on each record', ['code' => $base]) }}
@foreach ($kpis as $m)

{{ $m['label'] }}

{{ $m['value'] }}

{{ $m['sub'] }}
@endforeach
@foreach ($views as $key => $label) @endforeach

{{ __(':view, by person', ['view' => __($views[$view])]) }}

{{ $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.') }}

@forelse ($people as $person) @foreach (['confirmed', 'invoiced', 'received', 'outstanding'] as $key) @endforeach @empty @endforelse
{{ __('Person') }} {{ __('Sales') }} {{ __('Confirmed') }} {{ __('Invoiced') }} {{ __('Received') }} {{ __('Outstanding') }}
{{ $person['name'] }} {{ $person['count'] }}{{ $money($person[$key]) }}
@include('livewire.crm.partials.paginator', ['rows' => $people])

{{ __('Sales won in the period') }}

{{ __('Each sale once, with everyone credited for it.') }}

@forelse ($won as $o) @php $f = $sales->of($o); @endphp @foreach (['confirmed', 'invoiced', 'received'] as $key) @endforeach @empty @endforelse @if ($won->isNotEmpty()) @foreach (['confirmed', 'invoiced', 'received'] as $key) @endforeach @endif
{{ __('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') }}{{ $money($f[$key]) }}
{{ __('Company total, each sale once') }}{{ $money($company[$key]) }}
@include('livewire.crm.partials.paginator', ['rows' => $won])