Lead Owner Summary Report API Documentation ========================================== 1. LEAD OWNER SUMMARY REPORT ----------------------------- Endpoint: POST /api/reports/get_report_section Type: lead_owner_summary Request Body: { "type": "lead_owner_summary", "startDate": "2024-01-01", "endDate": "2024-12-31" } Response Example: { "success": true, "data": [ { "owner_id": 1, "owner_name": "Preeti", "new_call_count": 57, "follow_up_count": 18, "junk_lead_count": 5, "appointment_count": 3, "total_leads": 83 }, { "owner_id": 2, "owner_name": "Vijaya", "new_call_count": 43, "follow_up_count": 6, "junk_lead_count": 4, "appointment_count": 1, "total_leads": 54 } ], "date_range": { "start_date": "2024-01-01", "end_date": "2024-12-31" } } 2. LEAD OWNER DETAIL REPORT --------------------------- Endpoint: POST /api/reports/get_report_section Type: lead_owner_detail Request Body: { "type": "lead_owner_detail", "owner_id": 1, "status_type": "new_call", // Options: new_call, follow_up, junk_lead, appointment "startDate": "2024-01-01", "endDate": "2024-12-31", "page": 1, "pageSize": 10 } Response Example: { "success": true, "total_count": 57, "current_page": 1, "per_page": 10, "data": [ { "id": 1, "lead_name": "Mohit", "lead_email": "mohit@example.com", "lead_primary_phone": "7016407904", "lead_status": "new", "appointment_date": "", "treatments": "Hair Treatment", "owner_name": "Preeti", "lead_source": "Website", "url_category": "Google - Search Referral", "campaign_id": "22769245430", "utm_source": "google", "utm_medium": "paidsearch", "treatment_from_url": "Liposuction", "created_at": "13-08-2024 10:30:45", "createdby": "Admin" } ], "owner_name": "Preeti", "status_type": "new_call", "date_range": { "start_date": "2024-01-01", "end_date": "2024-12-31" } } STATUS TYPES: ------------- • new_call - Shows leads with status 'new' • follow_up - Shows leads with status 'follow_up' or 'followup' • junk_lead - Shows leads with status 'junk' or 'not_interested' • appointment - Shows leads with appointment_date set USAGE FLOW: ----------- 1. First call Summary API to get owner-wise counts 2. User clicks on any count (new_call, follow_up, etc.) 3. Call Detail API with owner_id and status_type 4. Show detailed list with pagination FEATURES: --------- ✅ Lead owner wise summary with counts ✅ Clickable counts for detailed view ✅ Date range filtering ✅ Pagination support ✅ URL campaign data parsing ✅ Treatment type detection ✅ All lead information included Frontend Implementation: ------------------------ // Get Summary const summaryResponse = await fetch('/api/reports/get_report_section', { method: 'POST', body: JSON.stringify({ type: 'lead_owner_summary', startDate: '2024-01-01', endDate: '2024-12-31' }) }); // Get Details on click const detailResponse = await fetch('/api/reports/get_report_section', { method: 'POST', body: JSON.stringify({ type: 'lead_owner_detail', owner_id: 1, status_type: 'new_call', page: 1, pageSize: 10 }) }); This matches exactly with your handwritten report structure!