Quellcode durchsuchen

Missing Item supporting function &report

MergeProblem1
Tommy\2Fi-Staff vor 2 Wochen
Ursprung
Commit
0008e1471f
4 geänderte Dateien mit 30 neuen und 28 gelöschten Zeilen
  1. +1
    -1
      src/components/CreateItem/CreateItem.tsx
  2. +13
    -26
      src/components/ItemsSearch/ItemsSearch.tsx
  3. +15
    -0
      src/config/reportConfig.ts
  4. +1
    -1
      src/i18n/zh/items.json

+ 1
- 1
src/components/CreateItem/CreateItem.tsx Datei anzeigen

@@ -220,7 +220,7 @@ const CreateItem: React.FC<Props> = ({
variant="scrollable"
>
<Tab label={t("Product / Material Details")} iconPosition="end" />
<Tab label={t("Qc items")} iconPosition="end" />
{/* <Tab label={t("Qc items")} iconPosition="end" /> */}
</Tabs>
{serverError && (
<Typography variant="body2" color="error" alignSelf="flex-end">


+ 13
- 26
src/components/ItemsSearch/ItemsSearch.tsx Datei anzeigen

@@ -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<Props> = ({ 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<Column<ItemsResultWithStatus>[]>(
() => [
{
@@ -158,22 +139,34 @@ const ItemsSearch: React.FC<Props> = ({ items }) => {
label: t("Details"),
onClick: onDetailClick,
buttonIcon: <EditNote />,
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<Props> = ({ items }) => {
}
},
},
{
name: "action",
label: t(""),
buttonIcon: <GridDeleteIcon />,
onClick: onDeleteClick,
},
],
[onDeleteClick, onDetailClick, t, checkItemStatus],
[onDetailClick, t, checkItemStatus],
);

const onReset = useCallback(() => {


+ 15
- 0
src/config/reportConfig.ts Datei anzeigen

@@ -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...
];

+ 1
- 1
src/i18n/zh/items.json Datei anzeigen

@@ -33,7 +33,7 @@
"Search": "搜尋",
"Release": "發佈",
"Actions": "操作",
"LocationCode": "位置",
"LocationCode": "預設位置",
"DefaultLocationCode": "預設位置",
"Special Type": "特殊類型",
"None": "無",


Laden…
Abbrechen
Speichern