From 95bbe9c583ff841220da1267630e7b2025fc36dc Mon Sep 17 00:00:00 2001
From: dujinkim <dujin.kim@dtsolution.co.kr>
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-list-table.tsx             | 63 ++++++++++++++++++++++
 1 file changed, 63 insertions(+)
 create mode 100644 lib/general-check-list/table/general-check-list-table.tsx

(limited to 'lib/general-check-list/table/general-check-list-table.tsx')

diff --git a/lib/general-check-list/table/general-check-list-table.tsx b/lib/general-check-list/table/general-check-list-table.tsx
new file mode 100644
index 00000000..34b39830
--- /dev/null
+++ b/lib/general-check-list/table/general-check-list-table.tsx
@@ -0,0 +1,63 @@
+"use client";
+import * as React from "react";
+import { useDataTable } from "@/hooks/use-data-table";
+import { DataTable } from "@/components/data-table/data-table";
+import { DataTableAdvancedToolbar } from "@/components/data-table/data-table-advanced-toolbar";
+import type { DataTableFilterField, DataTableAdvancedFilterField } from "@/types/table";
+import { getGeneralEvaluationColumns } from "./general-check-table-columns";
+import { CreateEvaluationDialog } from "./add-check-list-dialog";
+import { DeleteEvaluationsDialog } from "./delete-check-lists-dialog";
+import { getGeneralEvaluations } from "@/lib/general-check-list/service";
+
+
+interface EsgEvaluationsTableProps {
+    promises: Promise<
+      [
+        Awaited<ReturnType<typeof getGeneralEvaluations>>,
+      ] 
+    >
+  }
+
+export function GeneralEvaluationsTable({ promises }: EsgEvaluationsTableProps) {
+
+  const [{ data, pageCount }]= React.use(promises);
+  const columns = React.useMemo(() => getGeneralEvaluationColumns(), []);
+
+  // Filters (간단 예시)
+  const filterFields: DataTableFilterField<any>[] = [
+    { id: "serialNumber", label: "시리얼", placeholder: "시리얼 검색" },
+    { id: "category", label: "카테고리", placeholder: "카테고리" },
+  ];
+  const advFilterFields: DataTableAdvancedFilterField<any>[] = [
+    { id: "inspectionItem", label: "점검 항목", type: "text" },
+    { id: "remarks", label: "비고", type: "text" },
+  ];
+
+  const { table } = useDataTable({
+    data,
+    columns,
+    pageCount,
+    filterFields,
+    enableAdvancedFilter: true,
+    initialState: { sorting: [{ id: "createdAt", desc: true }], columnPinning: { right: ["actions"] } },
+    getRowId: (row) => row.id.toString(),
+    clearOnDefault: true,
+    shallow: false,
+  });
+
+  // Delete selected
+  const selectedRows = table.getFilteredSelectedRowModel().rows.map((r) => r.original);
+
+  return (
+    <div className="space-y-6">
+      <DataTable table={table} className="h-full">
+        <DataTableAdvancedToolbar table={table} filterFields={advFilterFields} shallow={false}>
+          <CreateEvaluationDialog />
+          {selectedRows.length > 0 && (
+            <DeleteEvaluationsDialog evaluations={selectedRows} />
+          )}
+        </DataTableAdvancedToolbar>
+      </DataTable>
+    </div>
+  );
+}
-- 
cgit v1.2.3

