@@ -1,3 +1,4 @@ | |||||
import { fetchEscalationCombo } from "@/app/api/user"; | |||||
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"; | ||||
@@ -22,6 +23,9 @@ const PoEdit: React.FC<Props> = async ({ searchParams }) => { | |||||
if (!id) { | if (!id) { | ||||
notFound(); | notFound(); | ||||
} | } | ||||
fetchEscalationCombo() | |||||
return ( | return ( | ||||
<> | <> | ||||
{/* <Typography variant="h4">{t("Create Material")}</Typography> */} | {/* <Typography variant="h4">{t("Create Material")}</Typography> */} | ||||
@@ -15,6 +15,11 @@ export interface PoResult { | |||||
estimatedArrivalDate: string; | estimatedArrivalDate: string; | ||||
completedDate: string; | completedDate: string; | ||||
itemDetail?: string; | itemDetail?: string; | ||||
itemCode?: string; | |||||
itemName?: string; | |||||
itemQty?: string; | |||||
itemSumAcceptedQty?: string; | |||||
itemUom?: string; | |||||
escalated: boolean; | escalated: boolean; | ||||
status: string; | status: string; | ||||
pol?: PurchaseOrderLine[]; | pol?: PurchaseOrderLine[]; | ||||
@@ -74,6 +79,7 @@ export interface StockInLine { | |||||
defaultWarehouseId: number; // id for now | defaultWarehouseId: number; // id for now | ||||
dnNo: string; | dnNo: string; | ||||
dnDate: number[]; | dnDate: number[]; | ||||
stockQty: number; | |||||
} | } | ||||
export const fetchPoList = cache(async (queryParams?: Record<string, any>) => { | export const fetchPoList = cache(async (queryParams?: Record<string, any>) => { | ||||
@@ -31,6 +31,15 @@ export type passwordRule = { | |||||
specialChar: boolean; | specialChar: boolean; | ||||
}; | }; | ||||
export interface EscalationCombo { | |||||
id: number; | |||||
value: number; | |||||
label: string; | |||||
name: string; | |||||
title: string; | |||||
department: string; | |||||
} | |||||
export const preloadUser = () => { | export const preloadUser = () => { | ||||
fetchUser(); | fetchUser(); | ||||
}; | }; | ||||
@@ -56,3 +65,9 @@ export const fetchPwRules = cache(async () => { | |||||
next: { tags: ["pwRule"] }, | next: { tags: ["pwRule"] }, | ||||
}); | }); | ||||
}); | }); | ||||
export const fetchEscalationCombo = cache(async () => { | |||||
return serverFetchJson<EscalationCombo>(`${BASE_API_URL}/user/escalation-combo`, { | |||||
next: { tags: ["escalationCombo"]} | |||||
}) | |||||
}) |
@@ -10,6 +10,7 @@ import PoDetail from "./PoDetail"; | |||||
import { QcItemWithChecks } from "@/app/api/qc"; | import { QcItemWithChecks } from "@/app/api/qc"; | ||||
import { fetchWarehouseList } from "@/app/api/warehouse"; | import { fetchWarehouseList } from "@/app/api/warehouse"; | ||||
import { fetchQcItemCheck } from "@/app/api/qc/actions"; | import { fetchQcItemCheck } from "@/app/api/qc/actions"; | ||||
import { fetchEscalationCombo } from "@/app/api/user"; | |||||
interface SubComponents { | interface SubComponents { | ||||
Loading: typeof PoDetailLoading; | Loading: typeof PoDetailLoading; | ||||
@@ -20,10 +21,16 @@ type Props = { | |||||
}; | }; | ||||
const PoDetailWrapper: React.FC<Props> & SubComponents = async ({ id }) => { | const PoDetailWrapper: React.FC<Props> & SubComponents = async ({ id }) => { | ||||
const [poWithStockInLine, warehouse, qc] = await Promise.all([ | |||||
const [ | |||||
poWithStockInLine, | |||||
warehouse, | |||||
qc, | |||||
escalationCombo | |||||
] = await Promise.all([ | |||||
fetchPoWithStockInLines(id), | fetchPoWithStockInLines(id), | ||||
fetchWarehouseList(), | fetchWarehouseList(), | ||||
fetchQcItemCheck(), | fetchQcItemCheck(), | ||||
fetchEscalationCombo(), | |||||
]); | ]); | ||||
// const poWithStockInLine = await fetchPoWithStockInLines(id) | // const poWithStockInLine = await fetchPoWithStockInLines(id) | ||||