feat(app): implement Product Scan review flow, dynamic batch expiry picker, custom PDFs, PO relationships, and aligned card layouts

This commit is contained in:
Rafhan Mazaya Fathurrahman committed 2026-07-09 12:36:06 +07:00
1 parent 9ff4a4a922
commit 577be04308
69 files changed
+5645 -1657

No files matched your search

+41
View File
@@ -0,0 +1,41 @@
# Iteration Log
This log tracks code review audits and QA verifications performed upon completion of development iterations.
## Iteration: Product Scan UI & Document Card Alignment (2026-07-09)
### Completed Tasks
1. **Product Scan Flow UI & Dropdowns**:
- Built a custom `ProductEditorScreen` featuring a crop preview region, AI confidence bar, and product SKU classification dropdown.
- Implemented a fuzzy expiry batch selector dynamically matched to the active SKU. If "Set Tanggal Manual..." is chosen, a date picker dialog is triggered.
- Built a local storage Hive save mechanism storing scan results under the `PRODUCT SCAN` type, displaying them in history.
2. **Tab Switcher & Layout Alignment**:
- Replaced the three-tab switcher in `DocumentsScreen` with a clean two-tab switcher: **DO Scan** and **Product Scan** (defaulting to DO Scan, removing "Semua").
- Redesigned `DocumentCard` to present matched visual structure for both document types:
- Top category label: Staff Name for DO Scan (Orange), Product Name for Product Scan (Green).
- Main Title: PO Number for DO Scan (directly without prefix), Batch Number for Product Scan (`[Batch Name]`).
- Subtitle Details: `[Date] • [Item Count] Item` for DO cards, and `[Expiry Date] • [PO Number]` (without labels) for Product cards.
3. **Custom Receipt PDF**:
- Refactored `PdfService` to render a custom document receipt tailored to Product Scan (titled "BUKTI VERIFIKASI SCAN PRODUK", showing verification information, parameters table, and staff signatures) while preserving the same consistent professional layout styling as the DO Scan receipt.
4. **PO Relationship Mapping**:
- Integrated a dynamic PO relationship dropdown inside the `ProductEditorScreen`, allowing the user to select any confirmed DO Scan PO number in Hive storage to link the product scan to its original DO document.
5. **Active Account Seeding**:
- Programmed dynamic seeding of 1 initial mock DO Scan document and 1 mock Product Scan document for the active store profile if no entries exist in Hive.
### Code Review & Audit
* **Single Responsibility Principle**:
- `ProductEditorScreen` manages the review interface cleanly.
- `PdfService` encapsulates both delivery and product receipt layout rules dynamically using a boolean check (`isProductScan`).
- `DocumentCard` resolves layout colors and labels cleanly without redundant widgets.
* **File Size Constraint Check**:
- All modified files remain strictly under the 256 lines limit:
- `lib/features/editor/product_editor_screen.dart` is exactly 249 lines.
- `lib/features/documents/document_card.dart` is 133 lines.
- `lib/features/editor/pdf_service.dart` is 214 lines.
* **Code Integrity**:
- Null safety is fully respected across Riverpod providers and shared preferences lookups.
- State lifecycle is cleanly managed when showing picker dialogues.
### Verification Results
* **Analysis**: `flutter analyze` completed successfully with zero compile errors.
* **Testing**: Local Mock API layer verified. Simulated flows for camera review, Hive saving, relationship dropdown selections, and PDF layout checks succeed.