# Withdrawal Orders

## Purpose
Withdrawal Orders manages the withdrawal approval workflow. It allows administrators to review, approve, or reject withdrawal requests from merchants and agents. The page provides a complete audit trail of withdrawal processing with status tracking.

## Components
- Page header with icon and title
- Statistics cards (6 metrics)
- Filter section with multiple filter fields
- Withdrawal orders data table
- Withdrawal Details modal
- Reject Confirmation modal
- Business Rules section

## Header
- **Title**: "Withdrawal Orders"
- **Subtitle**: "Manage and process withdrawal requests"
- **Page Icon**: Violet background with arrow-down icon

### Statistics Cards
| Card | ID | Description |
|------|-----|-------------|
| Total Withdrawals | `totalWithdrawals` | All withdrawal requests |
| Pending Approval | `pendingApproval` | Awaiting review |
| Approved | `approvedWithdrawals` | Approved withdrawals |
| Rejected | `rejectedWithdrawals` | Rejected withdrawals |
| Total Amount | `totalAmount` | Sum of all amounts |
| Pending Amount | `pendingAmount` | Amount awaiting approval |

### Rule Icons (Visual Indicators)
| Rule | Icon Color |
|------|------------|
| Approval Required | Violet |
| Balance Check | Blue |
| Daily Limit | Green |
| KYC Required | Amber |
| Fraud Detection | Red |
| Processing Time | Teal |

## Filters
| Filter | ID | Type | Options |
|--------|-----|------|---------|
| Search | `searchInput` | text | placeholder: "Search withdrawals..." |
| Status | `filterStatus` | select | All, Pending, Processing, Completed, Rejected |
| Date From | `filterDateFrom` | date | — |
| Date To | `filterDateTo` | date | — |
| Min Amount | `filterAmountMin` | number | — |

## Search
- **Input ID**: `searchInput`
- **Placeholder**: "Search withdrawals..."
- **Searches**: Withdrawal ID, merchant name, user ID

## Buttons
| Button | Action | Location |
|--------|--------|----------|
| Search | Apply search query | Filter bar |
| Reset Filters | Clear all filters | Filter bar |
| Export | Export withdrawals to CSV | Action bar |
| Refresh | Reload withdrawal list | Action bar |

## Forms
None (approval workflow only)

## Tables

### Withdrawal Orders Table
| Column | Description |
|--------|-------------|
| Withdrawal ID | Unique identifier |
| User ID | Requesting user ID |
| Merchant/Agent Name | Business name |
| Amount | Withdrawal amount |
| Currency | Transaction currency |
| Bank Account | Destination account |
| Status | Current status |
| Request Time | When request was made |
| Processed Time | When request was processed |
| Actions | Action buttons |

## Action Buttons

### Row Actions
| Button | Function | Icon |
|--------|----------|------|
| Approve | Approve withdrawal request | Check |
| Reject | Reject withdrawal request | X |
| View Details | View full withdrawal details | Eye |

### Batch Actions
| Button | Function | Location |
|--------|----------|----------|
| Approve Selected | Approve multiple withdrawals | Action bar |
| Reject Selected | Reject multiple withdrawals | Action bar |

## Workflow
1. Admin navigates to Withdrawal Orders page
2. Views statistics cards showing withdrawal counts and amounts
3. Uses filters to find specific withdrawals
4. Can filter by status, date range, amount
5. Reviews pending withdrawal requests
6. Can view full withdrawal details
7. Can approve individual or batch withdrawals
8. Can reject withdrawals with confirmation
9. Can export withdrawal data to CSV
10. Processed withdrawals are timestamped

## Translation Requirements
| Key | English | Description |
|-----|---------|-------------|
| `withdrawal_orders` | Withdrawal Orders | Page title |
| `manage_process_withdrawal_requests` | Manage and process withdrawal requests | Subtitle |
| `total_withdrawals` | Total Withdrawals | Stat label |
| `pending_approval` | Pending Approval | Stat label |
| `approved` | Approved | Stat label |
| `rejected` | Rejected | Stat label |
| `total_amount` | Total Amount | Stat label |
| `pending_amount` | Pending Amount | Stat label |
| `search_withdrawals` | Search withdrawals... | Placeholder |
| `status` | Status | Filter label |
| `date_range` | Date Range | Filter label |
| `amount_range` | Amount Range | Filter label |
| `export` | Export | Button text |
| `refresh` | Refresh | Button text |
| `withdrawal_id` | Withdrawal ID | Column |
| `user_id` | User ID | Column |
| `merchant_agent_name` | Merchant/Agent Name | Column |
| `amount` | Amount | Column |
| `currency` | Currency | Column |
| `bank_account` | Bank Account | Column |
| `status` | Status | Column |
| `request_time` | Request Time | Column |
| `processed_time` | Processed Time | Column |
| `actions` | Actions | Column |
| `approve` | Approve | Action |
| `reject` | Reject | Action |
| `view_details` | View Details | Action |
| `pending` | Pending | Status |
| `processing` | Processing | Status |
| `completed` | Completed | Status |
| `approval_required` | Approval Required | Rule |
| `balance_check` | Balance Check | Rule |
| `daily_limit` | Daily Limit | Rule |
| `kyc_required` | KYC Required | Rule |
| `fraud_detection` | Fraud Detection | Rule |
| `processing_time` | Processing Time | Rule |

## Responsive Requirements

### Desktop (≥1024px)
- 6-column statistics grid
- Horizontal filter bar
- Full-width data table

### Tablet (768px–1023px)
- 3-column statistics grid
- Stacked filter fields
- Horizontally scrollable table

### Mobile (<768px)
- 2-column statistics grid
- Full-width stacked filters
- Horizontally scrollable table

## API Dependency
- **Withdrawals API**: GET `/api/withdrawals` — List withdrawals
- **Withdrawal Details**: GET `/api/withdrawals/:id` — Get details
- **Approve Withdrawal**: POST `/api/withdrawals/:id/approve` — Approve request
- **Reject Withdrawal**: POST `/api/withdrawals/:id/reject` — Reject request
- **Batch Approve**: POST `/api/withdrawals/batch-approve` — Approve multiple
- **Batch Reject**: POST `/api/withdrawals/batch-reject` — Reject multiple
- **Export Withdrawals**: GET `/api/withdrawals/export` — CSV export
