fixed the isseu of the guest booking page when logged in

This commit is contained in:
Naser Mansour
2026-01-08 19:53:36 +02:00
parent c7f4e53246
commit 861266204e
4 changed files with 68 additions and 19 deletions
@@ -35,11 +35,13 @@ new #[Layout('components.layouts.public')] class extends Component
public bool $showConfirmation = false;
public bool $isLoggedIn = false;
public function mount(): void
{
// Redirect logged-in users to client booking
// Check if user is logged in - show friendly message instead of booking form
if (auth()->check()) {
$this->redirect(route('client.consultations.book'));
$this->isLoggedIn = true;
return;
}
@@ -195,24 +197,55 @@ new #[Layout('components.layouts.public')] class extends Component
{{ __('booking.request_consultation') }}
</flux:heading>
@if(session('success'))
<flux:callout variant="success" class="mb-6">
{{ session('success') }}
</flux:callout>
@endif
@if($isLoggedIn)
{{-- Logged-in user message --}}
<div class="bg-white rounded-lg shadow-sm border border-amber-200 p-8 text-center">
<div class="mb-6">
<div class="mx-auto w-16 h-16 bg-amber-100 rounded-full flex items-center justify-center mb-4">
<flux:icon name="user-circle" class="w-8 h-8 text-amber-600" />
</div>
<flux:heading size="lg" class="text-body mb-2">
{{ __('booking.logged_in_title') }}
</flux:heading>
<p class="text-zinc-600 max-w-md mx-auto">
{{ __('booking.logged_in_message') }}
</p>
</div>
@if(!$selectedDate || !$selectedTime)
{{-- Step 1: Calendar Selection --}}
<flux:callout class="mb-6">
<p class="text-body">{{ __('booking.guest_intro') }}</p>
</flux:callout>
<div class="flex flex-col sm:flex-row gap-3 justify-center">
<flux:button
href="{{ route('client.consultations.book') }}"
variant="primary"
class="min-h-[44px]"
>
<flux:icon name="calendar" class="w-4 h-4 me-2" />
{{ __('booking.go_to_dashboard') }}
</flux:button>
</div>
<p class="mb-4 text-zinc-600">
{{ __('booking.select_date_time') }}
</p>
<livewire:availability-calendar />
<p class="mt-6 text-sm text-zinc-500">
{{ __('booking.or_logout') }}
</p>
</div>
@else
@if(session('success'))
<flux:callout variant="success" class="mb-6">
{{ session('success') }}
</flux:callout>
@endif
@if(!$selectedDate || !$selectedTime)
{{-- Step 1: Calendar Selection --}}
<flux:callout class="mb-6">
<p class="text-body">{{ __('booking.guest_intro') }}</p>
</flux:callout>
<p class="mb-4 text-zinc-600">
{{ __('booking.select_date_time') }}
</p>
<livewire:availability-calendar />
@else
{{-- Step 2+: Contact Form & Confirmation --}}
<div class="bg-amber-50 p-4 rounded-lg mb-6 border border-amber-200">
<div class="flex justify-between items-center">
@@ -332,5 +365,6 @@ new #[Layout('components.layouts.public')] class extends Component
</flux:callout>
@enderror
@endif
@endif
@endif
</div>