import { useState } from "react"; import type { ColumnDef } from "@tanstack/react-table"; import dayjs from "dayjs"; import type { GeneralverificationList } from "@/entities/statistics/model/general-verification-interface"; import { Button } from "@common/components"; import CopyDialog from "@/components/statistics/verification/generalVerification/CopyDialog"; import RegistDialog from "@/components/statistics/verification/generalVerification/RegistDialog"; export const getGeneralVerificationColumns = ( onUpdateSuccess?: () => void, options?: { mutationBlocked?: boolean; blockedMessage?: string | null }, ): ColumnDef[] => [ { id: "no", header: "NO", cell: ({ row, table }) => { const totalRows = table.getRowCount(); const { pageIndex, pageSize } = table.getState().pagination; return totalRows - (pageIndex * pageSize + row.index); }, }, { accessorKey: "trgtStatsNm", header: "통계항목", }, { accessorKey: "vrfcNm", header: "검증명", }, { accessorKey: "vrfcClsfNm", header: "검증 분류", }, { accessorKey: "useYn", header: "사용 여부", }, { accessorKey: "regDt", header: "등록일", cell: ({ row }) => { const date = dayjs(row.original.regDt); return date.format("YYYY-MM-DD"); }, }, { id: "copy", header: "복사", cell: ({ row }) => (
e.stopPropagation()}>
), }, { id: "actions", header: "관리", cell: ({ row }) => (
e.stopPropagation()}>
), }, ]; const GeneralVerificationManageButton = ({ vrfcSn, onSuccess, mutationBlocked, blockedMessage, }: { vrfcSn: number; onSuccess?: () => void; mutationBlocked?: boolean; blockedMessage?: string | null; }) => { const [dialogOpen, setDialogOpen] = useState(false); return ( ); }; const GeneralVerificationCopyButton = ({ row, onSuccess, mutationBlocked, blockedMessage, }: { row: GeneralverificationList; onSuccess?: () => void; mutationBlocked?: boolean; blockedMessage?: string | null; }) => { const [dialogOpen, setDialogOpen] = useState(false); if (mutationBlocked) { return ( ); } return ( ); };