@extends('layouts.finance') @section('title', 'Bank Accounts') @section('subtitle', 'Manage and view detail on every account') @section('content') @php $dateFilter = $dateFilter ?? ['active' => false, 'from' => null, 'to' => null, 'label' => null]; $dateFilterActive = (bool) ($dateFilter['active'] ?? false); $balanceFor = fn($account) => $dateFilterActive ? (float) ($account->filtered_balance ?? 0) : (float) $account->current_balance; // Wallets default to USD, so they were being counted inside "US Total" with // no way to see them. Split them out the same way the dashboard does. $isWallet = fn($account) => trim((string) ($account->transaction_category ?? '')) === 'Wallets'; $walletAccounts = $accounts->filter($isWallet); $bankOnly = $accounts->reject($isWallet); $walletTotal = $walletAccounts->sum($balanceFor); $usTotal = $bankOnly->where('currency', 'USD')->sum($balanceFor); $pkTotal = $bankOnly->where('currency', 'PKR')->sum($balanceFor); $auTotal = $bankOnly->where('currency', 'AUD')->sum($balanceFor); // Everything in USD terms, so the page has one figure that ties to the // dashboard's Bank Balance (which has always included wallets). $grandTotalUsd = $usTotal + $walletTotal + $metrics->usd($pkTotal, 'PKR') + $metrics->usd($auTotal, 'AUD'); $countryFor = fn($currency) => $currency === 'PKR' ? 'Pakistan' : ($currency === 'AUD' ? 'Australia' : 'USA'); $pillFor = fn($currency) => $currency === 'PKR' ? 'pill-amber' : ($currency === 'AUD' ? 'pill-teal' : 'pill-blue'); @endphp @include('dashboard.cards._date-filter', ['dateFilter' => $dateFilter, 'filterRoute' => 'finance.accounts'])
Accounts
{{ $accounts->count() }}
US Total
{{ $metrics->money($usTotal) }}
PK Total
{{ $metrics->money($pkTotal, 'PKR') }}
AU Total
{{ $metrics->money($auTotal, 'AUD') }}
Wallets
{{ $metrics->money($walletTotal) }}
{{ $walletAccounts->count() }} account(s)
All Accounts
{{ $metrics->money($grandTotalUsd) }}
Banks + wallets, in USD

All Bank Accounts

+ Add Account
@forelse($accounts as $account) @empty @endforelse
Entity Bank Country Account # Balance Cur. Rate Links
{{ $account->name }} {{ $account->bank_name }} {{ $countryFor($account->currency) }} {{ $account->account_number ?: '-' }} {{ $metrics->money($balanceFor($account), $account->currency) }} {{ $account->currency }} {{ $account->conversion_rate ? number_format((float) $account->conversion_rate, 2) : '-' }} @if($account->credit_sources_count || $account->debit_destinations_count) In {{ $account->credit_sources_count }} Out {{ $account->debit_destinations_count }} @else No links @endif Edit
@csrf @method('DELETE')
No accounts yet - click + Add Account to create one
@endsection