masaruk Logo

analysis/04-functional-spec/dashboard-module.md

Dashboard

Dashboard Module – Functional Specification

1. Purpose

The Dashboard Module provides the primary landing screen for:

  • Admin Panel (Admin Dashboard)
  • Provider Portal (Provider Dashboard)

This module displays:

  • Key Performance Indicators (KPIs)
  • Recent activity summaries
  • Quick navigation to important modules
  • Performance charts and statistics

2. Involved Entities

EntityDescription
TripCounts displayed (active, total)
BookingCounts and recent list
UserNew user registrations count (Admin only)
ProviderActive providers count (Admin only)
PaymentTransactionRevenue summaries
AdCampaignActive campaigns count

4. Dashboard Components

4.1 Admin Dashboard KPIs

Total Bookings
Total Bookings
New Users
New Users
Total Revenue
Total Revenue
Active Trips
Active Trips
KPI CardArabic LabelData SourceDescription
Total Bookingsإجمالي الحجوزاتbookings.count()All-time booking count
New Usersمستخدمون جددusers.where(created_at > 30_days)New registrations in last 30 days
Total Revenueإجمالي الأرباحSUM(payment_transactions.amount)Platform earnings
Active Tripsالرحلات النشطةtrips.where(status = ACTIVE)Currently bookable trips

4.2 Admin Dashboard Charts

ChartArabic LabelTypeDescription
Sales Performanceأداء المبيعاتLine/Bar ChartRevenue over time (daily/weekly/monthly)

4.3 Admin Dashboard Tables

TableArabic LabelColumnsDescription
Recent Bookingsآخر الحجوزات الواردةBooking #, Customer, Trip, Date, StatusLast 5-10 bookings

4.4 Provider Dashboard KPIs

KPI CardArabic LabelData SourceDescription
My Tripsرحلاتيtrips.where(provider_id = current)Provider's total trips
My Bookingsحجوزاتيbookings.where(trip.provider_id = current)Bookings on provider's trips
My EarningsأرباحيSUM(financial_records.net_amount)Provider's net revenue
Active Campaignsالحملات النشطةad_campaigns.where(status = ACTIVE)Provider's active ads

5. Business Rules

BR-1. Dashboard data is scoped by role

RoleData Scope
SUPER_ADMINAll platform data
ADMINAll platform data
PROVIDER_ADMINOnly own provider's data
PROVIDER_STAFFOnly own provider's data

BR-2. KPIs refresh on page load

Data is fetched fresh on each dashboard access. Real-time updates are NOT required for MVP.

BR-3. Chart time ranges

Default time range: Last 30 days. User may toggle between:

  • Last 7 days
  • Last 30 days
  • Last 12 months

BR-4. Recent bookings table

Shows maximum 10 most recent bookings. Clicking a row navigates to booking details.

BR-5. Dashboard is read-only

No CRUD operations on dashboard. All actions require navigation to respective modules.

6. UI Structure

┌─────────────────────────────────────────────────────────┐
│  Sidebar  │           Dashboard Content                 │
│           │  ┌─────────┬─────────┬─────────┬─────────┐  │
│           │  │   KPI   │   KPI   │   KPI   │   KPI   │  │
│           │  └─────────┴─────────┴─────────┴─────────┘  │
│           │  ┌─────────────────────────────────────────┐│
│           │  │           Sales Chart                   ││
│           │  └─────────────────────────────────────────┘│
│           │  ┌─────────────────────────────────────────┐│
│           │  │       Recent Bookings Table             ││
│           │  └─────────────────────────────────────────┘│
└─────────────────────────────────────────────────────────┘

7. Status Badges (in Tables)

مؤكدةقيد التنفيذملغاهمكتملةقادمة
Arabic LabelColorEnum
مؤكدة (Confirmed)GreenCONFIRMED
قيد التنفيذ (Pending)OrangePENDING
ملغاه (Cancelled)Red/PinkCANCELLED
مكتملة (Completed)GreyCOMPLETED
قادمة (Upcoming)Blue/TealUPCOMING

8. Error Cases

EC-1. No data available

No data to display

EC-2. Provider account inactive

Company account is not active

EC-3. Loading state

Show skeleton loaders while data fetches.

EC-4. API error

An error occurred while loading data. Please try again.

10. Access Permissions (RBAC)

RoleAccess
SUPER_ADMINFull admin dashboard
ADMINFull admin dashboard
PROVIDER_ADMINProvider dashboard (own data)
PROVIDER_STAFFProvider dashboard (own data, view-only)
CUSTOMERNo access
FINANCE_ADMINAdmin dashboard (financial focus)