@php $activeBusiness = $activeBusinessId ? collect($businesses)->firstWhere('enc_id', $activeBusinessId) : null; @endphp {{-- BUSINESS DROPDOWN AND ADD BUSINESS BUTTON --}}
{{-- Link to open setup/welcome wizard --}} New? Go through setup wizard @if (count($businesses) > 1)
@elseif (count($businesses) === 1)
{{ $businesses[0]['name'] }}
{{ ($businesses[0]['is_owner'] ?? false) ? 'You own this business' : 'You manage this business' }}
@endif {{-- Add Business Button - Right Aligned --}}
{{-- Empty state - Show onboarding when no businesses --}} @if (count($businesses) === 0)
{{-- Analytics Preview --}}
@endif {{-- Active business panel: stable Livewire keys + prop updates (no destroy/recreate on switch) --}} @if ($activeBusinessId) @php $active = collect($businesses)->firstWhere('enc_id', $activeBusinessId); $isOwner = $active && ($active['is_owner'] ?? false); $plan = [ 'plan' => $active['owner_subscription_name'] ?? 'starter', 'expired' => (bool)($active['is_expired_subscription'] ?? true), ]; @endphp @if ($active) {{-- Keyed shell: swap whole card on business change (avoids morphing the large settings template) --}}
@endif @endif