From 0008e1471fddfb47422cdf9d7e16784d587c87cd Mon Sep 17 00:00:00 2001 From: "Tommy\\2Fi-Staff" Date: Fri, 16 Jan 2026 13:35:47 +0800 Subject: [PATCH] Missing Item supporting function &report --- src/components/CreateItem/CreateItem.tsx | 2 +- src/components/ItemsSearch/ItemsSearch.tsx | 39 ++++++++-------------- src/config/reportConfig.ts | 15 +++++++++ src/i18n/zh/items.json | 2 +- 4 files changed, 30 insertions(+), 28 deletions(-) diff --git a/src/components/CreateItem/CreateItem.tsx b/src/components/CreateItem/CreateItem.tsx index f4fd8e2..661cf6e 100644 --- a/src/components/CreateItem/CreateItem.tsx +++ b/src/components/CreateItem/CreateItem.tsx @@ -220,7 +220,7 @@ const CreateItem: React.FC = ({ variant="scrollable" > - + {/* */} {serverError && ( diff --git a/src/components/ItemsSearch/ItemsSearch.tsx b/src/components/ItemsSearch/ItemsSearch.tsx index f8a2487..9da740b 100644 --- a/src/components/ItemsSearch/ItemsSearch.tsx +++ b/src/components/ItemsSearch/ItemsSearch.tsx @@ -7,14 +7,11 @@ import { useTranslation } from "react-i18next"; import SearchResults, { Column } from "../SearchResults"; import { EditNote } from "@mui/icons-material"; import { useRouter, useSearchParams } from "next/navigation"; -import { GridDeleteIcon } from "@mui/x-data-grid"; import { Chip } from "@mui/material"; import { TypeEnum } from "@/app/utils/typeEnum"; import axios from "axios"; import { BASE_API_URL, NEXT_PUBLIC_API_URL } from "@/config/api"; import axiosInstance from "@/app/(main)/axios/axiosInstance"; -import { deleteItem } from "@/app/api/settings/item/actions"; -import { deleteDialog, successDialog } from "../Swal/CustomAlerts"; type Props = { items: ItemsResult[]; @@ -135,22 +132,6 @@ const ItemsSearch: React.FC = ({ items }) => { refetchData, ]); - const onDeleteClick = useCallback( - (item: ItemsResult) => { - deleteDialog(async () => { - if (item.id) { - const itemId = typeof item.id === "string" ? parseInt(item.id, 10) : item.id; - if (!isNaN(itemId)) { - await deleteItem(itemId); - await refetchData(filterObj); - await successDialog(t("Delete Success"), t); - } - } - }, t); - }, - [refetchData, filterObj, t], - ); - const columns = useMemo[]>( () => [ { @@ -158,22 +139,34 @@ const ItemsSearch: React.FC = ({ items }) => { label: t("Details"), onClick: onDetailClick, buttonIcon: , + sx: { width: 80 }, }, { name: "code", label: t("Code"), + sx: { width: 150 }, }, { name: "name", label: t("Name"), + sx: { width: 250 }, + }, + { + name: "LocationCode", + label: t("LocationCode"), + sx: { width: 150 }, }, { name: "type", label: t("Type"), + sx: { width: 120 }, }, { name: "status", label: t("Status"), + align: "center", + headerAlign: "center", + sx: { width: 120 }, renderCell: (item) => { const status = item.status || checkItemStatus(item); if (status === "complete") { @@ -183,14 +176,8 @@ const ItemsSearch: React.FC = ({ items }) => { } }, }, - { - name: "action", - label: t(""), - buttonIcon: , - onClick: onDeleteClick, - }, ], - [onDeleteClick, onDetailClick, t, checkItemStatus], + [onDetailClick, t, checkItemStatus], ); const onReset = useCallback(() => { diff --git a/src/config/reportConfig.ts b/src/config/reportConfig.ts index 9381927..f4a242e 100644 --- a/src/config/reportConfig.ts +++ b/src/config/reportConfig.ts @@ -47,5 +47,20 @@ export const REPORTS: ReportDefinition[] = [ ], required: false} ] }, + { + id: "rep-003", + title: "Report 3", + apiEndpoint: `${NEXT_PUBLIC_API_URL}/report/print-report3`, + fields: [ + { label: "From Date", name: "fromDate", type: "date", required: true }, // Mandatory + { label: "To Date", name: "toDate", type: "date", required: true }, // Mandatory + { label: "Item Code", name: "itemCode", type: "text", required: false, placeholder: "e.g. FG"}, + { label: "Item Type", name: "itemType", type: "select", required: false, + options: [ + { label: "FG", value: "FG" }, + { label: "Material", value: "Mat" } + ] }, + ] + } // Add Report 3 to 10 following the same pattern... ]; \ No newline at end of file diff --git a/src/i18n/zh/items.json b/src/i18n/zh/items.json index bdd59ca..c2f200a 100644 --- a/src/i18n/zh/items.json +++ b/src/i18n/zh/items.json @@ -33,7 +33,7 @@ "Search": "搜尋", "Release": "發佈", "Actions": "操作", -"LocationCode": "位置", +"LocationCode": "預設位置", "DefaultLocationCode": "預設位置", "Special Type": "特殊類型", "None": "無",