From c2672935caf9ce977840657cbff0da8af8e12f97 Mon Sep 17 00:00:00 2001
From: joonhoekim <26rote@gmail.com>
Date: Thu, 4 Sep 2025 02:49:48 +0000
Subject: (김준회) 기준정보-자재그룹 메뉴 구현 - 기준정보 메뉴를
 자재그룹코드(/material-groups)로 변경 - 기존 자재코드조회는 /materials 로
 남겨둠 - 메뉴를 자재그룹코드로만 남기고, i18n 처리
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../table/material-group-table-columns.tsx         | 61 ++++++++++++++++++++++
 1 file changed, 61 insertions(+)
 create mode 100644 lib/material-groups/table/material-group-table-columns.tsx

(limited to 'lib/material-groups/table/material-group-table-columns.tsx')

diff --git a/lib/material-groups/table/material-group-table-columns.tsx b/lib/material-groups/table/material-group-table-columns.tsx
new file mode 100644
index 00000000..90df720d
--- /dev/null
+++ b/lib/material-groups/table/material-group-table-columns.tsx
@@ -0,0 +1,61 @@
+"use client"
+
+import * as React from "react"
+import { type ColumnDef } from "@tanstack/react-table"
+
+import { DataTableColumnHeaderSimple } from "@/components/data-table/data-table-column-simple-header"
+
+// MaterialGroup 타입 정의 (서비스에서 반환되는 타입과 일치)
+type MaterialGroup = {
+  materialGroupCode: string | null;
+  materialName: string | null;
+  displayText: string | null;
+}
+
+/**
+ * MaterialGroup 테이블 컬럼 정의
+ */
+export function getColumns(): ColumnDef<MaterialGroup>[] {
+  // ----------------------------------------------------------------
+  // 데이터 컬럼들
+  // ----------------------------------------------------------------
+  const dataColumns: ColumnDef<MaterialGroup>[] = [
+    {
+      accessorKey: "materialGroupCode",
+      header: ({ column }) => (
+        <DataTableColumnHeaderSimple column={column} title="자재그룹코드" />
+      ),
+      cell: ({ row }) => {
+        const value = row.getValue("materialGroupCode") as string | null
+        return (
+          <div className="font-medium">
+            {value || "-"}
+          </div>
+        )
+      },
+      enableSorting: true,
+      enableHiding: false,
+    },
+    {
+      accessorKey: "materialName",
+      header: ({ column }) => (
+        <DataTableColumnHeaderSimple column={column} title="자재그룹명" />
+      ),
+      cell: ({ row }) => {
+        const value = row.getValue("materialName") as string | null
+        return (
+          <div className="max-w-[300px] truncate">
+            {value || "-"}
+          </div>
+        )
+      },
+      enableSorting: true,
+      enableHiding: false,
+    },
+  ]
+
+  // ----------------------------------------------------------------
+  // 최종 컬럼 배열
+  // ----------------------------------------------------------------
+  return dataColumns
+}
-- 
cgit v1.2.3

