# Story 7.6: Booking Limit Indicator ## Epic Reference **Epic 7:** Client Dashboard ## Dependencies - **Story 7.5:** New Booking Interface (provides booking page where indicator displays) - **Story 3.3:** Availability Calendar (calendar component to integrate with) ## User Story As a **client**, I want **to see my booking status and limits clearly**, So that **I understand when I can book consultations**. ## Acceptance Criteria ### Display Locations - [x] Dashboard widget showing booking status - [x] Booking page status banner ### Status Messages - [x] "You can book a consultation today" (when no booking exists for today) - [x] "You already have a booking for today" (when pending/approved booking exists for today) - [x] "You have a pending request for [date]" (shows first pending request date) ### Calendar Integration - [x] Pass `bookedDates` array to availability calendar component - [x] Calendar marks user's booked dates as unavailable (distinct styling) - [x] Visual indicator differentiates "user already booked" from "no slots available" ### Information - [x] Clear messaging about 1-per-day limit - [x] Bilingual messages (Arabic/English) ### Edge Cases - [x] Handle multiple pending requests (show count or list) - [x] Handle cancelled bookings (should not block new booking) - [x] Loading state while fetching booking status ## Technical Notes ### Files to Create - `resources/views/livewire/client/booking-status.blade.php` - Reusable status component ### Files to Modify - `resources/views/livewire/client/dashboard.blade.php` - Add booking status widget - `resources/views/livewire/client/booking.blade.php` - Add status banner (from Story 7.5) - `resources/lang/en/booking.php` - Add translation keys - `resources/lang/ar/booking.php` - Add translation keys ### Component Implementation ```php user(); $todayBooking = $user->consultations() ->whereDate('scheduled_date', today()) ->whereIn('status', ['pending', 'approved']) ->first(); $pendingRequests = $user->consultations() ->where('status', 'pending') ->where('scheduled_date', '>=', today()) ->orderBy('scheduled_date') ->get(); $upcomingApproved = $user->consultations() ->where('status', 'approved') ->where('scheduled_date', '>=', today()) ->get(); return [ 'canBookToday' => is_null($todayBooking), 'todayBooking' => $todayBooking, 'pendingRequests' => $pendingRequests, 'upcomingApproved' => $upcomingApproved, 'bookedDates' => $user->consultations() ->whereIn('status', ['pending', 'approved']) ->where('scheduled_date', '>=', today()) ->pluck('scheduled_date') ->map(fn($d) => $d->format('Y-m-d')) ->toArray(), ]; } public function with(): array { return $this->getBookingStatus(); } }; ?>
{{ __('booking.pending_for_date', ['date' => $pendingRequests->first()->scheduled_date->format('d/m/Y')]) }}
@else{{ __('booking.pending_count', ['count' => $pendingRequests->count()]) }}
{{ __('booking.limit_message') }}