diff options
Diffstat (limited to 'lib/rfq-last/table/rfq-table-columns.tsx')
| -rw-r--r-- | lib/rfq-last/table/rfq-table-columns.tsx | 73 |
1 files changed, 37 insertions, 36 deletions
diff --git a/lib/rfq-last/table/rfq-table-columns.tsx b/lib/rfq-last/table/rfq-table-columns.tsx index 5f5efcb4..eaf00660 100644 --- a/lib/rfq-last/table/rfq-table-columns.tsx +++ b/lib/rfq-last/table/rfq-table-columns.tsx @@ -18,6 +18,7 @@ import { DataTableRowAction } from "@/types/table"; import { format, differenceInDays } from "date-fns"; import { ko } from "date-fns/locale"; import { useRouter } from "next/navigation"; +import { RfqSealToggleCell } from "./rfq-seal-toggle-cell"; type NextRouter = ReturnType<typeof useRouter>; @@ -120,18 +121,18 @@ export function getRfqColumns({ { accessorKey: "rfqSealedYn", header: ({ column }) => <DataTableColumnHeaderSimple column={column} title="견적 밀봉" />, - cell: ({ row }) => { - const isSealed = row.original.rfqSealedYn; - return ( - <div className="flex justify-center"> - {isSealed ? ( - <Lock className="h-4 w-4 text-red-500" /> - ) : ( - <LockOpen className="h-4 w-4 text-gray-400" /> - )} - </div> - ); - }, + cell: ({ row, table }) => ( + <RfqSealToggleCell + rfqId={row.original.id} + isSealed={row.original.rfqSealedYn} + onUpdate={() => { + // 테이블 데이터를 새로고침하는 로직 + // 이 부분은 상위 컴포넌트에서 refreshData 함수를 prop으로 전달받아 사용 + const meta = table.options.meta as any; + meta?.refreshData?.(); + }} + /> + ), size: 80, }, @@ -453,18 +454,18 @@ export function getRfqColumns({ { accessorKey: "rfqSealedYn", header: ({ column }) => <DataTableColumnHeaderSimple column={column} title="견적 밀봉" />, - cell: ({ row }) => { - const isSealed = row.original.rfqSealedYn; - return ( - <div className="flex justify-center"> - {isSealed ? ( - <Lock className="h-4 w-4 text-red-500" /> - ) : ( - <LockOpen className="h-4 w-4 text-gray-400" /> - )} - </div> - ); - }, + cell: ({ row, table }) => ( + <RfqSealToggleCell + rfqId={row.original.id} + isSealed={row.original.rfqSealedYn} + onUpdate={() => { + // 테이블 데이터를 새로고침하는 로직 + // 이 부분은 상위 컴포넌트에서 refreshData 함수를 prop으로 전달받아 사용 + const meta = table.options.meta as any; + meta?.refreshData?.(); + }} + /> + ), size: 80, }, @@ -815,18 +816,18 @@ export function getRfqColumns({ { accessorKey: "rfqSealedYn", header: ({ column }) => <DataTableColumnHeaderSimple column={column} title="견적 밀봉" />, - cell: ({ row }) => { - const isSealed = row.original.rfqSealedYn; - return ( - <div className="flex justify-center"> - {isSealed ? ( - <Lock className="h-4 w-4 text-red-500" /> - ) : ( - <LockOpen className="h-4 w-4 text-gray-400" /> - )} - </div> - ); - }, + cell: ({ row, table }) => ( + <RfqSealToggleCell + rfqId={row.original.id} + isSealed={row.original.rfqSealedYn} + onUpdate={() => { + // 테이블 데이터를 새로고침하는 로직 + // 이 부분은 상위 컴포넌트에서 refreshData 함수를 prop으로 전달받아 사용 + const meta = table.options.meta as any; + meta?.refreshData?.(); + }} + /> + ), size: 80, }, |
