fixed the isseu of the guest booking page when logged in
This commit is contained in:
parent
c7f4e53246
commit
861266204e
|
|
@ -65,6 +65,12 @@ return [
|
|||
'limit_message' => 'ملاحظة: يمكنك حجز استشارة واحدة كحد أقصى في اليوم.',
|
||||
'user_booked' => 'حجزك',
|
||||
|
||||
// Logged-in user on guest page
|
||||
'logged_in_title' => 'لديك حساب بالفعل',
|
||||
'logged_in_message' => 'كمستخدم مسجل، يمكنك حجز الاستشارات مباشرة من لوحة التحكم الخاصة بك بطريقة أسهل وتتبع أفضل.',
|
||||
'go_to_dashboard' => 'احجز من حسابي',
|
||||
'or_logout' => 'أو قم بتسجيل الخروج للمتابعة كضيف',
|
||||
|
||||
// Guest booking
|
||||
'guest_intro' => 'اطلب موعد استشارة. لا حاجة لإنشاء حساب - ما عليك سوى ملء بياناتك أدناه.',
|
||||
'guest_name' => 'الاسم الكامل',
|
||||
|
|
|
|||
|
|
@ -65,6 +65,12 @@ return [
|
|||
'limit_message' => 'Note: You can book a maximum of 1 consultation per day.',
|
||||
'user_booked' => 'Your booking',
|
||||
|
||||
// Logged-in user on guest page
|
||||
'logged_in_title' => 'You Already Have an Account',
|
||||
'logged_in_message' => 'As a registered user, you can book consultations directly from your dashboard with a simpler process and better tracking.',
|
||||
'go_to_dashboard' => 'Book from My Account',
|
||||
'or_logout' => 'Or log out to continue as a guest',
|
||||
|
||||
// Guest booking
|
||||
'guest_intro' => 'Request a consultation appointment. No account required - simply fill in your details below.',
|
||||
'guest_name' => 'Full Name',
|
||||
|
|
|
|||
|
|
@ -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,6 +197,37 @@ new #[Layout('components.layouts.public')] class extends Component
|
|||
{{ __('booking.request_consultation') }}
|
||||
</flux:heading>
|
||||
|
||||
@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>
|
||||
|
||||
<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="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') }}
|
||||
|
|
@ -333,4 +366,5 @@ new #[Layout('components.layouts.public')] class extends Component
|
|||
@enderror
|
||||
@endif
|
||||
@endif
|
||||
@endif
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -19,12 +19,15 @@ test('guest can view booking page', function () {
|
|||
->assertSee(__('booking.request_consultation'));
|
||||
});
|
||||
|
||||
test('logged in user is redirected to client booking', function () {
|
||||
test('logged in user sees message to book from dashboard', function () {
|
||||
$user = User::factory()->client()->create();
|
||||
|
||||
$this->actingAs($user)
|
||||
->get(route('booking'))
|
||||
->assertRedirect(route('client.consultations.book'));
|
||||
->assertOk()
|
||||
->assertSee(__('booking.logged_in_title'))
|
||||
->assertSee(__('booking.logged_in_message'))
|
||||
->assertSee(__('booking.go_to_dashboard'));
|
||||
});
|
||||
|
||||
test('guest booking page shows calendar', function () {
|
||||
|
|
|
|||
Loading…
Reference in New Issue