@php use App\Models\CutoverConfirmation; $tz = config('app.display_timezone'); $typeBadge = [ 'bank' => 'indigo', 'cash' => 'emerald', 'mobile_money' => 'sky', 'director' => 'amber', 'other' => 'slate', ]; $outstandingCount = collect($outstandingRows)->sum(fn (array $r): int => $r['accounts']->count()); $peopleCount = count($outstandingRows); $tabMeta = [ 'outstanding' => ['label' => __('Still to declare'), 'icon' => 'users', 'count' => $peopleCount], 'signoff' => ['label' => __('Needs sign-off'), 'icon' => 'shield-check', 'count' => $signOffQueue->count()], 'adjustments' => ['label' => __('Change requests'), 'icon' => 'pencil-square', 'count' => $adjustments->count()], ]; $metrics = [ [ 'label' => __('People outstanding'), 'value' => number_format($peopleCount), 'icon' => 'users', 'accent' => $peopleCount === 0 ? '#10b981' : '#f59e0b', 'sub' => $peopleCount === 0 ? __('Everybody has counted') : trans_choice('{1} :count float undeclared|[2,*] :count floats undeclared', $outstandingCount, ['count' => $outstandingCount]), ], [ 'label' => __('Awaiting sign-off'), 'value' => number_format($signOffQueue->count()), 'icon' => 'shield-check', 'accent' => '#0ea5e9', 'sub' => __('Declared, but the books disagreed'), ], [ 'label' => __('Change requests'), 'value' => number_format($adjustments->count()), 'icon' => 'pencil-square', 'accent' => '#8b5cf6', 'sub' => __('Agreed figures somebody wants moved'), ], [ 'label' => __('Deadline'), 'value' => $cutover?->due_at ? $cutover->due_at->timezone($tz)->format('j M Y') : __('Not open'), 'icon' => 'clock', 'accent' => $cutover?->isOverdue() ? '#f43f5e' : '#124a61', 'sub' => $cutover?->isOverdue() ? __('Past due') : __('Workspace cut-over'), ], ]; @endphp
{{ __('My punch-in') }} @if ($cutover === null) @else
@foreach ($metrics as $m)

{{ $m['label'] }}

{{ $m['value'] }}

{{ $m['sub'] }}
@endforeach
@foreach ($tabMeta as $key => $meta) @endforeach
{{-- ── Still to declare ───────────────────────────────────────── --}} @if ($tab === 'outstanding')

{{ __('Still to declare') }}

{{ __('Each person gets :days days of daily reminders from their own first login. Somebody who has never signed in has no clock and has never been nudged, which is exactly why they are listed here.', ['days' => $windowDays]) }}

@forelse ($outstandingRows as $row) @php $campaign = $row['campaign']; @endphp @empty @endforelse
{{ __('Holder') }} {{ __('Undeclared floats') }} {{ __('Their week') }} {{ __('Last reminded') }} {{ __('Actions') }}
{{ $row['holder']->name }}
@foreach ($row['accounts'] as $account) {{ $account->name }} @endforeach
@if ($campaign) {{ __('Day :day of :total', ['day' => $campaign->dayNumber(), 'total' => $windowDays]) }}

{{ __('Started :when', ['when' => $campaign->started_at->timezone($tz)->format('j M')]) }}

@else {{ __('Never signed in') }} @endif
@if ($campaign?->last_reminded_on) {{ $campaign->last_reminded_on->format('j M Y') }}

{{ trans_choice('{1} :count reminder|[2,*] :count reminders', $campaign->reminders_sent, ['count' => $campaign->reminders_sent]) }}

@else {{ __('Not yet') }} @endif
@endif {{-- ── Needs sign-off ─────────────────────────────────────────── --}} @if ($tab === 'signoff')

{{ __('Waiting on a signature') }}

{{ __('Declarations the books could not corroborate. The money is already on the books; this is the signature on the figure.') }}

@forelse ($signOffQueue as $item) @empty @endforelse
{{ __('Holder') }} {{ __('Account') }} {{ __('Declared') }} {{ __('Variance') }} {{ __('Note') }} {{ __('Actions') }}
{{ $item->user?->name ?? '—' }} {{ $item->fundAccount?->name ?? '—' }} {{ $item->fundAccount?->currency_code }} {{ number_format((float) $item->declared_amount, 2) }} {{ number_format((float) $item->variance, 2) }} {{ $item->note ?: '—' }}
@endif {{-- ── Change requests ────────────────────────────────────────── --}} @if ($tab === 'adjustments')

{{ __('Requests to change an agreed figure') }}

{{ __('These have already been counted and agreed once, so the number below is where the account\'s books currently begin. Approving moves that starting line; nothing has changed until you do.') }}

@forelse ($adjustments as $item) @php $delta = (float) $item->adjustment_amount - (float) $item->declared_amount; @endphp @empty @endforelse
{{ __('Asked by') }} {{ __('Account') }} {{ __('Opens on') }} {{ __('Asked for') }} {{ __('Reason') }} {{ __('Actions') }}

{{ $item->adjustmentRequester?->name ?? '—' }}

{{ $item->adjustment_requested_at?->timezone($tz)->format('j M Y, H:i') }}

{{ $item->fundAccount?->name ?? '—' }}

{{ __('Held by :who', ['who' => $item->user?->name ?? '—']) }}

{{ $item->fundAccount?->currency_code }} {{ number_format((float) $item->declared_amount, 2) }} {{ $item->fundAccount?->currency_code }} {{ number_format((float) $item->adjustment_amount, 2) }}

{{ $delta >= 0 ? '+' : '−' }}{{ number_format(abs($delta), 2) }}

{{ $item->adjustment_reason ?: '—' }}
@endif @endif {{-- ── Approve / decline ──────────────────────────────────────────── --}} {{ $decisionAction === 'decline' ? __('Decline this change') : __('Approve this change') }} @if ($deciding)
{{ $deciding->fundAccount?->name }} {{ $deciding->fundAccount?->currency_code }} {{ number_format((float) $deciding->declared_amount, 2) }} {{ number_format((float) $deciding->adjustment_amount, 2) }}

{{ __(':who asked, holding for :holder. They said: ":reason"', [ 'who' => $deciding->adjustmentRequester?->name ?? __('Somebody'), 'holder' => $deciding->user?->name ?? __('themselves'), 'reason' => $deciding->adjustment_reason, ]) }}

@endif

{{ $decisionAction === 'decline' ? __('The account keeps the figure it already opens on, and the person who asked is told why. Say something they can act on.') : __('The account\'s opening balance moves to the new figure straight away, posted against Opening Balances so no sale and no cost is invented.') }}

{{ __('Cancel') }} {{ $decisionAction === 'decline' ? __('Decline') : __('Approve') }} {{ __('Saving…') }}