Add Raw Material Category management with CRUD and import/export#10
Conversation
…tes, UI components, and data models for CRUD, import, and export operations.
There was a problem hiding this comment.
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
RMCategoryServicegRPC 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) |
There was a problem hiding this comment.
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).
| const response = await client.updateRMCategory({ rmCategoryId, ...body }, metadata) | |
| const response = await client.updateRMCategory({ ...body, rmCategoryId }, metadata) |
| "lucide-react": "^0.563.0", | ||
| "next": "16.1.6", | ||
| "next": "^16.2.1", | ||
| "next-themes": "^0.4.6", |
There was a problem hiding this comment.
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.
…Accordion UI component.
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
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]RMCategoryFormDialog,RMCategoryDeleteDialog,RMCategoryImportDialog,RMCategoryFilters,RMCategoryTable,RMCategoryPagination) and exported them for reuse. [1] [2] [3]UI/UX Improvements
PageHeadercomponent to use a slightly smaller heading size for better consistency across dashboard pages.Dependency Updates
nextpackage version inpackage.jsonto ensure compatibility with the latest Next.js features and fixes.