@include('components.icons') @php $user = Auth::user(); $tenant = $user->tenant ?? null; $initials = strtoupper(substr($user->full_name ?? 'U', 0, 1)); // Get plan slug FIRST $planSlug = optional(optional($tenant)->plan)->slug; // Premium check - active OR valid trial OR admin $status = optional($tenant)->subscription_status; $trialEndsAt = optional($tenant)->trial_ends_at; $isPremium = ($status === 'active') || ($status === 'trial' && $trialEndsAt && \Carbon\Carbon::parse($trialEndsAt)->isFuture()) || ($user->is_admin ?? false); // Family plan check - use $planSlug which is now defined $isFamilyPlan = in_array($planSlug, ['family', 'family-monthly', 'family-yearly']); $current = request()->route()->getName(); // Admin check $isAdmin = $user->is_admin ?? false; $menu = [ 'MAIN' => [ ['route'=>'dashboard','icon'=>'dashboard','label'=>'Overview','free'=>true], ['route'=>'cashflow.index','icon'=>'transactions','label'=>'Cash Flow Ledger','free'=>true], ], 'PLANNING' => [ ['route'=>'budgets','icon'=>'budget','label'=>'Budget Planner','premium'=>true], ['route'=>'goals','icon'=>'goals','label'=>'Financial Goals','premium'=>true], ['route'=>'alerts','icon'=>'alerts','label'=>'Smart Alerts','premium'=>true], ['route'=>'future_planning','icon'=>'forecast','label'=>'Wealth Forecast','premium'=>true,'badge'=>'AI'], ], 'FINANCE' => [ ['route'=>'loans','icon'=>'loans','label'=>'Credit & Loans','free'=>true], ['route'=>'lending','icon'=>'lending','label'=>'Lending Portfolio','premium'=>true], ['route'=>'investments','icon'=>'investments','label'=>'Investments','premium'=>true], ['route'=>'accounts.index','icon'=>'accounts','label'=>'Accounts','free'=>true], ['route'=>'bank-reconciliation.index','icon'=>'reconcile','label'=>'Reconciliation','premium'=>true], ['route'=>'account-structure.index','icon'=>'chart_accts','label'=>'Account Structure','free'=>true], ['route'=>'reports','icon'=>'reports','label'=>'Reports','free'=>true], ['route'=>'aiassistant','icon'=>'ai','label'=>'Financial Copilot','premium'=>true,'badge'=>'AI'], ['route'=>'predictive','icon'=>'predictive','label'=>'Forecasting Engine','free'=>true], ], 'ACCOUNT' => [ ['route'=>'notifications','icon'=>'notif','label'=>'Notifications','free'=>true], ['route'=>'preferences.index','icon'=>'settings','label'=>'Preferences','free'=>true], ['route'=>'family.index','icon'=>'family','label'=>'Family Access','premium'=>true,'family_only'=>true], ['route'=>'archive.index','icon'=>'archive','label'=>'Archive','free'=>true], ], ]; @endphp {{-- Mobile toggle --}}