test(front end): added in card test but removing
This commit is contained in:
50
frontend/src/components/logistics/warehouse/PPOOCard.tsx
Normal file
50
frontend/src/components/logistics/warehouse/PPOOCard.tsx
Normal file
@@ -0,0 +1,50 @@
|
||||
import { LstCard } from "@/components/extendedUI/LstCard";
|
||||
import { useCardStore } from "@/lib/store/useCardStore";
|
||||
import { getPPOO } from "@/utils/querys/logistics/getPPOO";
|
||||
import { columns } from "@/utils/tableData/ppoo/ppooColumns";
|
||||
import { PPOOTable } from "@/utils/tableData/ppoo/ppooData";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { CircleX } from "lucide-react";
|
||||
import { Suspense } from "react";
|
||||
import { toast } from "sonner";
|
||||
|
||||
export default function PPOO({ style = {} }) {
|
||||
const { removeCard } = useCardStore();
|
||||
const { data, isError, isLoading } = useQuery(getPPOO());
|
||||
|
||||
if (isLoading) return <div>Loading adjustmnet data...</div>;
|
||||
if (isError) {
|
||||
return (
|
||||
<div>
|
||||
<p>There was an error getting the adjustments.</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const handleCloseCard = () => {
|
||||
removeCard("PPOO");
|
||||
|
||||
toast.success("card removed");
|
||||
};
|
||||
return (
|
||||
<div style={style}>
|
||||
<LstCard style={style}>
|
||||
<Suspense fallback={<p>Loading PPOO...</p>}>
|
||||
<div className={`flex justify-center`}>
|
||||
<p
|
||||
className={`drag-handle w-fit`}
|
||||
style={{ cursor: "move", padding: "5px" }}
|
||||
>
|
||||
PPOO
|
||||
</p>
|
||||
|
||||
<button onClick={handleCloseCard}>
|
||||
<CircleX />
|
||||
</button>
|
||||
</div>
|
||||
<PPOOTable columns={columns} data={data} style={style} />
|
||||
</Suspense>
|
||||
</LstCard>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user