| @@ -1,3 +1,4 @@ | |||||
| import { fetchQcCategoryCombo } from "@/app/api/settings/qcCategory"; | |||||
| import { SearchParams } from "@/app/utils/fetchUtil"; | import { SearchParams } from "@/app/utils/fetchUtil"; | ||||
| import { TypeEnum } from "@/app/utils/typeEnum"; | import { TypeEnum } from "@/app/utils/typeEnum"; | ||||
| import CreateProductMaterial from "@/components/CreateItem"; | import CreateProductMaterial from "@/components/CreateItem"; | ||||
| @@ -17,6 +18,9 @@ const productSetting: React.FC<Props> = async ({ searchParams }) => { | |||||
| if (!id) { | if (!id) { | ||||
| notFound(); | notFound(); | ||||
| } | } | ||||
| fetchQcCategoryCombo() | |||||
| return ( | return ( | ||||
| <> | <> | ||||
| {/* <Typography variant="h4">{t("Create Material")}</Typography> */} | {/* <Typography variant="h4">{t("Create Material")}</Typography> */} | ||||
| @@ -35,6 +35,7 @@ export type CreateItemInputs = { | |||||
| type: string; | type: string; | ||||
| qcChecks: QcChecksInputs[]; | qcChecks: QcChecksInputs[]; | ||||
| qcChecks_active: number[]; | qcChecks_active: number[]; | ||||
| qcCategoryId: number | undefined; | |||||
| }; | }; | ||||
| export const saveItem = async (data: CreateItemInputs) => { | export const saveItem = async (data: CreateItemInputs) => { | ||||
| @@ -4,6 +4,7 @@ import "server-only"; | |||||
| // import { BASE_API_URL } from "@/config/api"; | // import { BASE_API_URL } from "@/config/api"; | ||||
| import { serverFetchJson } from "../../../utils/fetchUtil"; | import { serverFetchJson } from "../../../utils/fetchUtil"; | ||||
| import { BASE_API_URL } from "../../../../config/api"; | import { BASE_API_URL } from "../../../../config/api"; | ||||
| import { QcCategoryResult } from "../qcCategory"; | |||||
| // import { TypeInputs, UomInputs, WeightUnitInputs } from "./actions"; | // import { TypeInputs, UomInputs, WeightUnitInputs } from "./actions"; | ||||
| @@ -37,6 +38,7 @@ export type ItemsResult = { | |||||
| action?: any; | action?: any; | ||||
| fgName?: string; | fgName?: string; | ||||
| excludeDate?: string; | excludeDate?: string; | ||||
| qcCategory?: QcCategoryResult; | |||||
| }; | }; | ||||
| export type Result = { | export type Result = { | ||||
| @@ -406,9 +406,9 @@ const PoDetail: React.FC<Props> = ({ po, qc, warehouse }) => { | |||||
| <TableCell align="right">{integerFormatter.format(row.qty)}</TableCell> | <TableCell align="right">{integerFormatter.format(row.qty)}</TableCell> | ||||
| <TableCell align="right">{integerFormatter.format(processedQty)}</TableCell> | <TableCell align="right">{integerFormatter.format(processedQty)}</TableCell> | ||||
| <TableCell align="left">{row.uom?.code}</TableCell> | <TableCell align="left">{row.uom?.code}</TableCell> | ||||
| <TableCell align="right"> | |||||
| {/* <TableCell align="right"> | |||||
| {decimalFormatter.format(totalWeight)} {weightUnit} | {decimalFormatter.format(totalWeight)} {weightUnit} | ||||
| </TableCell> | |||||
| </TableCell> */} | |||||
| {/* <TableCell align="left">{weightUnit}</TableCell> */} | {/* <TableCell align="left">{weightUnit}</TableCell> */} | ||||
| <TableCell align="right">{decimalFormatter.format(row.price)}</TableCell> | <TableCell align="right">{decimalFormatter.format(row.price)}</TableCell> | ||||
| {/* <TableCell align="left">{row.expiryDate}</TableCell> */} | {/* <TableCell align="left">{row.expiryDate}</TableCell> */} | ||||
| @@ -651,7 +651,7 @@ const PoDetail: React.FC<Props> = ({ po, qc, warehouse }) => { | |||||
| <TableCell align="right">{t("qty")}</TableCell> | <TableCell align="right">{t("qty")}</TableCell> | ||||
| <TableCell align="right">{t("processed")}</TableCell> | <TableCell align="right">{t("processed")}</TableCell> | ||||
| <TableCell align="left">{t("uom")}</TableCell> | <TableCell align="left">{t("uom")}</TableCell> | ||||
| <TableCell align="right">{t("total weight")}</TableCell> | |||||
| {/* <TableCell align="right">{t("total weight")}</TableCell> */} | |||||
| <TableCell align="right">{`${t("price")} (HKD)`}</TableCell> | <TableCell align="right">{`${t("price")} (HKD)`}</TableCell> | ||||
| <TableCell align="left" sx={{ width: '75px' }}>{t("status")}</TableCell> | <TableCell align="left" sx={{ width: '75px' }}>{t("status")}</TableCell> | ||||
| {renderFieldCondition(FIRST_IN_FIELD) ? <TableCell align="right">{t("receivedQty")}</TableCell> : undefined} | {renderFieldCondition(FIRST_IN_FIELD) ? <TableCell align="right">{t("receivedQty")}</TableCell> : undefined} | ||||
| @@ -480,20 +480,20 @@ const closeNewModal = useCallback(() => { | |||||
| return params.row.uom.code; | return params.row.uom.code; | ||||
| }, | }, | ||||
| }, | }, | ||||
| { | |||||
| field: "weight", | |||||
| headerName: t("weight"), | |||||
| width: 120, | |||||
| // flex: 0.5, | |||||
| renderCell: (params) => { | |||||
| const weight = calculateWeight( | |||||
| params.row.acceptedQty, | |||||
| params.row.uom, | |||||
| ); | |||||
| const weightUnit = returnWeightUnit(params.row.uom); | |||||
| return `${decimalFormatter.format(weight)} ${weightUnit}`; | |||||
| }, | |||||
| }, | |||||
| // { | |||||
| // field: "weight", | |||||
| // headerName: t("weight"), | |||||
| // width: 120, | |||||
| // // flex: 0.5, | |||||
| // renderCell: (params) => { | |||||
| // const weight = calculateWeight( | |||||
| // params.row.acceptedQty, | |||||
| // params.row.uom, | |||||
| // ); | |||||
| // const weightUnit = returnWeightUnit(params.row.uom); | |||||
| // return `${decimalFormatter.format(weight)} ${weightUnit}`; | |||||
| // }, | |||||
| // }, | |||||
| { | { | ||||
| field: "status", | field: "status", | ||||
| headerName: t("status"), | headerName: t("status"), | ||||