Files
frontend/apps/wr/components/ui/table/chkgdTable/guideDetailTable/guideDetailTable.tsx
T
2025-07-03 20:22:19 +09:00

59 lines
1.4 KiB
TypeScript

"use client";
import { headMakeprfmnc } from "@/app/ruseFcltMng/prfmncReg/chkgdnReg/TableHead";
import { useWrStore } from "@/app/store";
import type { TableUpperProps } from "@/app/store/common/type/header";
import type {
} from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn";
import type { chHeadType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList";
import { InputTableBody } from "@/components/lib/func/TableData";
import {
Input,
Table,
TableBody,
TableCell,
TableHeader,
TableRow,
} from "@common/components/ui";
import { useEffect, useState, type Dispatch, type SetStateAction } from "react";
export function GuideDetailsTable({
chgRes,
headList,
upheadList,
type,
setChGuidData,
}: {
chgRes: any[];
headList: TableUpperProps[];
upheadList:chHeadType[]
type: string;
setChGuidData: (chgRes: any[]) => void;
}) {
const { code, rainChkgdn } = useWrStore((state) => state);
const [inputData, setInputData] = useState<any[]>();
useEffect(() => {
setInputData(chgRes);
}, [chgRes]);
useEffect(() => {
setChGuidData(inputData??[] );
}, [inputData]);
return (
<>
<div className={`card !m-[1.2rem] !p-0r `}>
<Table variant="secondary">
<TableHeader className="font-bold">{headMakeprfmnc(headList, upheadList)}</TableHeader>
<TableBody >
{InputTableBody(inputData ?? [],headList, setInputData) }
</TableBody>
</Table>
</div>
</>
);
}