14 KiB
14 KiB
Claim Management System - Complete Data Flow
🎯 Overview
The claim management system now has complete integration with automatic dealer lookup and proper workflow management.
📊 Data Flow Diagram
┌─────────────────────────────────────────────────────────────────┐
│ 1. User Creates Claim │
│ (ClaimManagementWizard) │
└────────────────────────────┬────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ 2. Select Dealer Code (e.g., RE-MH-001) │
│ │
│ Triggers: getDealerInfo(dealerCode) │
│ Returns from dealerDatabase.ts: │
│ • Dealer Name: "Royal Motors Mumbai" │
│ • Email: "dealer@royalmotorsmumbai.com" │
│ • Phone: "+91 98765 12345" │
│ • Address: "Shop No. 12-15, Central Avenue..." │
└────────────────────────────┬────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ 3. Complete Form & Submit (formData) │
│ │
│ Captured Fields: │
│ • activityName │
│ • activityType │
│ • activityDate │
│ • location │
│ • dealerCode │
│ • dealerName ┐ │
│ • dealerEmail ├─ Auto-populated from database │
│ • dealerPhone │ │
│ • dealerAddress ┘ │
│ • estimatedBudget │
│ • requestDescription │
│ • periodStart, periodEnd │
└────────────────────────────┬────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ 4. App.tsx Creates Request Object │
│ │
│ REQUEST_DATABASE[requestId] = { │
│ id: 'RE-REQ-2024-CM-XXX', │
│ title: '...', │
│ status: 'pending', │
│ currentStep: 1, │
│ totalSteps: 8, │
│ templateType: 'claim-management', │
│ claimDetails: { │
│ activityName: formData.activityName, │
│ dealerEmail: formData.dealerEmail, ← From DB │
│ dealerPhone: formData.dealerPhone, ← From DB │
│ dealerAddress: formData.dealerAddress, ← From DB │
│ estimatedBudget: formData.estimatedBudget, │
│ ...all other fields │
│ }, │
│ approvalFlow: [ 8 steps... ] │
│ } │
└────────────────────────────┬────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ 5. MyRequests Shows Request in List │
│ │
│ RE-REQ-2024-CM-001 │
│ Dealer Marketing Activity Claim │
│ Status: Pending | Step 1 of 8 │
└────────────────────────────┬────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ 6. User Clicks Request → RequestDetail.tsx │
│ │
│ Fetches from REQUEST_DATABASE[requestId] │
│ Displays all information: │
│ │
│ ┌─────────────────────────────────────────────────┐ │
│ │ Overview Tab │ │
│ │ │ │
│ │ 📋 Activity Information │ │
│ │ • Activity Name: "..." │ │
│ │ • Activity Type: "..." │ │
│ │ • Date: "..." │ │
│ │ • Location: "..." │ │
│ │ │ │
│ │ 🏢 Dealer Information │ │
│ │ • Dealer Code: RE-MH-001 │ │
│ │ • Dealer Name: Royal Motors Mumbai │ │
│ │ • Email: dealer@royalmotorsmumbai.com ✓ │ │
│ │ • Phone: +91 98765 12345 ✓ │ │
│ │ • Address: Shop No. 12-15... ✓ │ │
│ │ │ │
│ │ 💰 Claim Request Details │ │
│ │ • Description: "..." │ │
│ │ • Estimated Budget: ₹2,45,000 ✓ │ │
│ │ • Period: Oct 1 - Oct 10 │ │
│ └─────────────────────────────────────────────────┘ │
└────────────────────────────┬────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ 7. Workflow Tab Shows 8-Step Process │
│ │
│ Step 1: Dealer Document Upload [PENDING] │
│ Action: [Upload Proposal Documents] ← Opens modal │
│ │
│ Step 2: Initiator Evaluation [WAITING] │
│ Actions: [Approve] [Request Modifications] │
│ │
│ Step 3: IO Confirmation (Auto) [WAITING] │
│ │
│ Step 4: Department Lead Approval [WAITING] │
│ Action: [Approve & Lock Budget] │
│ │
│ Step 5: Dealer Completion Documents [WAITING] │
│ Action: [Upload Completion Documents] │
│ │
│ Step 6: Initiator Verification [WAITING] │
│ Action: [Verify & Set Amount] ← Opens modal │
│ │
│ Step 7: E-Invoice Generation (Auto) [WAITING] │
│ │
│ Step 8: Credit Note Issuance [WAITING] │
│ Action: [Issue Credit Note] │
└─────────────────────────────────────────────────────────────────┘
🔄 Key Features Implemented
1. Dealer Database Auto-Population
// When dealer selected in wizard
handleDealerChange('RE-MH-001')
↓
getDealerInfo('RE-MH-001')
↓
Returns complete dealer object
↓
Auto-fills: name, email, phone, address
2. Complete Data Capture
- ✅ All activity details
- ✅ All dealer information (from database)
- ✅ Estimated budget
- ✅ Request description
- ✅ Period dates
3. Step-Specific Actions
Each workflow step shows relevant action buttons:
- Upload buttons for document steps
- Approve/Reject buttons for approval steps
- Set Amount button for verification step
- Automatic processing for system steps
4. Modal Integration
-
DealerDocumentModal: For steps 1 & 5
- Upload multiple documents
- Add dealer comments
- Validation before submit
-
InitiatorVerificationModal: For step 6
- Review completion documents
- Set final approved amount
- Add verification comments
🎨 UI Components
ClaimManagementWizard
Step 1: Claim Details
├── Activity Name & Type
├── Dealer Selection → Auto-fills email, phone, address
├── Date & Location
├── Estimated Budget (new!)
└── Request Description
Step 2: Review & Submit
├── Activity Information Card
├── Dealer Information Card (with email, phone, address)
├── Date & Location Card (with budget)
└── Request Details Card
RequestDetail Overview Tab
├── Activity Information
│ ├── Activity Name
│ ├── Activity Type
│ ├── Date
│ └── Location
│
├── Dealer Information
│ ├── Dealer Code
│ ├── Dealer Name
│ ├── Email ← From dealer database
│ ├── Phone ← From dealer database
│ └── Address ← From dealer database
│
└── Claim Request Details
├── Description
├── Estimated Budget ← User input
└── Period
📝 Database Schema
dealerDatabase.ts Structure
{
'RE-MH-001': {
code: 'RE-MH-001',
name: 'Royal Motors Mumbai',
email: 'dealer@royalmotorsmumbai.com',
phone: '+91 98765 12345',
address: 'Shop No. 12-15, Central Avenue, Andheri West',
city: 'Mumbai',
state: 'Maharashtra',
region: 'West',
managerName: 'Rahul Deshmukh'
},
// ... 9 more dealers
}
✅ Verification Checklist
- Dealer database created with 10+ dealers
- Auto-population works when dealer selected
- All fields captured in claimDetails
- RequestDetail displays all information
- Step-specific action buttons appear
- Modals integrate properly
- 8-step workflow displays correctly
- IDs synchronized across components
- Data flows from wizard → app → detail
🚀 Ready for Testing!
The system is now complete and ready for end-to-end testing. All dealer information is automatically fetched from the database, properly saved in the request, and correctly displayed in the detail view.