Skip to content

feat(finance): master lookup param type, CAPP child operations, and calc schedule page#51

Merged
ilramdhan merged 22 commits into
mutugading:mainfrom
ilramdhan:fix/seed-master-data-product-cost
Jun 20, 2026
Merged

feat(finance): master lookup param type, CAPP child operations, and calc schedule page#51
ilramdhan merged 22 commits into
mutugading:mainfrom
ilramdhan:fix/seed-master-data-product-cost

Conversation

@ilramdhan

Copy link
Copy Markdown
Member

Description

Pull Request ini memperkenalkan arsitektur Master Lookup Param Type yang sepenuhnya dinamis dan digerakkan oleh tabel (table-driven), menggantikan fallback text manual sebelumnya. PR ini juga mencakup UI/UX admin page untuk registri Lookup Master (mendukung CRUD tanpa query SQL manual). Selain itu, terdapat fitur operasi parent-child pada halaman CAPP, penyelesaian isu 404 pada detail Cost Results, serta penambahan halaman baru Calc Schedule untuk memantau tugas otomatisasi (cron jobs).

Type of Change

  • 🐛 Bug fix
  • ✨ New feature
  • 🎨 UI/UX improvement
  • ♻️ Refactor
  • 📚 Documentation
  • 🔧 Chore (deps, config)

Module/Component Affected

  • Dashboard
  • Finance (Costing / CAPP / Cost Results)
  • HR / IT / CI / EXSIM
  • Components (common/)
  • Components (ui/)
  • Navigation
  • API Routes (BFF)

Changes Made

1. Master Lookup System & Registry:

  • Mengimplementasikan entitas param type baru MASTER_LOOKUP beserta halaman admin CRUD /finance/lookup-masters. Sistem ini mendukung introspeksi tabel, inline options preview, dan fitur export/import tanpa memerlukan konfigurasi SQL.
  • Membuat komponen combobox interaktif MasterLookupField dan hook use-master-lookup yang memicu auto-populate (mengisi nilai fill secara otomatis berdasarkan pilihan) untuk modul entri parameter.
  • Melakukan pembaruan masif pada proto (gRPC client) dan menyiapkan BFF routes untuk LookupMasterService dan YarnLookupFillService.

2. CAPP Parent/Child Operations:

  • Menambahkan kapabilitas operasi berlapis (with-children) pada UI form CAPP: add-with-children, remove-preview, dan remove-with-children.
  • Mengimplementasikan perlindungan UI dengan menjadikan baris parameter child sebagai read-only (tombol hapus dinonaktifkan) dan menambahkan Confirm Dialog terperinci (dengan loading state) agar user dapat mereviu child params yang akan ikut terhapus.

3. Calc Schedule & Cost Results:

  • Menambahkan halaman baru /finance/calc-schedule yang menampilkan informasi cron schedule otomatis, indikator KPI, serta tabel riwayat batch job terbaru dengan kapabilitas eksekusi manual via "Run now".
  • Bug Fix: Memperbaiki rute /finance/cost-results/[productSysId]/[period]/[calcType]/page.tsx yang sebelumnya mengembalikan error 404 Not Found.
  • Mengubah perilaku default filter periode pada halaman Cost Results menjadi tahun berjalan (current year) dengan penyesuaian teks subjudul dinamis.

4. Testing & Proto:

  • Menambahkan E2E Playwright smoke tests yang memvalidasi flow eksekusi tipe parameter Master Lookup (9/9 pass) dan halaman admin Lookup Master CRUD (12/12 pass).
  • Regenerasi semua file biner proto TypeScript dan manajemen cache invalidate pada clients.ts untuk mengakomodasi penambahan kolom baru seperti lookup_fill_group_code.

Related Issues

Fixes #
Related to #

Screenshots

Before

After

Testing Performed

Manual Testing

  • Desktop (1440px+)
  • Tablet (768px)
  • Mobile (375px)
  • Light mode
  • Dark mode

Browser Testing

  • Chrome
  • Firefox
  • Safari
  • Edge

Build Verification

  • npm run lint passes
  • npx tsc --noEmit passes
  • npm run build succeeds

Accessibility

  • Keyboard navigation works
  • Screen reader compatible
  • Proper ARIA labels
  • Color contrast adequate

Performance

  • No unnecessary re-renders (Guard CommandEmpty saat loading options untuk cegah flicker)
  • Images optimized
  • Heavy components lazy loaded

Pre-merge Checklist

  • I have read and followed RULES.md (and CLAUDE.md)
  • I have read and followed CONTRIBUTING.md
  • Loading states implemented (if data fetching)
  • Error handling present (Error toasts added on fetch failures)
  • Component props typed properly
  • Uses semantic color classes
  • Responsive design tested
  • Dark mode compatible
  • Screenshots included (for UI changes)

Reviewer Notes

  • Lookup Master Redesign: Konfigurasi LookupMaster sekarang dirombak menjadi UI berbasis tabel (table-driven). Form Create disederhanakan hanya menerima lmCode, lmDisplayName, dan lmTableName. Field manual terkait konfigurasi path API (legacy) akan otomatis menyesuaikan atau diberikan nilai kosong (empty default).
  • CAPP Remove Action: Terdapat transisi ConfirmDialog baru untuk fungsi remove-with-children yang akan mem-block (mempertahankan dialog tetap terbuka) apabila operasi backend gagal, sehingga user dapat langsung melakukan retry tanpa mengulang prosedur klik.

ilramdhan and others added 22 commits June 18, 2026 14:30
- Add YarnLookupFillServiceDefinition to yarn_master import in clients.ts
- Add getYarnLookupFillClient() singleton using getOrCreate pattern
- Export getYarnLookupFillClient from grpc/index.ts barrel
- Create BFF route GET /api/v1/finance/lookup-fill-values with validation
- Add src/types/finance/yarn-master.ts with LookupFillValuesResponse and LOOKUP_MASTER_CONFIG

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
… hook

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…loading

- Add clarifying comment to MasterLookupFieldProps.allEntries: it is passed
  for context but auto-population happens in the parent via onChangeLookup
- Wrap CommandEmpty in !optionsLoading guard to prevent flicker when options
  are still loading from the lookup master query

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…free-text LOOKUP fallback

- Export DraftValue interface for reuse
- Add handleLookupChange callback (auto-populates numeric + text fills via MasterLookupField selection)
- Replace free-text LOOKUP Input with MasterLookupField combobox
- Convert patch to useCallback for stable deps in handleLookupChange

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…mingling label config

- Show error toast in MasterLookupField when auto-fill fetch fails (non-ok
  response or network error) instead of silently falling back to null fills
- Import DraftValue from parameters-tab instead of redeclaring locally
- Fix fetchMasterOptions to throw on non-ok response so TanStack Query
  correctly marks the query as errored instead of returning empty array
- Update LOOKUP_MASTER_CONFIG INTERMINGLING labelField from interminglingCode
  to interminglingName so the dropdown shows names not codes

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…P with-children ops

- Add LookupMasterServiceDefinition to clients.ts + index.ts barrel export
- New types/finance/lookup-master.ts: LookupMaster, LookupMasterColumn, RemoveApplicablePreview
- BFF GET /api/v1/finance/lookup-masters — list active/all lookup masters
- BFF GET /api/v1/finance/lookup-master-columns — list columns for a master code
- BFF POST /api/v1/finance/cost-product-parameters/applicable/add-with-children
- BFF POST /api/v1/finance/cost-product-parameters/applicable/remove-preview
- BFF POST /api/v1/finance/cost-product-parameters/applicable/remove-with-children
- New hooks/finance/use-lookup-master.ts: useLookupMasters, useLookupMasterColumns
- Update use-master-lookup.ts: replace hardcoded LOOKUP_MASTER_CONFIG with API call

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…Filter to BFF, and new fields to create form
…ster dropdown, fill-group + source-column selects
…y child rows, remove-with-children confirm dialog

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…ix cached lookup masters fetch

Three frontend fixes for the Master Lookup Param Type feature:

1. handleRemoveWithChildren — keep ConfirmDialog open on failure so the user can
   retry; only clear removePreviewEntry/removePreview on success.

2. Add removeInProgress state and pass it to ConfirmDialog isLoading so the
   button spins and is disabled while the remove-with-children request is in-flight.

3. Refactor useMasterLookupOptions to consume useLookupMasters (cached 5 min)
   instead of re-fetching the lookup-masters registry inside every queryFn call.
   The options query is enabled only when the config is resolved from the cached list.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…date, table-columns, options, export/import

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…e-name create field

- Regenerate all proto TypeScript types (binary .ts files)
- clients.ts: bump lookupMaster singleton key to invalidate stale channel
- useCreateLookupMaster: simplify mutation to accept lmCode/lmDisplayName/lmTableName
  only; lmApiPath/lmCodeField/lmLabelField default to empty (table-driven lookup
  no longer needs manual API path)
- lookup-masters-page-client.tsx: full redesign — table-column introspection UI,
  inline options preview, import/export support

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… route fix

- cost-results-page-client: default period filter to current year (show all
  YYYYMM in current year) instead of MAX period; subtitle now reads
  "year 2026" vs "period 202605" depending on filter length; placeholder
  updated to "Period YYYYMM (default: this year)"
- cost-results/[productSysId]/[period]/[calcType]/page.tsx: create missing
  detail route that was returning 404; validates numeric productSysId and
  known calcType before rendering CostResultDetail
- calc-schedule page: new page at /finance/calc-schedule showing automatic
  cron schedule info (every 5th, 02:00 WIB, previous-month ACTUAL), KPI
  strip of ALL/FILTERED scope jobs, recent batch job table, and "Run now"
  button delegating to NewJobDialog
- IAM migration 000060 adds the "Calc Schedule" sidebar menu entry under
  Product Costing, gated by finance.cost.caljob.view

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@ilramdhan ilramdhan added this to the Costing Release Milestone milestone Jun 20, 2026
@ilramdhan ilramdhan self-assigned this Jun 20, 2026
@ilramdhan ilramdhan added documentation Improvements or additions to documentation enhancement New feature or request feat labels Jun 20, 2026
@ilramdhan ilramdhan moved this from Todo to In progress in Goapps Roadmap [Frontend] Jun 20, 2026
@ilramdhan ilramdhan merged commit 3fcc9ed into mutugading:main Jun 20, 2026
4 checks passed
@github-project-automation github-project-automation Bot moved this from In progress to Done in Goapps Roadmap [Frontend] Jun 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request feat

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant