Update Codex handoff for receipt flow
This commit is contained in:
@ -14,6 +14,115 @@ Dokumen ini menyimpan konteks kerja terbaru setelah rangkaian patch mobile, logi
|
||||
|
||||
## Ringkasan Perubahan Terbaru
|
||||
|
||||
### 0. Update Pembelian, Penerimaan, Label Lot, dan Navigasi - 2026-05-29
|
||||
|
||||
- Branch `main` sudah sinkron dengan `origin/main`.
|
||||
- Commit terakhir saat handoff ini diperbarui:
|
||||
`4c5b62d Prefer specific active navigation links`
|
||||
- Commit terkait patch terbaru:
|
||||
- `44146a4` `Split purchase submit from receipt finalization`
|
||||
- `57896d3` `Add receipt menu access`
|
||||
- `1217529` `Complete receipt translations`
|
||||
- `d0bdd4b` `Refine purchase receipt and lot label flow`
|
||||
- `2df1752` `Render receipt lot labels with QR and barcode`
|
||||
- `3a52d29` `Keep receipt action labels on one line`
|
||||
- `4c5b62d` `Prefer specific active navigation links`
|
||||
|
||||
#### Pembelian Reguler
|
||||
|
||||
- Halaman `Pembelian Reguler` tidak lagi meminta input `Gudang` dan `Lokasi`.
|
||||
- Tombol submit lama yang langsung membuat receipt/lot sudah tidak dipakai dari halaman pembelian.
|
||||
- Pembelian sekarang disimpan sebagai draft/data purchase, lalu proses penerimaan dilakukan dari menu:
|
||||
`Pembelian > Penerimaan`.
|
||||
- Payload purchase tetap kompatibel dengan API lama, tetapi `warehouse_id` dan `warehouse_location_id` dikirim kosong/null.
|
||||
- File utama:
|
||||
- [src/features/purchases/components/purchases-client.tsx](/home/wira/work/codex/AbelBirdNest-Stock/src/features/purchases/components/purchases-client.tsx)
|
||||
|
||||
#### Penerimaan dan Generate Lot
|
||||
|
||||
- Menu `Pembelian > Penerimaan` menjadi tempat utama untuk:
|
||||
- memilih pembelian yang belum punya receipt
|
||||
- mengisi qty diterima/valid/ditolak
|
||||
- memilih gudang dan lokasi
|
||||
- membuat receipt
|
||||
- generate lot dari receipt
|
||||
- API receipt mencegah receipt/lot dobel untuk pembelian yang sama.
|
||||
- Saat `Buat lot`, status purchase ikut menjadi `SUBMITTED`.
|
||||
- Generate lot dari receipt mempertahankan logic realization/allocation terbaru:
|
||||
- membuat `inventory_lots`
|
||||
- membuat `lot_purchase_allocations`
|
||||
- membuat `purchase_realization_entries`
|
||||
- recalculation summary realization
|
||||
- Kode lot dari satu receipt dibuat berurutan dalam satu transaksi agar tidak bentrok untuk receipt multi-line.
|
||||
- File utama:
|
||||
- [src/features/receipts/components/receipts-client.tsx](/home/wira/work/codex/AbelBirdNest-Stock/src/features/receipts/components/receipts-client.tsx)
|
||||
- [src/app/api/v1/receipts/route.ts](/home/wira/work/codex/AbelBirdNest-Stock/src/app/api/v1/receipts/route.ts)
|
||||
- [src/app/api/v1/receipts/[id]/generate-lots/route.ts](/home/wira/work/codex/AbelBirdNest-Stock/src/app/api/v1/receipts/[id]/generate-lots/route.ts)
|
||||
- [src/features/receipts/lib/serialize-receipt.ts](/home/wira/work/codex/AbelBirdNest-Stock/src/features/receipts/lib/serialize-receipt.ts)
|
||||
- [src/types/receipt.ts](/home/wira/work/codex/AbelBirdNest-Stock/src/types/receipt.ts)
|
||||
|
||||
#### Cetak Receipt dan Label Lot dari Penerimaan
|
||||
|
||||
- Daftar/detail penerimaan sekarang punya tombol:
|
||||
- `Receipt` / `Cetak receipt`
|
||||
- `Label lot` / `Cetak label lot`
|
||||
- Cetak label lot dari penerimaan sudah memakai QR code dan barcode sungguhan, dengan library yang sama seperti halaman detail lot:
|
||||
- `qrcode`
|
||||
- `jsbarcode`
|
||||
- Tombol aksi daftar penerimaan dipaksa satu baris agar label `Label lot` tidak wrap.
|
||||
- Label lot dari receipt mengambil nilai scan dari:
|
||||
- `qr_code_value`
|
||||
- `barcode_value`
|
||||
- fallback ke `lot_code`
|
||||
|
||||
#### Navigasi Aktif
|
||||
|
||||
- Sidebar dan mobile nav sebelumnya bisa menandai `Pembelian Reguler` aktif saat user berada di:
|
||||
`/purchases/office-buyout`
|
||||
- Active state sekarang memilih href paling spesifik/paling panjang ketika beberapa route cocok.
|
||||
- File utama:
|
||||
- [src/components/layout/sidebar.tsx](/home/wira/work/codex/AbelBirdNest-Stock/src/components/layout/sidebar.tsx)
|
||||
- [src/components/layout/mobile-nav.tsx](/home/wira/work/codex/AbelBirdNest-Stock/src/components/layout/mobile-nav.tsx)
|
||||
|
||||
#### Script Seed Lokal
|
||||
|
||||
- File `scripts/seed-local-superadmin.mjs` sudah ikut masuk git sesuai kebutuhan dev/test.
|
||||
- Script ini membuat role dan user `SYSTEM_ADMIN` lokal.
|
||||
- Catatan keamanan: script berisi password hardcoded `password`, jadi pakai hanya untuk environment lokal/dev, bukan production.
|
||||
|
||||
#### Verifikasi Patch Terbaru
|
||||
|
||||
- `npx tsc --noEmit` lolos setelah patch:
|
||||
- split pembelian/penerimaan
|
||||
- cetak receipt
|
||||
- cetak label lot QR/barcode
|
||||
- active navigation fix
|
||||
|
||||
#### Update Server Dev
|
||||
|
||||
- Untuk server dev boleh compile langsung di server via npm.
|
||||
- Command umum:
|
||||
|
||||
```bash
|
||||
cd /path/ke/AbelBirdNest-Stock
|
||||
git pull origin main
|
||||
npm ci
|
||||
npm run prisma:generate
|
||||
npm run build
|
||||
sudo rc-service abelbirdnest-web restart
|
||||
sudo rc-service abelbirdnest-web status
|
||||
curl -I http://127.0.0.1:3007/login
|
||||
```
|
||||
|
||||
- Jika server dev memakai systemd:
|
||||
|
||||
```bash
|
||||
sudo systemctl restart abelbirdnest-web
|
||||
sudo systemctl status abelbirdnest-web --no-pager
|
||||
```
|
||||
|
||||
- Tidak ada migration Prisma baru dari patch ini.
|
||||
|
||||
### 1. Flow Mobile Purchase
|
||||
|
||||
- Menu `Receipt` di mobile sudah dikeluarkan dari bootstrap mobile.
|
||||
|
||||
Reference in New Issue
Block a user