feat(app): implement Product Scan review flow, dynamic batch expiry picker, custom PDFs, PO relationships, and aligned card layouts
This commit is contained in:
1 parent
9ff4a4a922
commit
577be04308
69 files changed
+5645
-1657
No files matched your search
@@ -59,3 +59,26 @@ workflow and have no task numbers; see `git log` for real dates/history.
|
||||
## Backend — Postgres Data Layer
|
||||
|
||||
- **7.1** Wrapped the `ocr_items` delete-then-reinsert in `/api/parse` and `/api/v1/documents/[id]` PUT inside a DB transaction (`withTransaction` helper, `backend/pfm-web-app/src/db/index.ts`) — a mid-loop insert failure now rolls back to the previous item set instead of leaving a document with a correct header but partial/missing items — shipped 2026-07-08.
|
||||
|
||||
## Flutter — Document Editor & PDF Receipt
|
||||
|
||||
- **Ad-hoc (Product Scan flow)** — Shipped 2026-07-09
|
||||
- Implemented mock upload and response flow for Product Scanner review. Created a dedicated `ProductEditorScreen` with crop preview, AI classification confidence indicator, and dynamic drop-down SKU selector (Fiesta Spicy Chicken Nugget, Akumo Coin, Fiesta Schnitzel).
|
||||
- **Ad-hoc (Fuzzy Batch Expiry Selector)** — Shipped 2026-07-09
|
||||
- Built dynamic expiry date batch matching dropdown (Batch 1, Batch 2, manual input date picker) based on selected Master SKU product.
|
||||
- **Ad-hoc (Custom Product PDF)** — Shipped 2026-07-09
|
||||
- Redesigned the printed PDF receipt layout specifically for Product Scan (titles, headers, detail table parameters, store staff signatures) while preserving the same consistent professional layout styling as DO Scan receipt.
|
||||
- **Ad-hoc (PO Document Relationship)** — Shipped 2026-07-09
|
||||
- Added "Hubungkan ke PO Dokumen" dropdown to select and relate the Product Scan to a confirmed DO Scan document via PO Number (`noPo` relational field).
|
||||
|
||||
## Flutter — Pending Documents Queue / History
|
||||
|
||||
- **Ad-hoc (Custom Tab Switcher)** — Shipped 2026-07-09
|
||||
- Switched the documents history view to show two tabs (DO Scan and Product Scan) with DO Scan as default, removing the "All" tab.
|
||||
- **Ad-hoc (Document Card Alignment)** — Shipped 2026-07-09
|
||||
- Styled DO Scan and Product Scan history cards with matched structures:
|
||||
- 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 prefix labels) for Product cards.
|
||||
- **Ad-hoc (Active Account Seeding)** — Shipped 2026-07-09
|
||||
- Seeded 1 initial mock DO Scan document and 1 Product Scan document matching the currently logged-in account/store code if empty.
|
||||
@@ -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.
|
||||
Reference in new issue
Block a user