FPSMS-frontend
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

PoSearchWrapper.tsx 1.5 KiB

il y a 6 mois
il y a 6 mois
il y a 6 mois
il y a 6 mois
il y a 6 mois
il y a 6 mois
il y a 6 mois
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;