@endif
@if ($currentStep == 2)
@php
$user = auth()->user();
$subscription = $user->subscription ?? null;
$planName = $subscription ? strtolower($subscription->plan->name ?? '') : '';
$isTrialPlan = $subscription && !$subscription->expired() && in_array($planName, ['pro trial', 'multi pro trial', 'top 3 trial']);
@endphp
{{-- Non-scrolling: heading, loading, error, Find Business (dropdown must not be clipped) --}}
Choose your primary business.
@if ($isLoading)
Loading your businesses...
Please wait while we fetch your Google Business Profile locations. This may take a few seconds.
@endif
@if ($errorMessage && !$isLoading)
Error
{{ $errorMessage }}
@if (str_contains($errorMessage, 'reconnect') || str_contains($errorMessage, 'permissions'))
@endif
@endif
{{-- Find Your Business flow - Alpine + Livewire entangle so dropdown state survives re-renders --}}
@if ($showFindBusiness && !$isLoading)
Can't find your business?
Search your business by name and town.
{{-- Dropdown: show immediately when 2+ chars typed (client-side) so user sees "Searching..." right away --}}
{{-- Loading: during debounce (typed 2+ chars but server hasn't received), during request, or while API is searching --}}
Searching for businesses...
{{-- Results: hide when loading --}}
@if (count($findBusinessResults) > 0)
@foreach ($findBusinessResults as $result)
@php
$mainText = $result['structured_formatting']['main_text'] ?? $result['description'] ?? 'Unknown';
$secondaryText = $result['structured_formatting']['secondary_text'] ?? '';
@endphp
@endforeach
@elseif (strlen(trim($findBusinessSearch)) >= 2)
No results found. Try a different search term.
@endif
@if ($errorMessage)
{{ $errorMessage }}
@endif
Select your business from the dropdown to add it and continue.
@endif
{{-- Scrollable: business list, confirmation, buttons --}}
@if (!empty($businesses) && !$isLoading)
@php
$hasEligibleBusiness = false;
$hasIneligibleBusiness = false;
foreach ($businesses as $business) {
if ($business['is_eligible_for_trial'] ?? true) {
$hasEligibleBusiness = true;
} else {
$hasIneligibleBusiness = true;
}
}
@endphp
@foreach ($businesses as $business)
@php
$isEligible = $business['is_eligible_for_trial'] ?? true;
$hasPlan = $business['has_existing_plan'] ?? false;
$isActive = $business['is_active'] ?? false;
$placeId = $business['place_id'] ?? '';
$isSelected = $selectedPlaceId === $placeId;
@endphp
@endforeach
@endif
@if ($showConfirmSelection)
Confirm your selection
{{ $confirmingBusinessName }}
@else
@if (!$showFindBusiness)
@endif
@endif
@endif
@if ($currentStep == 3)
Primary Business Added!
Your business has been successfully added and activated.
🎉 You're now on the free plan!
Start managing your reviews with access to free features. Upgrade anytime to unlock more capabilities.