# Dashboard

## Purpose
The Dashboard is the main landing page after login, providing a comprehensive overview of the Pay-U platform's financial performance, operational status, and system health. It displays real-time KPIs, transaction volumes, and quick access to common actions.

## Components
- Page header with title and subtitle
- Filter bar with currency selector and time range filters
- Financial KPI cards (10 metrics)
- Operational status cards (7 metrics)
- Activity panels (Recent Transactions, Recent Activities)
- System Health indicators (4 systems)
- Quick Actions grid (6 buttons)
- Financial Summary table (multi-currency)

## Header
- **Title**: "Statistics"
- **Subtitle**: "Overview platform financial data"
- **Filter Bar**: Currency selector (UGX/ZMW/RWF), time filters (Today, This Month, Custom Date Range)
- **Date Range Picker**: Start date, End date

## Filters
| Filter | Type | Options |
|--------|------|---------|
| Currency | select | UGX, ZMW, RWF |
| Time Range | buttons | Today, This Month, Custom Date Range |
| Date From | date | — |
| Date To | date | — |

## Search
None

## Buttons
| Button | Action | Location |
|--------|--------|----------|
| Apply Filter | Apply selected filters | Filter bar |
| Export | Export dashboard data | Header |
| Refresh | Refresh all data | Header |
| Add Merchant | Navigate to merchant creation | Quick Actions |
| Add Agent | Navigate to agent creation | Quick Actions |
| Process Payouts | Navigate to payout processing | Quick Actions |
| Download Report | Download financial report | Quick Actions |
| Send Notification | Open notification composer | Quick Actions |
| System Settings | Navigate to settings | Quick Actions |

## Statistics Cards

### Financial KPIs
| Card | Value Example | Subtext |
|------|---------------|---------|
| Total Collected | UGX 12,847,000 | +12.5% from last month |
| Collection Fees | UGX 385,410 | +12.5% from last month |
| Total Payouts | UGX 8,234,000 | +8.2% from last month |
| Payout Fees | UGX 247,020 | +8.2% from last month |
| Settlements | UGX 4,123,000 | +15.3% from last month |
| Settlement Exchange Rate | 3,750.00 | +0.5% from last month |
| Total Balance | UGX 2,485,000 | — |
| Commission | UGX 127,500 | +15.3% from last month |
| Net Profit | UGX 892,000 | — |
| Frozen Balance | UGX 450,000 | — |

### Operational Status
| Card | Value |
|------|-------|
| Total Merchants | 1,247 |
| Active Agents | 89 |
| Pending Withdrawals | 23 |
| Pending Settlements | 15 |
| Pending Transactions | 47 |
| Online Customer Services | 8 |

## Tables

### Financial Summary by Currency
| Column | Description |
|--------|-------------|
| Currency | Currency code (UGX, ZMW, RWF) |
| Collected | Total amount collected |
| Collect Fees | Fees from collections |
| Payouts | Total payouts processed |
| Payout Fees | Fees from payouts |
| Settlements | Settlement amounts |
| Exch. Rate | Exchange rate |
| Balance | Current balance |
| Commission | Earned commission |
| Net Profit | Net profit |
| Frozen | Frozen balance |

## Action Buttons
| Button | Function | Icon |
|--------|----------|------|
| Add Merchant | Open merchant creation form | Plus |
| Add Agent | Open agent creation form | Plus |
| Process Payouts | Open payout processing | Arrow Down |
| Download Report | Export financial report | Download |
| Send Notification | Open notification form | Mail |
| System Settings | Open system settings | Settings |

## Workflow
1. User logs in and lands on dashboard
2. System loads default view (This Month, UGX currency)
3. User can switch currency to see data in ZMW or RWF
4. User can filter by time range (Today, This Month, Custom)
5. KPI cards update based on selected filters
6. Financial summary table shows breakdown by currency
7. Quick actions provide shortcuts to common tasks
8. System health shows real-time status of API, Database, Settlement, Support

## Translation Requirements
| Key | English | Description |
|-----|---------|-------------|
| `statistics` | Statistics | Page title |
| `overview_platform_financial_data` | Overview platform financial data | Subtitle |
| `today` | Today | Time filter |
| `this_month` | This Month | Time filter |
| `custom_date_range` | Custom Date Range | Time filter |
| `financial_overview` | Financial Overview | Section title |
| `total_collected` | Total Collected | KPI label |
| `collection_fees` | Collection Fees | KPI label |
| `total_payouts` | Total Payouts | KPI label |
| `payout_fees` | Payout Fees | KPI label |
| `settlements` | Settlements | KPI label |
| `settlement_exchange_rate` | Settlement Exchange Rate | KPI label |
| `total_balance` | Total Balance | KPI label |
| `commission` | Commission | KPI label |
| `net_profit` | Net Profit | KPI label |
| `frozen_balance` | Frozen Balance | KPI label |
| `operational_status` | Operational Status | Section title |
| `total_merchants` | Total Merchants | Status label |
| `active_agents` | Active Agents | Status label |
| `pending_withdrawals` | Pending Withdrawals | Status label |
| `pending_settlements` | Pending Settlements | Status label |
| `pending_transactions` | Pending Transactions | Status label |
| `online_customer_services` | Online Customer Services | Status label |
| `live_activity` | Live Activity | Section title |
| `recent_transactions` | Recent Transactions | Panel title |
| `view_all` | View All | Link text |
| `payment_from_merchant` | Payment from Merchant | Activity type |
| `payout_to_agent` | Payout to Agent | Activity type |
| `settlement_to_merchant` | Settlement to Merchant | Activity type |
| `recent_activities` | Recent Activities | Panel title |
| `new_merchant_registered` | New Merchant Registered | Activity type |
| `system_config_updated` | System Config Updated | Activity type |
| `security_audit_completed` | Security Audit Completed | Activity type |
| `system_health` | System Health | Section title |
| `api_status` | API Status | Health label |
| `database` | Database | Health label |
| `settlement` | Settlement | Health label |
| `support` | Support | Health label |
| `operational` | Operational | Status text |
| `quick_actions` | Quick Actions | Section title |
| `add_merchant` | + Add Merchant | Button text |
| `add_agent` | + Add Agent | Button text |
| `process_payouts` | ↓ Process Payouts | Button text |
| `download_report` | ↓ Download Report | Button text |
| `send_notification` | ✉ Send Notification | Button text |
| `system_settings` | ⚙ System Settings | Button text |
| `financial_summary` | Financial Summary by Currency | Table title |
| `currency` | Currency | Column header |
| `collected` | Collected | Column header |
| `collect_fees` | Collect Fees | Column header |
| `payouts` | Payouts | Column header |
| `payout_fees` | Payout Fees | Column header |
| `exchange_rate` | Exch. Rate | Column header |
| `balance` | Balance | Column header |
| `frozen` | Frozen | Column header |

## Responsive Requirements

### Desktop (≥1024px)
- 4-column KPI grid
- 3-column operational status grid
- Side-by-side activity panels
- 2-column quick actions grid
- Full-width financial summary table

### Tablet (768px–1023px)
- 2-column KPI grid
- 2-column operational status grid
- Stacked activity panels
- 2-column quick actions grid

### Mobile (<768px)
- Single column KPI cards
- Single column operational status
- Stacked layout for all sections
- 1-column quick actions
- Horizontally scrollable table

## API Dependency
- **Dashboard API**: GET `/api/dashboard/summary` — Returns KPI data
- **Transactions API**: GET `/api/transactions/recent` — Recent transactions list
- **Activities API**: GET `/api/activities/recent` — Recent system activities
- **Health API**: GET `/api/system/health` — System health status
- **Currency API**: GET `/api/currencies/rates` — Exchange rates
