Use this page for technical screen behavior, source references, and active Playwright coverage.
Defective Stock supports defective stock queue, status handling, recovery/disposal actions, filters.
| ID | Section | Action | Expected Outcome | Controls |
|---|---|---|---|---|
| UC-DEFSTOCK-001 | Page Load | Navigate to /defective-stock | Loads defective stock management | Container |
| UC-DEFSTOCK-002 | Auth | CustomerAdminOrOperator | Authorized access | Authorize |
| UC-DEFSTOCK-003 | Header | Record Defective Stock btn | ShowCreateModal opens modal | Button primary |
| UC-DEFSTOCK-004 | KPI Card | Total Defective Items | kpis.TotalDefectiveItems count | Card danger |
| UC-DEFSTOCK-005 | KPI Card | Total Loss Value | ₹N2 TotalEstimatedLoss | Card warning |
| UC-DEFSTOCK-006 | KPI Card | Recovery Amount | ₹N2 + Claims amount | Card success |
| UC-DEFSTOCK-007 | KPI Card | Net Loss | ₹N2 after recovery | Card info |
| UC-DEFSTOCK-008 | KPI Card | Pending Approvals | PendingApprovals count | Card |
| UC-DEFSTOCK-009 | KPI Card | Active Claims | ActiveClaims count | Card |
| UC-DEFSTOCK-010 | KPI Card | Active Returns | ActiveReturns count | Card |
| UC-DEFSTOCK-011 | KPI Card | Critical Defects | CriticalDefects count | Card |
| UC-DEFSTOCK-012 | Filter | Date Range | DateRangeFilter component | Component |
| UC-DEFSTOCK-013 | Filter | Status dropdown | DefectiveStockStatuses.AllStatuses | Select |
| UC-DEFSTOCK-014 | Filter | Severity dropdown | DefectSeverities.AllSeverities | Select |
| UC-DEFSTOCK-015 | Filter | Product search | productFilter text | Input |
| UC-DEFSTOCK-016 | Filter | Clear button | ClearFilters resets all | Button |
| UC-DEFSTOCK-017 | Table | Defect Code | Code + Pending badge if applicable | td |
| UC-DEFSTOCK-018 | Table | Product | Name + optional code | td |
| UC-DEFSTOCK-019 | Table | Quantity | Badge bg-danger | Badge |
| UC-DEFSTOCK-020 | Table | Defect Type | Plain text | td |
| UC-DEFSTOCK-021 | Table | Severity badge | GetSeverityBadgeClass | Badge |
| UC-DEFSTOCK-022 | Table | Status badge | GetStatusBadgeClass | Badge |
| UC-DEFSTOCK-023 | Table | Loss Value | ₹N2 + recovery if any | td |
| UC-DEFSTOCK-024 | Table | Vendor | Name + claim indicator | td |
| UC-DEFSTOCK-025 | Table | Defect Date | dd/MM/yyyy format | td |
| UC-DEFSTOCK-026 | Table | View Details btn | ShowDetailsModal | Button outline-primary |
| UC-DEFSTOCK-027 | Table | Edit btn | ShowEditModal | Button outline-secondary |
| UC-DEFSTOCK-028 | Table | Approve btn | ShowApprovalModal (if Pending) | Button outline-success |
| UC-DEFSTOCK-029 | Severity Badge | Critical | bg-danger | Badge class |
| UC-DEFSTOCK-030 | Severity Badge | High | bg-warning | Badge class |
| UC-DEFSTOCK-031 | Severity Badge | Medium | bg-info | Badge class |
| UC-DEFSTOCK-032 | Severity Badge | Low | bg-secondary | Badge class |
| UC-DEFSTOCK-033 | Status Badge | Identified | bg-warning | Badge class |
| UC-DEFSTOCK-034 | Status Badge | UnderInvestigation | bg-info | Badge class |
| UC-DEFSTOCK-035 | Status Badge | Quarantined | bg-secondary | Badge class |
| UC-DEFSTOCK-036 | Status Badge | AwaitingDisposal | bg-primary | Badge class |
| UC-DEFSTOCK-037 | Status Badge | Disposed | bg-dark | Badge class |
| UC-DEFSTOCK-038 | Status Badge | Returned | bg-success | Badge class |
| UC-DEFSTOCK-039 | Status Badge | UnderRepair | bg-info | Badge class |
| UC-DEFSTOCK-040 | Status Badge | Repaired | bg-success | Badge class |
| UC-DEFSTOCK-041 | Status Badge | WriteOff | bg-danger | Badge class |
| UC-DEFSTOCK-042 | Modal | Create/Edit title | Dynamic based on DefectiveStockId | Modal title |
| UC-DEFSTOCK-043 | Modal Form | Product select | SearchableSelect component | Component |
| UC-DEFSTOCK-044 | Modal Form | Defective Quantity | Required min=1 | Input number |
| UC-DEFSTOCK-045 | Modal Form | Defect Date | Required yyyy-MM-dd | Input date |
| UC-DEFSTOCK-046 | Modal Form | Defect Type | DefectTypes.AllTypes | Select |
| UC-DEFSTOCK-047 | Modal Form | Defect Cause | DefectCauses.AllCauses | Select |
| UC-DEFSTOCK-048 | Modal Form | Severity | DefectSeverities.AllSeverities | Select |
| UC-DEFSTOCK-049 | Modal Form | Description | Required textarea | Textarea |
| UC-DEFSTOCK-050 | Modal Form | Vendor select | SearchableSelect | Component |
| UC-DEFSTOCK-051 | Modal Form | PO Reference | Optional text | Input |
| UC-DEFSTOCK-052 | Modal Form | Purchase Date | Optional date | Input date |
| UC-DEFSTOCK-053 | Modal Form | Loss Value | Optional decimal | Input number |
| UC-DEFSTOCK-054 | Modal Form | Batch Number | Optional text | Input |
| UC-DEFSTOCK-055 | Modal Form | Discovered By | Optional text | Input |
| UC-DEFSTOCK-056 | Modal Form | Discovery Date | Optional date | Input date |
| UC-DEFSTOCK-057 | Modal Form | QC Inspector | Optional text | Input |
| UC-DEFSTOCK-058 | Modal Form | QC Notes | Optional textarea | Textarea |
| UC-DEFSTOCK-059 | Modal Form | Notes | Optional textarea | Textarea |
| UC-DEFSTOCK-060 | Modal Save | Create | DefectiveStockService.CreateDefectiveStockAsync | Service |
| UC-DEFSTOCK-061 | Modal Save | Update | DefectiveStockService.UpdateDefectiveStockAsync | Service |
| UC-DEFSTOCK-062 | Modal | Close/Cancel | HideCreateModal | Button |
| UC-DEFSTOCK-063 | Loading | Data loading | Shows spinner | Spinner |
| UC-DEFSTOCK-064 | Empty State | No records | Icon + message | Div text-center |
| UC-DEFSTOCK-065 | Table Limit | Display | Take(15) records | Take |