From 95bbe9c583ff841220da1267630e7b2025fc36dc Mon Sep 17 00:00:00 2001 From: dujinkim Date: Thu, 19 Jun 2025 09:44:28 +0000 Subject: (대표님) 20250619 1844 KST 작업사항 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../table/general-check-table-columns.tsx | 138 +++++++++++++++++++++ 1 file changed, 138 insertions(+) create mode 100644 lib/general-check-list/table/general-check-table-columns.tsx (limited to 'lib/general-check-list/table/general-check-table-columns.tsx') diff --git a/lib/general-check-list/table/general-check-table-columns.tsx b/lib/general-check-list/table/general-check-table-columns.tsx new file mode 100644 index 00000000..c764686d --- /dev/null +++ b/lib/general-check-list/table/general-check-table-columns.tsx @@ -0,0 +1,138 @@ +"use client"; +import * as React from "react"; +import { type ColumnDef } from "@tanstack/react-table"; +import { Checkbox } from "@/components/ui/checkbox"; +import { Badge } from "@/components/ui/badge"; +import { Button } from "@/components/ui/button"; +import { Ellipsis, Pencil, Trash } from "lucide-react"; +import { DataTableColumnHeaderSimple } from "@/components/data-table/data-table-column-simple-header"; +import { DeleteEvaluationsDialog } from "./delete-check-lists-dialog"; +import { EditEvaluationSheet } from "./update-check-list-sheet"; + + +export interface GeneralEvaluationRow { + id: number; + serialNumber: string; + category: string; + inspectionItem: string; + remarks: string | null; + isActive: boolean; + createdAt: Date; + updatedAt: Date; +} + +export function getGeneralEvaluationColumns(): 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, + }, + + // ░░░ Serial Number ░░░ + { + accessorKey: "serialNumber", + header: ({ column }) => , + cell: ({ row }) => row.getValue("serialNumber"), + size: 120, + }, + + // ░░░ Category ░░░ + { + accessorKey: "category", + header: ({ column }) => , + cell: ({ row }) => {row.getValue("category")}, + size: 120, + }, + + // ░░░ Inspection Item ░░░ + { + accessorKey: "inspectionItem", + header: ({ column }) => , + cell: ({ row }) => ( +
("inspectionItem")!}> + {row.getValue("inspectionItem") as string} +
+ ), + size: 300, + }, + + // ░░░ Remarks ░░░ + { + accessorKey: "remarks", + header: ({ column }) => , + cell: ({ row }) => row.getValue("remarks") ?? -, + size: 200, + }, + + // ░░░ 활성 ░░░ + { + accessorKey: "isActive", + header: ({ column }) => , + cell: ({ row }) => (row.getValue("isActive") ? 활성 : 비활성), + size: 80, + }, + + // ░░░ Actions ░░░ + { + id: "actions", + enableHiding: false, + size: 40, + minSize:80, + cell: ({ row }) => { + const record = row.original; + const [openEdit, setOpenEdit] = React.useState(false); + const [openDelete, setOpenDelete] = React.useState(false); + + return ( + <> + + + + + + + ); + }, + }, + ]; +} -- cgit v1.2.3