Add confirmation step for irreversible transitions in ApprovalActionSheet
epic-expense-approval-workflow-bulk-and-action-task-009 — Implement the two-step confirmation flow within ApprovalActionSheet so coordinators must explicitly confirm before any irreversible approve or reject transition is committed. Show a summary of the action including claim identifier and decision. Confirmation button must be distinct from the initial action button to prevent accidental activation.
Acceptance Criteria
Technical Requirements
Execution Context
Tier 2 - 518 tasks
Can start after Tier 1 completes
Implementation Notes
Model the two-step flow with an enum: enum ApprovalSheetStep { action, confirmation }. Store this as local StatefulWidget state (setState). Use AnimatedSwitcher with a CrossFadeTransition for smooth step changes. The ConfirmationSummaryWidget should be a pure display widget receiving action type, claim ID, claimant name, and comment as constructor params — no business logic inside.
Use FocusScope to shift focus to the confirmation heading widget after transition so VoiceOver/TalkBack reads it immediately. The 'Confirm' button label should be explicit: 'Confirm Approval' or 'Confirm Rejection' — not a generic 'Confirm'. This prevents the UX ambiguity described in the requirements.
Testing Requirements
Widget tests: (1) tapping Approve with no comment transitions to confirmation step showing 'Approve' action; (2) tapping Reject with valid comment transitions to confirmation showing comment text; (3) tapping Go back returns to step 1 with comment text preserved in controller; (4) confirmation step does not trigger any service call — verify no Bloc events emitted; (5) confirmation heading widget is present in widget tree after transition. Use WidgetTester.tap, pump, and find.text assertions.
If a bulk approval batch partially fails (some claims approved, some failed), the UI must communicate which specific claims failed without overwhelming the coordinator. A poorly designed error display could cause coordinators to re-approve already-approved claims or miss claims that still need attention.
Mitigation & Contingency
Mitigation: Design the BulkApprovalResult display to show a clear summary (e.g., '14 approved, 2 failed') with a collapsible list of failed claims including their IDs and submitter names. Failed claims should remain selected in the queue so the coordinator can retry them individually.
Contingency: If the summary UI proves insufficient, add a dedicated 'bulk action history' sheet showing the last bulk operation result, accessible from the queue screen header.
If the app is backgrounded or the network drops while the coordinator has the ApprovalActionSheet open mid-decision, the typed comment could be lost and the transition state could be ambiguous, potentially causing a coordinator to believe they approved a claim that was never submitted.
Mitigation & Contingency
Mitigation: Persist the in-progress action sheet state (selected action + comment text) to a local draft store keyed on claim ID. On sheet re-open for the same claim, restore the draft. After confirmed submission, verify the resulting claim status from the server before dismissing the sheet.
Contingency: On network error during submission, display a persistent retry banner within the sheet rather than dismissing it, so the coordinator can resubmit without re-entering their comment.