From ca0ba258e218c58316027e6666b8ee9ef0640667 Mon Sep 17 00:00:00 2001 From: Achintha Isuru Date: Thu, 26 Feb 2026 22:25:35 -0500 Subject: [PATCH] refactor: refactor `DocumentUploadPage` UI into specialized widgets and refine document status mapping with a new `DocumentVerificationStatus` enum. --- .../documents/IMPLEMENTATION_WORKFLOW.md | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/apps/mobile/packages/features/staff/profile_sections/compliance/documents/IMPLEMENTATION_WORKFLOW.md b/apps/mobile/packages/features/staff/profile_sections/compliance/documents/IMPLEMENTATION_WORKFLOW.md index 2fdddf14..4e8d6bbe 100644 --- a/apps/mobile/packages/features/staff/profile_sections/compliance/documents/IMPLEMENTATION_WORKFLOW.md +++ b/apps/mobile/packages/features/staff/profile_sections/compliance/documents/IMPLEMENTATION_WORKFLOW.md @@ -45,9 +45,12 @@ The workflow follows a 4-step lifecycle: #### UI — `DocumentUploadPage` - Accepts `StaffDocument document` and optional `String? initialUrl` as route arguments +- Refactored into specialized widgets for maintainability: + - `DocumentFileSelector`: Handles the file picking logic and "empty state" UI. + - `DocumentSelectedCard`: Displays the selected file with "Replace" action. + - `DocumentAttestationCheckbox`: Isolated checkbox logic for legal confirmation. + - `DocumentUploadFooter`: Sticky bottom bar containing the checkbox and submission button. - PDF file picker via `FilePickerService.pickFile(allowedExtensions: ['pdf'])` -- **File selector card**: displays the file name with a document icon when selected, otherwise a prompt to upload. -- *Note:* PDF preview/opening functionality is explicitly omitted to maintain a clean, minimal upload flow without relying on external native viewers. - Attestation checkbox must be checked before the submit button is enabled - Loading state: shows `CircularProgressIndicator` while uploading (replaces button — mirrors attire pattern) - On success: shows `UiSnackbar` and calls `Modular.to.toDocuments()` to return to the list @@ -80,10 +83,12 @@ To ensure a consistent experience across all compliance uploads (documents, cert - Codegen (`dart run slang`) produces `TranslationsStaffDocumentsUploadEn` and its Spanish counterpart #### DocumentStatus Mapping -- `_mapDocumentStatus` in `DocumentsRepositoryImpl` now handles all backend enum variants: - - `VERIFIED` → `verified` - - `UPLOADED`, `PENDING`, `EXPIRING` → `pending` (treated as in-progress) - - `PROCESSING`, `AUTO_PASS`, `AUTO_FAIL`, `NEEDS_REVIEW`, `APPROVED`, `REJECTED`, `ERROR` → presence acknowledged with `UnimplementedError` (TODO) +- `DocumentStatus` mapping is centralized in `StaffConnectorRepositoryImpl`, collapsing complex backend states into domain levels: + - `VERIFIED`, `AUTO_PASS`, `APPROVED` → `verified` + - `UPLOADED`, `PENDING`, `PROCESSING`, `NEEDS_REVIEW`, `EXPIRING` → `pending` + - `AUTO_FAIL`, `REJECTED`, `ERROR` → `rejected` + - `MISSING` → `missing` +- A new `DocumentVerificationStatus` enum captures the full granularity of the backend state for detailed UI feedback (e.g., showing "Auto Fail" vs "Rejected"). ---