From 4eb7532f822c821fb6b69bf103bd075fefba769b Mon Sep 17 00:00:00 2001
From: dujinkim <dujin.kim@dtsolution.co.kr>
Date: Tue, 15 Jul 2025 10:07:09 +0000
Subject: (대표님) 20250715 협력사 정기평가, spreadJS, roles 서비스에 함수 추가
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 lib/roles/table/roles-table.tsx | 60 +++++++++++++++--------------------------
 1 file changed, 22 insertions(+), 38 deletions(-)

(limited to 'lib/roles/table/roles-table.tsx')

diff --git a/lib/roles/table/roles-table.tsx b/lib/roles/table/roles-table.tsx
index cd7c2a3b..3386d439 100644
--- a/lib/roles/table/roles-table.tsx
+++ b/lib/roles/table/roles-table.tsx
@@ -13,17 +13,15 @@ import { DataTable } from "@/components/data-table/data-table"
 import { DataTableAdvancedToolbar } from "@/components/data-table/data-table-advanced-toolbar"
 import { DataTableToolbar } from "@/components/data-table/data-table-toolbar"
 
-
 import { getRolesWithCount } from "@/lib/roles/services"
 import { getColumns } from "./roles-table-columns"
 import { RoleTableToolbarActions } from "./role-table-toolbar-actions"
 import { UpdateRolesSheet } from "./update-roles-sheet"
-import { AssignRolesSheet } from "./assign-roles-sheet"
+import { ManageRoleSheet } from "./assign-roles-sheet" // 업데이트된 컴포넌트
 import { getUsersAll } from "@/lib/users/service"
 import { DeleteRolesDialog } from "./delete-roles-dialog"
 import { RoleView } from "@/db/schema/users"
 
-
 interface RolesTableProps {
   promises: Promise<
     [
@@ -31,16 +29,15 @@ interface RolesTableProps {
     ]
   >
   promises2: Promise<
-  [
-    Awaited<ReturnType<typeof getUsersAll>>,
-  ]
->
+    [
+      Awaited<ReturnType<typeof getUsersAll>>,
+    ]
+  >
 }
 
-export function RolesTable({ promises ,promises2 }: RolesTableProps) {
+export function RolesTable({ promises, promises2 }: RolesTableProps) {
 
-  const [{ data, pageCount }] =
-    React.use(promises)
+  const [{ data, pageCount }] = React.use(promises)
 
   const [rowAction, setRowAction] =
     React.useState<DataTableRowAction<RoleView> | null>(null)
@@ -50,7 +47,6 @@ export function RolesTable({ promises ,promises2 }: RolesTableProps) {
     [setRowAction]
   )
 
-
   /**
    * This component can render either a faceted filter or a search filter based on the `options` prop.
    *
@@ -68,7 +64,6 @@ export function RolesTable({ promises ,promises2 }: RolesTableProps) {
       label: "Role Name",
       placeholder: "Filter role name...",
     },
-
   ]
 
   /**
@@ -87,19 +82,16 @@ export function RolesTable({ promises ,promises2 }: RolesTableProps) {
       label: "Role Name",
       type: "text",
     },
-
     {
       id: "domain",
       label: "룰 도메인",
       type: "text",
     },
-
     {
       id: "company_name",
       label: "회사명",
       type: "text",
     },
-
     {
       id: "created_at",
       label: "Created at",
@@ -107,7 +99,6 @@ export function RolesTable({ promises ,promises2 }: RolesTableProps) {
     },
   ]
 
-
   const { table } = useDataTable({
     data,
     columns,
@@ -126,10 +117,7 @@ export function RolesTable({ promises ,promises2 }: RolesTableProps) {
 
   return (
     <>
-      <DataTable
-        table={table}
-
-      >
+      <DataTable table={table}>
         <DataTableAdvancedToolbar
           table={table}
           filterFields={advancedFilterFields}
@@ -137,21 +125,21 @@ export function RolesTable({ promises ,promises2 }: RolesTableProps) {
         >
           <RoleTableToolbarActions table={table} />
         </DataTableAdvancedToolbar>
+      </DataTable>
 
-        </DataTable>
-
-        <UpdateRolesSheet
-          open={rowAction?.type === "update"}
-          onOpenChange={() => setRowAction(null)}
-          role={rowAction?.row.original ?? null}
-        />
+      <UpdateRolesSheet
+        open={rowAction?.type === "update"}
+        onOpenChange={() => setRowAction(null)}
+        role={rowAction?.row.original ?? null}
+      />
 
-        <AssignRolesSheet
-          open={rowAction?.type === "user"}
-          onOpenChange={() => setRowAction(null)}
-          role={rowAction?.row.original ?? null}
-          assignedTablePromises={promises2}
-        />
+      {/* 업데이트된 ManageRoleSheet - 모드 토글 지원 */}
+      <ManageRoleSheet
+        open={rowAction?.type === "user"}
+        allUsersPromises={promises2}
+        onOpenChange={() => setRowAction(null)}
+        role={rowAction?.row.original ?? null}
+      />
 
       <DeleteRolesDialog
         open={rowAction?.type === "delete"}
@@ -160,10 +148,6 @@ export function RolesTable({ promises ,promises2 }: RolesTableProps) {
         showTrigger={false}
         onSuccess={() => rowAction?.row.toggleSelected(false)}
       />
-
-
-
-
     </>
   )
-}
+}
\ No newline at end of file
-- 
cgit v1.2.3

