From b54f6f03150dd78d86db62201b6386bf14b72394 Mon Sep 17 00:00:00 2001 From: dujinkim Date: Wed, 15 Oct 2025 12:52:11 +0000 Subject: (대표님) 커버, 데이터룸, 파일매니저, 담당자할당 등 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/cover/table/projects-table-columns.tsx | 187 +++++++++++++++++++++++++++++ 1 file changed, 187 insertions(+) create mode 100644 lib/cover/table/projects-table-columns.tsx (limited to 'lib/cover/table/projects-table-columns.tsx') diff --git a/lib/cover/table/projects-table-columns.tsx b/lib/cover/table/projects-table-columns.tsx new file mode 100644 index 00000000..9ed36436 --- /dev/null +++ b/lib/cover/table/projects-table-columns.tsx @@ -0,0 +1,187 @@ +"use client" + +import * as React from "react" +import { type DataTableRowAction } from "@/types/table" +import { type ColumnDef } from "@tanstack/react-table" +import { Download, Eye, FileText, FilePlus } from "lucide-react" +import { Checkbox } from "@/components/ui/checkbox"; + +import { formatDate } from "@/lib/utils" +import { Button } from "@/components/ui/button" +import { quickDownload } from "@/lib/file-download" + +import { DataTableColumnHeaderSimple } from "@/components/data-table/data-table-column-simple-header" +import { Project } from "@/db/schema" + +interface GetColumnsProps { + setRowAction: React.Dispatch | null>> + onDetailClick: (project: Project) => void + onTemplateManage: (project: Project) => void +} + +export function getColumns({ setRowAction, onDetailClick, onTemplateManage }: GetColumnsProps): ColumnDef[] { + return [ + // Checkbox + { + id: "select", + header: ({ table }) => ( + table.toggleAllPageRowsSelected(!!v)} + aria-label="select all" + className="translate-y-0.5" + /> + ), + cell: ({ row }) => ( + row.toggleSelected(!!v)} + aria-label="select row" + className="translate-y-0.5" + /> + ), + size: 40, + enableSorting: false, + enableHiding: false, + }, + { + accessorKey: "code", + enableResizing: true, + header: ({ column }) => ( + + ), + meta: { + excelHeader: "Project Code", + }, + }, + { + accessorKey: "name", + enableResizing: true, + header: ({ column }) => ( + + ), + meta: { + excelHeader: "Project Name", + }, + }, + { + id: "coverTemplate", + enableResizing: true, + header: "커버 템플릿", + cell: ({ row }) => { + const project = row.original + const hasTemplate = !!project.coverTemplatePath + + return ( +
+ {hasTemplate ? ( + <> + + + + ) : ( + + )} +
+ ) + }, + }, + { + id: "generatedCover", + enableResizing: true, + header: "생성된 커버", + cell: ({ row }) => { + const project = row.original + const hasGenerated = !!project.generatedCoverPath + const generatedAt = project.generatedCover?.generatedAt + + return ( +
+ {hasGenerated ? ( + <> + + {generatedAt && ( + + {formatDate(new Date(generatedAt), "KR")} + + )} + + ) : ( + - + )} +
+ ) + }, + }, + { + accessorKey: "OWN_NM", + enableResizing: true, + header: ({ column }) => ( + + ), + meta: { + excelHeader: "Owner Name", + }, + }, + { + accessorKey: "createdAt", + enableResizing: true, + header: ({ column }) => ( + + ), + meta: { + excelHeader: "Created At", + }, + cell: ({ cell }) => { + const dateVal = cell.getValue() as Date + return formatDate(dateVal, "KR") + }, + }, + { + accessorKey: "updatedAt", + enableResizing: true, + header: ({ column }) => ( + + ), + meta: { + excelHeader: "Updated At", + }, + cell: ({ cell }) => { + const dateVal = cell.getValue() as Date + return formatDate(dateVal, "KR") + }, + }, + ] +} \ No newline at end of file -- cgit v1.2.3