@php $carbonLocale = \App\Support\AppLocale::carbon(); $tx = $finance->transactions(); $budgets = $finance->budgets(); $goals = $finance->goals(); $subs = $finance->subscriptions(); $debts = $finance->debts(); $totalBalance = collect($tx)->sum('amount'); $monthIncome = collect($tx)->where('type', 'income')->sum('amount'); $monthExpenses = collect($tx)->where('type', 'expense')->sum(fn ($t) => abs($t['amount'])); $totalFlow = $monthIncome + $monthExpenses; $incomeShare = $totalFlow > 0 ? ($monthIncome / $totalFlow) * 100 : 0; $net = $monthIncome - $monthExpenses; $savingsRate = $monthIncome > 0 ? ($net / $monthIncome) * 100 : 0; $daysLeft = 14; $safeAmount = collect($budgets)->sum(fn ($b) => max(($b['limit'] ?? 0) - ($b['spent'] ?? 0), 0)); $daily = $daysLeft > 0 ? $safeAmount / $daysLeft : 0; $emergency = collect($goals)->first(fn ($g) => str_contains(strtolower($g['name']), 'emergency')); $emergencyPct = $emergency && ($emergency['target'] ?? 0) > 0 ? (($emergency['saved'] ?? 0) / $emergency['target']) * 100 : 0; $txForRecent = array_values(array_filter($tx, static function (array $row): bool { return ! \App\Support\RelativeDayLabel::isFutureTransactionDate((string) ($row['date'] ?? '')); })); $txRecentGrouped = \App\Support\RelativeDayLabel::groupedTransactionSections(collect($txForRecent)->take(6)->values()->all(), $carbonLocale); $hasFinanceData = count($tx) > 0 || count($budgets) > 0 || count($goals) > 0 || count($subs) > 0 || count($debts) > 0; $aiDashboardTips = \App\Support\FinanceDataInsights::dashboardTips($tx, $budgets, $subs, $debts, $goals); @endphp
{{ __('notifications.types.system_push_prompt_title') }}
{{ __('notifications.types.system_push_prompt_message') }}
{{ __('budgets.dashboard_page.empty_finance_title') }}
{{ __('budgets.dashboard_page.empty_finance_body') }}
{{ __('budgets.dashboard_page.empty_widgets_title') }}
{{ __('budgets.dashboard_page.empty_widgets_body') }}