{{-- resources/views/dashboard/finance.blade.php --}} @extends('layouts.app') @section('title', 'Finance Dashboard') @section('content')

Finance Dashboard

Track expenses, budgets, and cash flow at a glance.

@php // Fallbacks if controller didn't pass values $kpis = $kpis ?? [ ['label' => 'Total Expenses', 'value' => 12850.75, 'delta' => -6.2], ['label' => 'Budget Used', 'value' => 72, 'suffix' => '%', 'delta' => 2.4], ['label' => 'Net Cash Flow', 'value' => 2150.12, 'delta' => 4.1], ['label' => 'Upcoming Bills', 'value' => 5, 'delta' => 0], ]; @endphp @foreach ($kpis as $i => $k)

{{ $k['label'] }}

@if (isset($k['suffix']) && $k['suffix'] === '%') {{ number_format($k['value'], 0) }}% @else ${{ number_format($k['value'], 2) }} @endif

@php $delta = $k['delta']; @endphp @if ($delta >= 0) {{ number_format(abs($delta), 1) }}% vs prev. @else {{ number_format(abs($delta), 1) }}% vs prev. @endif
@endforeach

Expenses by Category

@php $categories = $categories ?? [ ['name' => 'Food & Dining', 'amount' => 865.24], ['name' => 'Transport', 'amount' => 310.9], ['name' => 'Utilities', 'amount' => 420.0], ['name' => 'Rent', 'amount' => 1200.0], ['name' => 'Entertainment', 'amount' => 155.7], ]; $totalCat = array_sum(array_map(fn($c) => $c['amount'], $categories)); @endphp
    @foreach ($categories as $c) @php $pct = $totalCat? round($c['amount']/$totalCat*100) : 0; @endphp
  • {{ $c['name'] }} ${{ number_format($c['amount'], 2) }} ({{ $pct }}%)
  • @endforeach

Budget vs Actual (This Month)

Manage budgets
@php $budget = $budget ?? [ ['category' => 'Food & Dining', 'budget' => 600, 'actual' => 465], ['category' => 'Transport', 'budget' => 200, 'actual' => 180], ['category' => 'Utilities', 'budget' => 450, 'actual' => 420], ['category' => 'Rent', 'budget' => 1200, 'actual' => 1200], ['category' => 'Entertainment', 'budget' => 200, 'actual' => 156], ]; @endphp
@foreach ($budget as $b) @php $pct = $b['budget'] > 0 ? min(100, round(($b['actual'] / $b['budget']) * 100)) : 0; $over = $b['actual'] > $b['budget']; @endphp
{{ $b['category'] }} ${{ number_format($b['actual'], 0) }} / ${{ number_format($b['budget'], 0) }}
@if ($over)

Over budget by ${{ number_format($b['actual'] - $b['budget'], 0) }}

@endif
@endforeach

Cash Flow (last {{ request('range', 30) }} days)

View all
@php $transactions = $transactions ?? [ [ 'date' => '2025-09-01', 'desc' => 'Coffee House', 'category' => 'Food & Dining', 'amount' => -3.8, ], ['date' => '2025-09-01', 'desc' => 'Salary', 'category' => 'Income', 'amount' => +2400.0], ['date' => '2025-08-30', 'desc' => 'Ride‑Hailing', 'category' => 'Transport', 'amount' => -6.5], [ 'date' => '2025-08-28', 'desc' => 'Electricity Bill', 'category' => 'Utilities', 'amount' => -78.2, ], ['date' => '2025-08-27', 'desc' => 'Rent', 'category' => 'Rent', 'amount' => -1200.0], ]; @endphp
@foreach ($transactions as $t) @endforeach
Date Description Category Amount
{{ \Carbon\Carbon::parse($t['date'])->format('M d, Y') }} {{ $t['desc'] }} {{ $t['category'] }} {{ $t['amount'] < 0 ? '-' : '+' }}${{ number_format(abs($t['amount']), 2) }} Details

Upcoming Bills

@php $bills = $bills ?? [ ['due' => '2025-09-05', 'name' => 'Internet', 'amount' => 35.0, 'status' => 'due'], ['due' => '2025-09-10', 'name' => 'Water', 'amount' => 12.4, 'status' => 'scheduled'], ['due' => '2025-09-15', 'name' => 'Credit Card', 'amount' => 250.0, 'status' => 'scheduled'], ]; @endphp
    @foreach ($bills as $b) @php $dueIn = \Carbon\Carbon::parse($b['due'])->diffInDays(now(), false); @endphp
  • {{ $b['name'] }}

    Due {{ \Carbon\Carbon::parse($b['due'])->format('M d') }} · ${{ number_format($b['amount'], 2) }}

    {{ $dueIn <= 0 ? 'Due now' : $dueIn . ' days' }}
  • @endforeach
Manage bills
@endsection