Skip to content

Add Raw Material Category management with CRUD and import/export#10

Merged
ilramdhan merged 2 commits intomutugading:mainfrom
ilramdhan:feat/integration-with-proto-uom-service
Mar 26, 2026
Merged

Add Raw Material Category management with CRUD and import/export#10
ilramdhan merged 2 commits intomutugading:mainfrom
ilramdhan:feat/integration-with-proto-uom-service

Conversation

@ilramdhan
Copy link
Copy Markdown
Member

This pull request introduces a comprehensive implementation for managing Raw Material (RM) Categories in the finance dashboard. It adds full CRUD (Create, Read, Update, Delete) operations, import/export functionality, and a new UI page for RM Category management. The API routes are implemented using Next.js route handlers and gRPC, while the frontend leverages modular React components and hooks for state management and data fetching.

The most important changes are:

API: RM Category CRUD and Import/Export

Frontend: RM Category Page and Components

  • Added a new RM Category management page (rm-category-page-client.tsx) with a fully functional UI, including table display, filters, pagination, add/edit/delete dialogs, and import/export controls. The page uses React Suspense for loading states. [1] [2] [3]
  • Implemented modular RM Category components (RMCategoryFormDialog, RMCategoryDeleteDialog, RMCategoryImportDialog, RMCategoryFilters, RMCategoryTable, RMCategoryPagination) and exported them for reuse. [1] [2] [3]

UI/UX Improvements

  • Updated the PageHeader component to use a slightly smaller heading size for better consistency across dashboard pages.

Dependency Updates

  • Upgraded the next package version in package.json to ensure compatibility with the latest Next.js features and fixes.

…tes, UI components, and data models for CRUD, import, and export operations.
@ilramdhan ilramdhan requested a review from Copilot March 25, 2026 04:49
@ilramdhan ilramdhan self-assigned this Mar 25, 2026
@ilramdhan ilramdhan added documentation Improvements or additions to documentation enhancement New feature or request labels Mar 25, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Raw Material (RM) Category master-data management to the finance dashboard, including new gRPC-backed Next.js API route handlers, React UI (page + modular components), and TanStack Query hooks, plus an update to the Next.js dependency.

Changes:

  • Added finance RM Category API routes (CRUD + import/export/template) backed by RMCategoryService gRPC client.
  • Added RM Category frontend page, reusable UI components (table/filters/pagination/dialogs), and data hooks.
  • Introduced RM Category proto-generated types + UI helper types; updated Next.js dependency version.

Reviewed changes

Copilot reviewed 22 out of 24 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/types/generated/finance/v1/rm_category.ts Adds generated proto types + service definition for RM Category.
src/types/finance/rm-category.ts Re-exports RM Category proto types and adds UI helper types/constants.
src/lib/grpc/index.ts Re-exports the new RM Category gRPC client getter.
src/lib/grpc/clients.ts Adds getRmCategoryClient() wired to RMCategoryServiceDefinition.
src/hooks/finance/use-rm-category.ts Adds CRUD hooks via createCrudHooks + import/export/template mutations.
src/components/finance/rm-category/rm-category-table.tsx RM Category list table configuration + row actions.
src/components/finance/rm-category/rm-category-pagination.tsx Pagination wrapper for RM Category list.
src/components/finance/rm-category/rm-category-import-dialog.tsx Import dialog with template download + results display.
src/components/finance/rm-category/rm-category-form-dialog.tsx Create/Edit dialog with validation.
src/components/finance/rm-category/rm-category-filters.tsx Search/filter/sort controls synced with URL state.
src/components/finance/rm-category/rm-category-delete-dialog.tsx Delete confirmation dialog integrated with delete hook.
src/components/finance/rm-category/index.ts Barrel exports for RM Category components.
src/components/finance/index.ts Exposes RM Category components under finance exports.
src/components/common/page-header.tsx Adjusts page header heading size for dashboard consistency.
src/app/api/v1/finance/rm-categories/template/route.ts Adds template download endpoint (base64 JSON payload).
src/app/api/v1/finance/rm-categories/route.ts Adds list + create endpoints for RM Categories.
src/app/api/v1/finance/rm-categories/import/route.ts Adds Excel import endpoint.
src/app/api/v1/finance/rm-categories/export/route.ts Adds Excel export endpoint.
src/app/api/v1/finance/rm-categories/[rmCategoryId]/route.ts Adds get/update/delete endpoints for a single RM Category.
src/app/(dashboard)/finance/master/rm-category/rm-category-page-client.tsx Adds the RM Category management page UI wiring everything together.
src/app/(dashboard)/finance/master/rm-category/page.tsx Registers the RM Category page route + metadata.
src/app/(dashboard)/finance/master/rm-category/loading.tsx Adds a loading skeleton for the RM Category page route.
package.json Updates Next.js dependency version range.
package-lock.json Locks updated Next.js dependency resolution.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

const body = await request.json()
const metadata = createMetadataFromRequest(request)
const client = getRmCategoryClient()
const response = await client.updateRMCategory({ rmCategoryId, ...body }, metadata)
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updateRMCategory({ rmCategoryId, ...body }, ...) allows rmCategoryId in the request body to override the route param (because the spread happens after the param). This can lead to updating a different category than the URL indicates. Ensure the route param always wins (e.g., spread body first and then set rmCategoryId, or explicitly omit rmCategoryId from body).

Suggested change
const response = await client.updateRMCategory({ rmCategoryId, ...body }, metadata)
const response = await client.updateRMCategory({ ...body, rmCategoryId }, metadata)

Copilot uses AI. Check for mistakes.
Comment on lines 39 to 41
"lucide-react": "^0.563.0",
"next": "16.1.6",
"next": "^16.2.1",
"next-themes": "^0.4.6",
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The next dependency was changed from an exact version to a caret range. This can pull in future minor releases automatically and may break unexpectedly; it also leaves eslint-config-next pinned to 16.1.6, which can cause version skew with the installed Next.js. Consider keeping Next pinned (or using ~), and update eslint-config-next to the same version as next if you intend to upgrade.

Copilot uses AI. Check for mistakes.
@ilramdhan ilramdhan merged commit 7b2091b into mutugading:main Mar 26, 2026
4 checks passed
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants