refactor: refactor DocumentUploadPage UI into specialized widgets and refine document status mapping with a new DocumentVerificationStatus enum.
This commit is contained in:
@@ -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").
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user