| @@ -12,7 +12,7 @@ type Props = { | |||||
| const InfoCard: React.FC<Props> = ({ | const InfoCard: React.FC<Props> = ({ | ||||
| }) => { | }) => { | ||||
| const { t } = useTranslation(); | |||||
| const { t } = useTranslation("jo"); | |||||
| const { control, getValues, register, watch } = useFormContext<JoDetail>(); | const { control, getValues, register, watch } = useFormContext<JoDetail>(); | ||||
| @@ -55,13 +55,12 @@ const PickTable: React.FC<Props> = ({ | |||||
| align: "left", | align: "left", | ||||
| headerAlign: "left", | headerAlign: "left", | ||||
| }, | }, | ||||
| { | { | ||||
| field: "status", | field: "status", | ||||
| headerName: t("Status"), | headerName: t("Status"), | ||||
| flex: 1, | flex: 1, | ||||
| renderCell: (row) => { | renderCell: (row) => { | ||||
| return upperFirst(row.value) | |||||
| return t(upperFirst(row.value)) | |||||
| }, | }, | ||||
| }, | }, | ||||
| ], []) | ], []) | ||||
| @@ -44,7 +44,15 @@ const PoSearch: React.FC<Props> = ({ | |||||
| const [totalCount, setTotalCount] = useState(initTotalCount); | const [totalCount, setTotalCount] = useState(initTotalCount); | ||||
| const searchCriteria: Criterion<SearchParamNames>[] = useMemo(() => { | const searchCriteria: Criterion<SearchParamNames>[] = useMemo(() => { | ||||
| const searchCriteria: Criterion<SearchParamNames>[] = [ | const searchCriteria: Criterion<SearchParamNames>[] = [ | ||||
| { label: t("Code"), paramName: "code", type: "text" }, | |||||
| { label: t("Po No."), paramName: "code", type: "text" }, | |||||
| { label: t("Order Date"), label2: t("Order Date To"), paramName: "orderDate", type: "dateRange" }, | |||||
| { | |||||
| label: t("Escalated"), | |||||
| paramName: "escalated", | |||||
| type: "select", | |||||
| options: [t("Escalated"), t("NotEscalated")], | |||||
| }, | |||||
| { label: t("ETA"), label2: t("ETA To"), paramName: "estimatedArrivalDate", type: "dateRange" }, | |||||
| { | { | ||||
| label: t("Status"), | label: t("Status"), | ||||
| paramName: "status", | paramName: "status", | ||||
| @@ -55,12 +63,6 @@ const PoSearch: React.FC<Props> = ({ | |||||
| { label: t(`completed`), value: `completed` }, | { label: t(`completed`), value: `completed` }, | ||||
| ], | ], | ||||
| }, | }, | ||||
| { | |||||
| label: t("Escalated"), | |||||
| paramName: "escalated", | |||||
| type: "select", | |||||
| options: [t("Escalated"), t("NotEscalated")], | |||||
| }, | |||||
| ]; | ]; | ||||
| return searchCriteria; | return searchCriteria; | ||||
| }, [t, po]); | }, [t, po]); | ||||
| @@ -84,22 +86,33 @@ const PoSearch: React.FC<Props> = ({ | |||||
| }, | }, | ||||
| { | { | ||||
| name: "code", | name: "code", | ||||
| label: t("Code"), | |||||
| label: `${t("Po No.")} &\n${t("Supplier")}`, | |||||
| renderCell: (params) => { | |||||
| return <>{params.code}<br/>{params.supplier}</> | |||||
| }, | |||||
| }, | }, | ||||
| { | { | ||||
| name: "orderDate", | name: "orderDate", | ||||
| label: t("OrderDate"), | |||||
| label: `${t("Order Date")} &\n${t("ETA")}`, | |||||
| renderCell: (params) => { | renderCell: (params) => { | ||||
| return ( | |||||
| dayjs(params.orderDate) | |||||
| .add(-1, "month") | |||||
| .format(OUTPUT_DATE_FORMAT) | |||||
| ); | |||||
| // return ( | |||||
| // dayjs(params.estimatedArrivalDate) | |||||
| // .add(-1, "month") | |||||
| // .format(OUTPUT_DATE_FORMAT) | |||||
| // ); | |||||
| return <>{arrayToDateString(params.orderDate)}<br/>{arrayToDateString(params.estimatedArrivalDate)}</> | |||||
| }, | }, | ||||
| }, | }, | ||||
| { | { | ||||
| name: "supplier", | |||||
| label: t("Supplier"), | |||||
| name: "itemDetail", | |||||
| label: t("Item Detail"), | |||||
| renderCell: (params) => { | |||||
| if (!params.itemDetail) { | |||||
| return "N/A" | |||||
| } | |||||
| const items = params.itemDetail.split(",") | |||||
| return items.map((item) => <p>{item}</p>) | |||||
| }, | |||||
| }, | }, | ||||
| { | { | ||||
| name: "status", | name: "status", | ||||
| @@ -165,7 +178,7 @@ const PoSearch: React.FC<Props> = ({ | |||||
| <Grid container> | <Grid container> | ||||
| <Grid item xs={8}> | <Grid item xs={8}> | ||||
| <Typography variant="h4" marginInlineEnd={2}> | <Typography variant="h4" marginInlineEnd={2}> | ||||
| {t("Purchase Order")} | |||||
| {t("Purchase Receipt")} | |||||
| </Typography> | </Typography> | ||||
| </Grid> | </Grid> | ||||
| <Grid item xs={4} display="flex" justifyContent="end" alignItems="end"> | <Grid item xs={4} display="flex" justifyContent="end" alignItems="end"> | ||||
| @@ -189,6 +202,10 @@ const PoSearch: React.FC<Props> = ({ | |||||
| query.escalated === "All" | query.escalated === "All" | ||||
| ? undefined | ? undefined | ||||
| : query.escalated === t("Escalated"), | : query.escalated === t("Escalated"), | ||||
| estimatedArrivalDate: query.estimatedArrivalDate === "Invalid Date" ? "" : query.estimatedArrivalDate, | |||||
| estimatedArrivalDateTo: query.estimatedArrivalDateTo === "Invalid Date" ? "" : query.estimatedArrivalDateTo, | |||||
| orderDate: query.orderDate === "Invalid Date" ? "" : query.orderDate, | |||||
| orderDateTo: query.orderDateTo === "Invalid Date" ? "" : query.orderDateTo, | |||||
| }); | }); | ||||
| // setFilteredPo((prev) => | // setFilteredPo((prev) => | ||||
| // po.filter((p) => { | // po.filter((p) => { | ||||
| @@ -19,6 +19,7 @@ import { | |||||
| ProdScheduleResultByPage, | ProdScheduleResultByPage, | ||||
| SearchProdSchedule, | SearchProdSchedule, | ||||
| fetchProdSchedules, | fetchProdSchedules, | ||||
| fetchRoughProdSchedules, | |||||
| testDetailedSchedule, | testDetailedSchedule, | ||||
| testRoughSchedule, | testRoughSchedule, | ||||
| } from "@/app/api/scheduling/actions"; | } from "@/app/api/scheduling/actions"; | ||||
| @@ -168,7 +169,7 @@ const RSOverview: React.FC<Props> = ({ type, defaultInputs }) => { | |||||
| pageNum: pagingController.pageNum - 1, | pageNum: pagingController.pageNum - 1, | ||||
| pageSize: pagingController.pageSize, | pageSize: pagingController.pageSize, | ||||
| }; | }; | ||||
| const response = await fetchProdSchedules(params); | |||||
| const response = await fetchRoughProdSchedules(params); | |||||
| // console.log(response) | // console.log(response) | ||||
| if (response) { | if (response) { | ||||
| @@ -2,8 +2,7 @@ import { fetchAllItems } from "@/app/api/settings/item"; | |||||
| import { RoughScheduleLoading } from "./RoughScheduleLoading"; | import { RoughScheduleLoading } from "./RoughScheduleLoading"; | ||||
| import RSOverview from "./RoughSchedileSearchView"; | import RSOverview from "./RoughSchedileSearchView"; | ||||
| import { | import { | ||||
| SearchProdSchedule, | |||||
| fetchProdSchedules, | |||||
| SearchProdSchedule | |||||
| } from "@/app/api/scheduling/actions"; | } from "@/app/api/scheduling/actions"; | ||||
| import { ScheduleType } from "@/app/api/scheduling"; | import { ScheduleType } from "@/app/api/scheduling"; | ||||
| @@ -281,7 +281,9 @@ function SearchResults<T extends ResultWithId>({ | |||||
| sx={column.sx} | sx={column.sx} | ||||
| key={`${column.name.toString()}${idx}`} | key={`${column.name.toString()}${idx}`} | ||||
| > | > | ||||
| {column.label} | |||||
| {column.label.split('\n').map((line, index) => ( | |||||
| <div key={index}>{line}</div> // Render each line in a div | |||||
| ))} | |||||
| </TableCell> | </TableCell> | ||||
| ))} | ))} | ||||
| </TableRow> | </TableRow> | ||||
| @@ -297,15 +299,15 @@ function SearchResults<T extends ResultWithId>({ | |||||
| tabIndex={-1} | tabIndex={-1} | ||||
| key={item.id} | key={item.id} | ||||
| onClick={(event) => { | onClick={(event) => { | ||||
| setCheckboxIds | |||||
| ? handleRowClick(event, item, columns) | |||||
| : undefined | |||||
| if (onRowClick) { | |||||
| onRowClick(item) | |||||
| } | |||||
| setCheckboxIds | |||||
| ? handleRowClick(event, item, columns) | |||||
| : undefined | |||||
| if (onRowClick) { | |||||
| onRowClick(item) | |||||
| } | } | ||||
| } | } | ||||
| } | |||||
| role={setCheckboxIds ? "checkbox" : undefined} | role={setCheckboxIds ? "checkbox" : undefined} | ||||
| > | > | ||||
| {columns.map((column, idx) => { | {columns.map((column, idx) => { | ||||
| @@ -81,5 +81,6 @@ | |||||
| "min": "分鐘", | "min": "分鐘", | ||||
| "mins": "分鐘", | "mins": "分鐘", | ||||
| "Job Order": "工單", | "Job Order": "工單", | ||||
| "Edit Job Order": "編輯工單", | |||||
| "Production": "生產流程" | "Production": "生產流程" | ||||
| } | } | ||||
| @@ -0,0 +1,19 @@ | |||||
| { | |||||
| "Job Order": "工單", | |||||
| "Create Job Order": "創建工單", | |||||
| "Edit Job Order Detail": "編輯工單", | |||||
| "Details": "細節", | |||||
| "Code": "編號", | |||||
| "Name": "名稱", | |||||
| "Req. Qty": "需求數量", | |||||
| "UoM": "單位", | |||||
| "Status": "狀態", | |||||
| "Lot No.": "批號", | |||||
| "Bom": "物料清單", | |||||
| "Release": "發佈", | |||||
| "Pending": "待提料", | |||||
| "Planning": "計劃中" | |||||
| } | |||||
| @@ -1,7 +1,12 @@ | |||||
| { | { | ||||
| "Purchase Order": "採購訂單", | "Purchase Order": "採購訂單", | ||||
| "Purchase Receipt": "採購來貨", | |||||
| "Code": "編號", | "Code": "編號", | ||||
| "OrderDate": "下單日期", | "OrderDate": "下單日期", | ||||
| "Order Date": "下單日期", | |||||
| "Order Date To": "下單日期至", | |||||
| "ETA": "預計到貨日期", | |||||
| "ETA To": "預計到貨日期至", | |||||
| "Details": "詳情", | "Details": "詳情", | ||||
| "Supplier": "供應商", | "Supplier": "供應商", | ||||
| "Status": "狀態", | "Status": "狀態", | ||||
| @@ -20,8 +25,10 @@ | |||||
| "Complete PO": "完成採購訂單", | "Complete PO": "完成採購訂單", | ||||
| "General": "一般", | "General": "一般", | ||||
| "Bind Storage": "綁定倉位", | "Bind Storage": "綁定倉位", | ||||
| "Po No.": "採購訂單編號", | |||||
| "itemNo": "項目編號", | "itemNo": "項目編號", | ||||
| "itemName": "項目名稱", | "itemName": "項目名稱", | ||||
| "Item Detail": "項目詳情", | |||||
| "qty": "數量", | "qty": "數量", | ||||
| "uom": "計量單位", | "uom": "計量單位", | ||||
| "total weight": "總重量", | "total weight": "總重量", | ||||