FPSMS-frontend
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

10 місяці тому
10 місяці тому
10 місяці тому
10 місяці тому
10 місяці тому
10 місяці тому
10 місяці тому
10 місяці тому
10 місяці тому
10 місяці тому
10 місяці тому
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import { fetchAllItems } from "@/app/api/settings/item";
  2. // import ItemsSearch from "./ItemsSearch";
  3. // import ItemsSearchLoading from "./ItemsSearchLoading";
  4. import { SearchParams } from "@/app/utils/fetchUtil";
  5. import { TypeEnum } from "@/app/utils/typeEnum";
  6. import { notFound } from "next/navigation";
  7. import PoSearchLoading from "./PoSearchLoading";
  8. import PoSearch from "./PoSearch";
  9. import { fetchPoList, PoResult } from "@/app/api/po";
  10. import dayjs from "dayjs";
  11. import arraySupport from "dayjs/plugin/arraySupport";
  12. import { OUTPUT_DATE_FORMAT } from "@/app/utils/formatUtil";
  13. import { fetchWarehouseList } from "@/app/api/warehouse";
  14. import { defaultPagingController } from "../SearchResults/SearchResults";
  15. dayjs.extend(arraySupport);
  16. interface SubComponents {
  17. Loading: typeof PoSearchLoading;
  18. }
  19. type Props = {
  20. // type: TypeEnum;
  21. };
  22. const PoSearchWrapper: React.FC<Props> & SubComponents = async (
  23. {
  24. // type,
  25. },
  26. ) => {
  27. // console.log(defaultPagingController)
  28. const [po, warehouse] = await Promise.all([
  29. fetchPoList({
  30. pageNum: 1,
  31. pageSize: 10,
  32. }),
  33. // fetchPoList(),
  34. fetchWarehouseList(),
  35. ]);
  36. const fixPoDate = po.records.map((p) => {
  37. return {
  38. ...p,
  39. orderDate: dayjs(p.orderDate).add(-1, "month").format(OUTPUT_DATE_FORMAT),
  40. };
  41. });
  42. return (
  43. <PoSearch po={fixPoDate} warehouse={warehouse} totalCount={po.total} />
  44. );
  45. };
  46. PoSearchWrapper.Loading = PoSearchLoading;
  47. export default PoSearchWrapper;