Use this page for technical screen behavior, source references, and active Playwright coverage.
Customer Analysis Report supports customer segmentation, value analysis, filters, charts, exports.
| ID | Section | Action | Expected Outcome | Controls |
|---|---|---|---|---|
| UC-CUSTANAL-001 | Page Load | Navigate to /customer-analysis-report | Loads report with charts | Container |
| UC-CUSTANAL-002 | Auth | CustomerAdmin required | Authorized access only | Authorize attribute |
| UC-CUSTANAL-003 | Business | No business selected | Shows info alert | Alert info |
| UC-CUSTANAL-004 | Refresh | Click Refresh button | RefreshData + toast | Button |
| UC-CUSTANAL-005 | Export | Click Export CSV | Downloads CSV file | Button primary |
| UC-CUSTANAL-006 | Summary Card | Total Customers | totalCustomers count | Card primary |
| UC-CUSTANAL-007 | Summary Card | Active Customers | activeCustomers this month | Card success |
| UC-CUSTANAL-008 | Summary Card | Avg Customer Value | ₹N0 lifetime value | Card info |
| UC-CUSTANAL-009 | Summary Card | Outstanding | ₹N0 total due | Card warning |
| UC-CUSTANAL-010 | Chart | Customer Activity Trend | Line + Bar ApexChart | ApexChart |
| UC-CUSTANAL-011 | Chart | Activity - Active Customers | Line series by month | ApexPointSeries Line |
| UC-CUSTANAL-012 | Chart | Activity - New Customers | Bar series by month | ApexPointSeries Bar |
| UC-CUSTANAL-013 | Chart | Customer Segments | Bar chart by segment | ApexChart |
| UC-CUSTANAL-014 | Chart Empty | No activity data | Icon + muted message | Div text-center |
| UC-CUSTANAL-015 | Chart Empty | No segment data | Icon + muted message | Div text-center |
| UC-CUSTANAL-016 | Table | Customer Name | Bold text | td strong |
| UC-CUSTANAL-017 | Table | Customer Code | Code format | td code |
| UC-CUSTANAL-018 | Table | Total Orders | Right-aligned count | td text-end |
| UC-CUSTANAL-019 | Table | Total Value | C2 currency format | td text-end |
| UC-CUSTANAL-020 | Table | Avg Order Value | C2 currency format | td text-end |
| UC-CUSTANAL-021 | Table | Last Order | dd MMM yyyy format | td |
| UC-CUSTANAL-022 | Table | Days Since Last Order | Integer days | td text-end |
| UC-CUSTANAL-023 | Table | Outstanding | C2 currency format | td text-end |
| UC-CUSTANAL-024 | Table | Segment badge | Colored by segment type | Badge |
| UC-CUSTANAL-025 | Segment Badge | VIP | bg-success | Badge class |
| UC-CUSTANAL-026 | Segment Badge | Regular | bg-primary | Badge class |
| UC-CUSTANAL-027 | Segment Badge | New | bg-info | Badge class |
| UC-CUSTANAL-028 | Segment Badge | Inactive | bg-warning | Badge class |
| UC-CUSTANAL-029 | Segment Logic | >= ₹100,000 value | VIP segment | Segment calc |
| UC-CUSTANAL-030 | Segment Logic | >= ₹25,000 value | Regular segment | Segment calc |
| UC-CUSTANAL-031 | Segment Logic | > 0 value | New segment | Segment calc |
| UC-CUSTANAL-032 | Segment Logic | 0 value | Inactive segment | Segment calc |
| UC-CUSTANAL-033 | Segment Logic | > 90 days since order | Override to Inactive | Segment calc |
| UC-CUSTANAL-034 | Activity Data | Last 6 months | Monthly aggregation | customerActivityData |
| UC-CUSTANAL-035 | Export CSV | Header | Report title + timestamp | CSV line |
| UC-CUSTANAL-036 | Export CSV | Summary | Metrics with values | CSV section |
| UC-CUSTANAL-037 | Export CSV | Details | All customer rows | CSV rows |
| UC-CUSTANAL-038 | Table Empty | No data | Icon + muted message | Div text-center |
| UC-CUSTANAL-039 | Business Change | HandleBusinessChanged | Reloads data + StateHasChanged | Event handler |
| UC-CUSTANAL-040 | Dispose | Component disposed | Unsubscribes from OnChanged | Dispose method |
| UC-CUSTANAL-041 | Accessibility | Grid cleanup | initGridAccessibilityCleanup JS call | JS interop |
| UC-CUSTANAL-042 | Table Sort | Default | OrderByDescending TotalValue | OrderBy |
| UC-CUSTANAL-043 | Breadcrumb | Reports link | Navigates to /reports | Link |
| UC-CUSTANAL-044 | Page Title | Dynamic | Business name in title | PageTitle |
| UC-CUSTANAL-045 | Data test | Table attribute | data-test="customer-analysis-table" | Attribute |