-
Notifications
You must be signed in to change notification settings - Fork 0
[CFMS][NgocAnh]Create Inventory Receipt #56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces changes to support inventory receipt functionality, including new types, schemas, API service updates, and UI components. Key updates include renaming inventory code properties to receipt code numbers, adding a new batchNumber field, and updating endpoints and query functions to support farm-specific receipt retrieval.
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/utils/types/custom.type.ts | Adds inventoryReceipts to InventoryRequestResponse and renames inventoryCode to receiptCodeNumber in ReceiptResponse. |
| src/utils/schemas/inventory-receipt.schema.ts | Updates schema validations and property names, and modifies optional warehouse IDs. |
| src/utils/data/table.data.ts | Updates property names from inventoryCode to receiptCodeNumber. |
| src/services/warehouse.service.ts | Adjusts the endpoint path for fetching warehouse stock. |
| src/services/request.service.ts | Updates the receipt creation function to use the new CreateInventoryReceipt type and adds a new API for farm-specific receipts. |
| src/components/card/resource-card.ts | Introduces a new resource card component with enhanced loading and error states. |
| src/components/badge/BadgeReceipt.tsx | Enhances badge display modes with new 'title' mode and updates loading/fallback content. |
| src/app/farm/register/page2.tsx | Removes a redundant type attribute from an Input component. |
| src/app/(main)/warehouse/inventory-receipt/page.tsx | Switches to farm-specific receipt retrieval and comments out unused user filtering code. |
| src/app/(main)/warehouse/inventory-receipt/columns.tsx | Cleans up table column definitions for inventory receipts and leaves commented code blocks. |
Comments suppressed due to low confidence (3)
src/services/request.service.ts:57
- [nitpick] The function name 'createInvetoryReceiptFromRequest' appears to have a typographical error. Consider renaming it to 'createInventoryReceiptFromRequest' for clarity.
export const createInvetoryReceiptFromRequest = async (body: CreateInventoryReceipt) => {
src/app/farm/register/page2.tsx:473
- The removal of the type='number' attribute from the Input component may lead to unexpected behavior for numeric inputs. Consider restoring the type attribute if the input is meant for numeric values.
type="number"
src/app/(main)/warehouse/inventory-receipt/page.tsx:24
- [nitpick] There is commented-out code for fetching users and filtering receipts. Removing unused commented code can improve maintainability.
// useQuery({ ... })
| // { | ||
| // accessorKey: 'subcategoryName', | ||
| // header: ({ column }) => <DataTableColumnHeader column={column} title="Danh mục" />, | ||
| // cell: ({ row }) => <div>{row.getValue('subcategoryName')}</div>, | ||
| // accessorKey: 'createdByUserId', | ||
| // header: ({ column }) => <DataTableColumnHeader column={column} title="Tạo bởi" />, | ||
| // cell: ({ row }) => { | ||
| // const users: User[] = JSON.parse(sessionStorage.getItem('users') || '[]'); | ||
| // const createBy = users.find((user) => user.userId === row.getValue('createdByUserId')); | ||
| // return <span>{createBy?.fullName ?? '-'}</span>; | ||
| // }, | ||
| // }, |
Copilot
AI
May 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Consider removing the commented-out block of code for the 'createdByUserId' column if it is no longer needed, to enhance code clarity.
| import { getWareById } from '@/services/warehouse.service'; | ||
|
|
Copilot
AI
May 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The import 'getWareById' is not used within this file. Consider removing the unused import to clean up the code.
| import { getWareById } from '@/services/warehouse.service'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds functionality for creating and managing inventory receipts and stock receipts, including associated schema updates, API service methods, and UI components. Key changes include renaming and restructuring of receipt fields (e.g. inventoryCode to receiptCodeNumber), updates to warehouse service endpoints, and new pages/components for creating stock receipts and viewing inventory receipt details.
Reviewed Changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/utils/schemas/stock-receipt.schema.ts | Introduces the StockReceipt schema with commented alternatives for unitId handling. |
| src/utils/schemas/inventory-receipt.schema.ts | Renames inventoryCode to receiptCodeNumber and updates handling of warehouse IDs. |
| src/services/warehouse.service.ts | Updates endpoint paths for warehouse stock requests. |
| src/app/farm/register/page2.tsx | Removes the type="number" attribute from an Input component for coordinate input. |
| src/app/(main)/warehouse/inventory-receipt/[inventoryReceiptId]/page.tsx | Updates user lookup and adds navigation logic for receipt details. |
| (Other files) | Various UI, schema, and API adjustments to support the new inventory receipt workflow. |
Comments suppressed due to low confidence (4)
src/app/farm/register/page2.tsx:473
- [nitpick] The removal of the type="number" attribute from the Input component may affect numeric input behavior; consider restoring it if numeric validation is required.
<Input step="any" {...field} />
src/utils/schemas/inventory-receipt.schema.ts:11
- [nitpick] Using .optional().or(z.literal('')) for wareFromId may lead to ambiguous value handling; please confirm that an empty string is the desired fallback value.
.optional() // undefined
src/services/warehouse.service.ts:39
- The endpoint path has changed from '/warestocks/' to '/warestock/'; please verify that this matches the current backend API specification to avoid call mismatches.
const endpoint = `${PREFIX}/warestock/${resourceId}`;
src/app/(main)/warehouse/inventory-receipt/[inventoryReceiptId]/page.tsx:69
- Switching from receipt.createdByUserId to receipt.userId for user lookup may result in an incorrect creator name; please verify that this change is intentional.
const createdBy = users?.find((user) => user.userId === receipt.userId);
| // .optional() // undefined | ||
| // .or(z.literal('')), // null, |
Copilot
AI
May 6, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Consider removing commented-out alternatives for unitId handling if they are no longer needed.
| // .optional() // undefined | |
| // .or(z.literal('')), // null, |
…/SP25SE153-CFMS/CFMS-Frontend into feature/create-inventory-receipt
No description provided.