diff --git a/src/app/(main)/scheduling/rough/page.tsx b/src/app/(main)/scheduling/rough/page.tsx
index ff7915b..e949b21 100644
--- a/src/app/(main)/scheduling/rough/page.tsx
+++ b/src/app/(main)/scheduling/rough/page.tsx
@@ -1,6 +1,7 @@
// import { TypeEnum } from "@/app/utils/typeEnum";
// import RoughSchedule from "@/components/RoughSchedule";
// import { getServerI18n, I18nProvider } from "@/i18n";
+import { testRoughSchedule } from "@/app/api/scheduling/actions";
import { TypeEnum } from "../../../../app/utils/typeEnum";
import RoughSchedule from "../../../../components/RoughSchedule";
import { getServerI18n, I18nProvider } from "../../../../i18n";
@@ -22,6 +23,10 @@ const roughScheduling: React.FC = async () => {
const type = "rough"
// preloadClaims();
+ // async function testingRoughSchedule() {
+ // await testRoughSchedule();
+ // }
+
return (
<>
{
{t("Demand Forecast")}
-
+
{/* }
- LinkComponent={Link}
- href="product/create"
- >
- {t("Create product")}
- */}
+ variant="contained"
+ startIcon={}
+ onClick={() => testingRoughSchedule}
+ >
+ {t("Test Rough Scheduling")}
+ */}
-
+
}>
-
+
>
diff --git a/src/components/RoughSchedule/RoughSchedileSearchView.tsx b/src/components/RoughSchedule/RoughSchedileSearchView.tsx
index 7a175a0..bc3f778 100644
--- a/src/components/RoughSchedule/RoughSchedileSearchView.tsx
+++ b/src/components/RoughSchedule/RoughSchedileSearchView.tsx
@@ -19,6 +19,7 @@ import { arrayToDateString, decimalFormatter } from "@/app/utils/formatUtil";
import { isEqual, uniqBy } from "lodash";
import dayjs from "dayjs";
import { defaultPagingController } from "../SearchResults/SearchResults";
+import { ScheduleType } from "@/app/api/scheduling";
// type RecordStructure ={
// id: number,
@@ -27,17 +28,17 @@ import { defaultPagingController } from "../SearchResults/SearchResults";
// };
type Props = {
- type: SearchProdSchedule["type"];
+ type: ScheduleType;
// initProdSchedules: ProdScheduleResultByPage;
defaultInputs: SearchProdSchedule;
};
-type SearchQuery = Partial>;
+type SearchQuery = Partial>;
type SearchParamNames = keyof SearchQuery;
const RSOverview: React.FC = ({ type, defaultInputs }) => {
const [filteredSchedules, setFilteredSchedules] = useState([]);
- const { t } = useTranslation("scheduling");
+ const { t } = useTranslation("schedule");
const router = useRouter();
// const [filterObj, setFilterObj] = useState({});
// const [tempSelectedValue, setTempSelectedValue] = useState({});
@@ -64,12 +65,12 @@ const RSOverview: React.FC = ({ type, defaultInputs }) => {
// [router]
// );
- const onDeleteClick = useCallback(
- (item: ItemsResult) => { },
- [router]
- );
+ // const onDeleteClick = useCallback(
+ // (item: ItemsResult) => { },
+ // [router]
+ // );
- const onDetailClick = (record: any) => {
+ const onDetailClick = (record: ProdScheduleResult) => {
console.log("[debug] record", record);
router.push(`/scheduling/rough/edit?id=${record.id}`);
}
@@ -127,7 +128,7 @@ const RSOverview: React.FC = ({ type, defaultInputs }) => {
schedulePeriod: dayjs(query?.schedulePeriod).isValid() ? query?.schedulePeriod : undefined,
schedulePeriodTo: dayjs(query?.schedulePeriodTo).isValid() ? query?.schedulePeriodTo : undefined,
totalEstProdCount: query?.totalEstProdCount ? Number(query?.totalEstProdCount) : undefined,
- type: "rough",
+ types: ["rough"],
pageNum: pagingController.pageNum - 1,
pageSize: pagingController.pageSize
}
diff --git a/src/components/RoughSchedule/RoughScheduleWrapper.tsx b/src/components/RoughSchedule/RoughScheduleWrapper.tsx
index 04e59bc..490e27c 100644
--- a/src/components/RoughSchedule/RoughScheduleWrapper.tsx
+++ b/src/components/RoughSchedule/RoughScheduleWrapper.tsx
@@ -2,13 +2,14 @@ import { fetchAllItems } from "@/app/api/settings/item";
import { RoughScheduleLoading } from "./RoughScheduleLoading";
import RSOverview from "./RoughSchedileSearchView";
import { SearchProdSchedule, fetchProdSchedules } from "@/app/api/scheduling/actions";
+import { ScheduleType } from "@/app/api/scheduling";
interface SubComponents {
Loading: typeof RoughScheduleLoading;
}
type Props = {
- type: SearchProdSchedule["type"]
+ type: ScheduleType
};
const RoughScheduleWrapper: React.FC & SubComponents = async (
@@ -18,7 +19,7 @@ const RoughScheduleWrapper: React.FC & SubComponents = async (
) => {
// console.log(type)
const defaultInputs: SearchProdSchedule = {
- type: "rough"
+ types: ["rough"]
}
// const [
diff --git a/src/components/ScheduleTable/BomMaterialTable.tsx b/src/components/ScheduleTable/BomMaterialTable.tsx
index e3fc4d8..fb2fe7d 100644
--- a/src/components/ScheduleTable/BomMaterialTable.tsx
+++ b/src/components/ScheduleTable/BomMaterialTable.tsx
@@ -36,14 +36,14 @@ import { useSearchParams } from "next/navigation";
import { decimalFormatter } from "@/app/utils/formatUtil";
import CheckCircleOutlineIcon from '@mui/icons-material/CheckCircleOutline';
import HighlightOffIcon from '@mui/icons-material/HighlightOff';
-import { ProdScheduleLineBomMaterialResult, ScheduleType } from "@/app/api/scheduling";
+import { RoughProdScheduleLineBomMaterialResult, ScheduleType } from "@/app/api/scheduling";
interface ResultWithId {
id: number;
}
interface Props {
- bomMaterial: ProdScheduleLineBomMaterialResult[];
+ bomMaterial: RoughProdScheduleLineBomMaterialResult[];
type: ScheduleType
}
diff --git a/src/components/ScheduleTable/ScheduleTable.tsx b/src/components/ScheduleTable/ScheduleTable.tsx
index 21ea100..ae0733b 100644
--- a/src/components/ScheduleTable/ScheduleTable.tsx
+++ b/src/components/ScheduleTable/ScheduleTable.tsx
@@ -23,7 +23,7 @@ import KeyboardArrowUpIcon from "@mui/icons-material/KeyboardArrowUp";
import { decimalFormatter, integerFormatter } from "@/app/utils/formatUtil";
import PlayCircleOutlineIcon from '@mui/icons-material/PlayCircleOutline';
import { useTranslation } from "react-i18next";
-import { ProdScheduleLineBomMaterialResult, ProdScheduleLineResultByFg, ProdScheduleResult, ScheduleType } from "@/app/api/scheduling";
+import { RoughProdScheduleLineBomMaterialResult, RoughProdScheduleLineResultByFg, RoughProdScheduleResult, ScheduleType } from "@/app/api/scheduling";
export interface ResultWithId {
id: string | number;
@@ -144,10 +144,10 @@ function ScheduleTable({
return type === "rough";
}
- function isDetailType(
+ function isDetailedType(
type: ScheduleType
- ): type is "detail" {
- return type === "detail";
+ ): type is "detailed" {
+ return type === "detailed";
}
function Row(props: { row: T }) {
@@ -157,7 +157,7 @@ function ScheduleTable({
return (
<>
- {isDetailType(type) &&
+ {isDetailedType(type) &&
@@ -167,12 +167,12 @@ function ScheduleTable({
{(editingRowId === row.id) ? (
<>
{
- isDetailType(type) && isEditable && handleSaveClick(row)}>
+ isDetailedType(type) && isEditable && handleSaveClick(row)}>
}
{
- isDetailType(type) && isEditable && setEditingRowId(null)}>
+ isDetailedType(type) && isEditable && setEditingRowId(null)}>
}
@@ -190,13 +190,13 @@ function ScheduleTable({
) : (
<>
{
- isDetailType(type) && isEditable && handleEditClick(row.id as number)}>
}
{
- isDetailType(type) && isEditable && handleDeleteClick(row.id as number)}>
@@ -278,7 +278,7 @@ function ScheduleTable({
@@ -298,7 +298,7 @@ function ScheduleTable({
- {isDetailType(type) && {t("Release")}}
+ {isDetailedType(type) && {t("Release")}}
{(isEditable || hasCollapse) && {t("Actions")}} {/* Action Column Header */}
{columns.map((column, idx) => (
diff --git a/src/components/SearchBox/SearchBox.tsx b/src/components/SearchBox/SearchBox.tsx
index d386fcf..cfa215c 100644
--- a/src/components/SearchBox/SearchBox.tsx
+++ b/src/components/SearchBox/SearchBox.tsx
@@ -196,7 +196,7 @@ function SearchBox({
{c.type === "text" && (
({
)}
{c.type === "multi-select" && (
({
)}
{c.type === "select" && (
- {c.label}
+ {t(c.label)}