@extends('layouts.app') @section('page_title','Dashboard') @section('content')
@php($stats=[['Total Income',$s['income'],'#16a34a',$s['changes']['income']],['Total Expenses',$s['expense'],'#ef4444',$s['changes']['expense']],['Total Savings',$s['savings'],'#2563eb',$s['changes']['savings']],['Net Cash Flow',$s['net'],'#16a34a',$s['changes']['net']],['Savings Rate',$s['savingsRate'].'%','#f59e0b',$s['changes']['savingsRate']],['Budget Used',$budgetUsed.'%','#0f766e',$s['changes']['budget']]]) @foreach($stats as $i=>$k)
{{$k[0]}}
{{str_contains((string)$k[1],'%')?$k[1]:'৳ '.number_format((float)$k[1],0)}}
{{$k[3]>=0?'↑':'↓'}} {{abs($k[3])}}% vs Last Month
{{['♟','◉','●','↗','◷','▣'][$i]}}
@endforeach

Income vs Expenses ({{$date->format('Y')}})

This Year⌄

Budget vs Actual (This Month)

View Details
@forelse($budgetRows as $b)@empty@endforelse
CategoryBudgetActualProgress
{{ $b->category?->name ?? 'Other' }}৳ {{number_format($b->amount,0)}}৳ {{number_format($b->actual,0)}}
{{min(100,round($b->actual/$b->amount*100))}}%
No budgets for this month.

Accounts Overview

View All
@foreach($accounts->take(5) as $a)
{{$a->name}}৳ {{number_format($a->current_balance,0)}}
@endforeach
Total Balance৳ {{number_format($balance,0)}}
@foreach([['Expense Breakdown','expense','expensesByCat','Total Expenses',$s['expense']],['Income Breakdown','income','incomeByCat','Total Income',$s['income']],['Savings Breakdown','savings','savingsByCat','Total Savings',$s['savings']]] as $chart)

{{$chart[0]}}

This Month⌄
{{$chart[3]}}৳ {{number_format($chart[4],0)}}
@endforeach

Upcoming Reminders

View All
{{-- Upcoming Loans --}} @foreach($upcomingLoans as $loan)
{{ $loan->contact?->name ?? 'Loan' }}
Loan — {{ $loan->due_date->format('d M Y') }}
৳ {{ number_format((float) $loan->outstanding, 0) }}
@endforeach {{-- Upcoming Goals --}} @foreach($upcomingGoals as $goal)
{{ $goal->name }}
Goal — {{ $goal->target_date->format('d M Y') }}
৳ {{ number_format((float) $goal->target_amount, 0) }}
@endforeach {{-- Upcoming Recurring Payments --}} @foreach($recurringReminders as $r)
{{ $r->description ?: ucfirst($r->type) }}
{{ ucfirst($r->type) }} — {{ $r->next_run->format('d M Y') }}
৳ {{ number_format((float) $r->amount, 0) }}
@endforeach @if($upcomingLoans->isEmpty() && $upcomingGoals->isEmpty() && $recurringReminders->isEmpty())
No upcoming reminders.
@endif

Recent Transactions

View All
@forelse($recent as $t)@empty@endforelse
DateTypeCategoryDescriptionAccountAmount
{{$t->transaction_date->format('d M Y')}} {{ucfirst($t->type)}}{{$t->category?->name??'—'}}{{$t->description??'—'}}{{$t->account?->name}}{{$t->type==='income'?'+':'-'}} ৳ {{number_format(abs($t->amount),0)}}
No transactions yet.

Loan Summary

View All
@foreach([['Money I Owe (Borrowed)','borrowed','red'],['Money Owed to Me (Lent)','lent','green']] as $type)
{{$type[0]}}
@php($ls=$loans->where('type',$type[1]))
Total
৳ {{number_format($ls->sum('principal'),0)}}
Repaid
৳ {{number_format($ls->sum('paid_amount'),0)}}
Outstanding
৳ {{number_format($ls->sum(fn($x)=>$x->outstanding),0)}}
@endforeach

Budget Alerts

View All
@forelse($budgetAlerts as $b)
{{$b->category?->name??'Other'}}{{round($b->actual/$b->amount*100)}}%
@empty
Everything is on track.
@endforelse
@endsection @push('scripts') @endpush