libra/docs/stories/story-7.1-client-dashboard-...

2.0 KiB

Story 7.1: Client Dashboard Overview

Epic Reference

Epic 7: Client Dashboard

User Story

As a client, I want a dashboard showing my key information at a glance, So that I can quickly see upcoming consultations and case updates.

Acceptance Criteria

Welcome Section

  • Welcome message with client name

Upcoming Consultations Widget

  • Next consultation date/time
  • Type (free/paid)
  • Status
  • Quick link to details

Active Cases Widget

  • Count of active timelines
  • Latest update preview
  • Link to full list

Recent Updates Widget

  • Last 3 timeline updates (across all cases)
  • Case name and date
  • Link to full timeline

Booking Status Widget

  • Pending booking requests
  • Daily booking limit indicator
  • Quick book button

Design

  • Clean, card-based layout
  • Mobile-first responsive
  • Bilingual content

Technical Notes

new class extends Component {
    public function with(): array
    {
        $user = auth()->user();

        return [
            'upcomingConsultation' => $user->consultations()
                ->approved()
                ->upcoming()
                ->first(),
            'activeTimelinesCount' => $user->timelines()->active()->count(),
            'recentUpdates' => TimelineUpdate::whereHas('timeline', fn($q) => $q->where('user_id', $user->id))
                ->latest()
                ->take(3)
                ->with('timeline')
                ->get(),
            'pendingBookings' => $user->consultations()->pending()->count(),
            'canBookToday' => !$user->consultations()
                ->whereDate('scheduled_date', today())
                ->whereIn('status', ['pending', 'approved'])
                ->exists(),
        ];
    }
};

Definition of Done

  • All widgets display correctly
  • Data scoped to logged-in user
  • Mobile responsive
  • Bilingual
  • Tests pass

Estimation

Complexity: Medium | Effort: 4-5 hours