|
- import { fetchAllItems } from "@/app/api/settings/item";
- // import ItemsSearch from "./ItemsSearch";
- // import ItemsSearchLoading from "./ItemsSearchLoading";
- import { SearchParams } from "@/app/utils/fetchUtil";
- import { TypeEnum } from "@/app/utils/typeEnum";
- import { notFound } from "next/navigation";
- import PoSearchLoading from "./PoSearchLoading";
- import PoSearch from "./PoSearch";
- import { fetchPoList, PoResult } from "@/app/api/po";
- import dayjs from "dayjs";
- import arraySupport from "dayjs/plugin/arraySupport";
- import { OUTPUT_DATE_FORMAT } from "@/app/utils/formatUtil";
- import { fetchWarehouseList } from "@/app/api/warehouse";
- import { defaultPagingController } from "../SearchResults/SearchResults";
- dayjs.extend(arraySupport);
-
- interface SubComponents {
- Loading: typeof PoSearchLoading;
- }
-
- type Props = {
- // type: TypeEnum;
- };
-
- const PoSearchWrapper: React.FC<Props> & SubComponents = async (
- {
- // type,
- }
- ) => {
- // console.log(defaultPagingController)
- const [
- po,
- warehouse,
- ] = await Promise.all([
- fetchPoList({
- "pageNum": 1,
- "pageSize": 10,
- }),
- // fetchPoList(),
- fetchWarehouseList(),
- ]);
- const fixPoDate = po.records.map((p) => {
- return ({
- ...p,
- orderDate: dayjs(p.orderDate).add(-1, "month").format(OUTPUT_DATE_FORMAT)
- })
- })
- return <PoSearch po={fixPoDate} warehouse={warehouse} totalCount={po.total}/>;
- };
-
- PoSearchWrapper.Loading = PoSearchLoading;
-
- export default PoSearchWrapper;
|