@php $typeBadge = [ 'bank' => 'indigo', 'cash' => 'emerald', 'mobile_money' => 'sky', 'director' => 'amber', 'other' => 'slate', ]; @endphp
{{-- Header: all money actions live here now, ordered (right→left): New Account · Adjust · Transfer · Income · Expense --}} {{ __('Expense') }} {{ __('Income') }} @if ($canUpdate) @endif @if ($canCutOver) {{ __('Cut-over') }} @endif @if ($canManage) @endif {{-- KPI cards: Total Available + one per account holding > 1 (base), biggest first. Money value locked at 19px per spec. Kept on a single row that scrolls horizontally when the cards can't all fit — chevron buttons + wheel-to-horizontal scroll make the overflow reachable. --}}
{{-- Left chevron --}} {{-- Right chevron --}}
@foreach ($kpis as $kpi) @php $tone = $kpi['delta'] === null ? 'muted' : ($kpi['delta'] >= 0 ? 'up' : 'down'); $pill = ['up' => 'bg-emerald-50 text-emerald-700', 'down' => 'bg-rose-50 text-rose-700', 'muted' => 'bg-slate-100 text-slate-500'][$tone]; @endphp

{{ $kpi['label'] }}

{{ $kpi['value'] }}

@if ($kpi['delta'] !== null) {{ number_format(abs($kpi['delta']), 0) }}% {{ __('vs last month') }} @else {{ __('No prior balance') }} @endif
@endforeach
{{-- Accounts Summary + Movement Ledger share one panel, switched by tabs --}}
{{-- Accounts summary, full width, auto-fitting columns --}}
@forelse ($accounts as $account)

{{ $account->name }}

{{ $account->currency_code }} {{ number_format($account->balance, 2) }}

{{ $account->type_label }}

@if ($canUpdate && ! $account->is_system) @endif
@empty
@if ($canManage) {{ __('New Account') }} @endif
@endforelse
{{-- Four-eyes control: staff without approval rights can only ask for a movement to be reversed. Nothing moves until an approver signs off. --}} @if ($canUpdate && ($pendingReversals > 0 || $pendingOnly))
@if ($canApproveReversal) {{ trans_choice('{1}:count reversal is waiting for your approval.|[2,*]:count reversals are waiting for your approval.', $pendingReversals, ['count' => $pendingReversals]) }} @else {{ trans_choice('{1}:count reversal you requested is waiting for an administrator.|[2,*]:count reversals are waiting for an administrator.', $pendingReversals, ['count' => $pendingReversals]) }} @endif
@if ($pendingOnly) @else @endif
@endif {{-- Statement header band, the professional "statement of account" summary that shows Opening → In − Out → Closing for the chosen account/period. Only meaningful for a single account, so it appears once one is picked. --}} @if ($statement)

{{ __('Statement of Account') }}

{{ $statement['account']->name }}

{{ $statement['currency'] }} {{ $statement['period'] }}
{{-- The Opening → In − Out = Closing flow --}}

{{ __('Opening') }}

{{ number_format($statement['opening'], 2) }}

{{ __('Money In') }}

+{{ number_format($statement['in'], 2) }}

{{ __('Money Out') }}

−{{ number_format($statement['out'], 2) }}

{{ __('Closing') }}

{{ number_format($statement['closing'], 2) }}

@else
{{ __('Pick a single account above to view its full statement with an opening & closing balance summary.') }}
@endif
@forelse ($movements as $movement) @php $bal = $runningBalances[$movement->id] ?? ['opening' => 0, 'closing' => 0]; $cur = $movement->account?->currency_code ?? $movement->currency_code; @endphp

{{ $movement->description ? \Illuminate\Support\Str::limit($movement->description, 40) : $movement->type_label }}

{{ $movement->occurred_at?->format('d M Y H:i') }}{{ $accountFilter === '' && $movement->account ? ' · ' . $movement->account->name : '' }}

@if ($movement->type === 'transfer')

{{ $movement->counterparty ? ($movement->direction === 'out' ? __('→ :acct', ['acct' => $movement->counterparty->name]) : __('← :acct', ['acct' => $movement->counterparty->name])) . ' · ' : '' }}{{ __('By :who', ['who' => $movement->recorder?->name ?? __('System')]) }}

@endif @if ($movement->reversed_at) {{ __('Reversed') }} @elseif ($movement->reversal_of_id) {{ __('Reversal') }} @elseif ($movement->hasPendingReversal()) {{ __('Reversal pending approval') }} @elseif ($movement->reversalWasDeclined()) {{ __('Reversal declined') }} @endif @if ($movement->hasPendingReversal() || $movement->reversalWasDeclined())

{{ \Illuminate\Support\Str::limit((string) $movement->reversal_reason, 70) }}

@endif

{{ $movement->direction === 'in' ? '+' : '−' }}{{ number_format((float) $movement->amount, 2) }}

@if ($canUpdate && $movement->isReversible()) @if ($movement->hasPendingReversal() && $canApproveReversal)
@elseif ($movement->hasPendingReversal()) {{ __('Awaiting approval') }} @elseif ($canApproveReversal) @else @endif @endif
{{ __('Opening') }} {{ number_format($bal['opening'], 2) }} {{ __('Closing') }} {{ $cur }} {{ number_format($bal['closing'], 2) }}
@empty
@endforelse
{{ $movements->links() }}
{{ $editingId ? __('Edit Account') : __('New Fund Account') }}
@if (in_array($type, \App\Models\FundAccount::HELD_TYPES, true))
@endif

{{ $editingId ? __('Opening balance is locked once set, to keep the ledger consistent. Use an adjustment to correct.') : __('Today\'s real-world balance for this account.') }}

{{ __('Cancel') }} {{ __('Save') }}
{{ __('Record Transfer') }}
@php $fromAcct = $from_account_id ? $accountOptions->firstWhere('id', (int) $from_account_id) : null; $toAcct = $to_account_id ? $accountOptions->firstWhere('id', (int) $to_account_id) : null; $crossCurrency = $fromAcct && $toAcct && $fromAcct->currency_code !== $toAcct->currency_code; @endphp
@if ($crossCurrency)
@endif
! $crossCurrency])>

{{ __('Bank/EcoCash fee to move the money out. Charged to the source account and booked as a bank charge. Leave blank if none.') }}

{{ __('Reason') }} *

{{ __('Required. Shows on the statement of both accounts, with your name.') }}

{{ __('Cancel') }} {{ __('Record Transfer') }}
{{ __('Balance Adjustment') }}
{{ __('Cancel') }} {{ __('Record Adjustment') }}
@php $reconcileAcct = $reconcile_account_id ? $accountOptions->firstWhere('id', (int) $reconcile_account_id) : null; $reconcileExpected = $reconcileAcct ? (float) $reconcileAcct->balance : 0.0; $reconcileCur = $reconcileAcct?->currency_code ?? ''; @endphp {{ __('Reconcile Balance') }}

{{ __('Count the money actually in :account and enter it below. If it differs from the system, tell us where the difference belongs so the books stay honest.', ['account' => $reconcileAcct?->name ?? __('this account')]) }}

{{ __('System balance') }}

{{ $reconcileCur }} {{ number_format($reconcileExpected, 2) }}

{{-- Allocation only matters when there's a difference to explain. --}}
{{-- Surplus options --}} {{-- Shortfall options --}} @if ($canCutOver) @endif
{{-- Category picker for income / expense allocations --}}
{{ __('Cancel') }} {{ __('Reconcile') }}
{{ __('Request a Reversal') }}
{{ __('Reversing money on the ledger needs an administrator\'s approval. Nothing moves until they sign this off.') }}
{{ __('Cancel') }} {{ __('Send for Approval') }}
{{ __('Decline the Reversal') }}

{{ __('The movement stays exactly as it is. Your note goes back to whoever asked.') }}

{{ __('Cancel') }} {{ __('Decline Request') }}