From a3525f8bdfcf849cc1716fab81cb8facadbe9a8e Mon Sep 17 00:00:00 2001 From: dujinkim Date: Mon, 27 Oct 2025 10:03:06 +0000 Subject: (최겸) 구매 협력업체 관리(PQ/실사관리, 정기평가 협력업체 제출 상세 dialog 개발, MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pq/pq-criteria/pq-table-toolbar-actions.tsx | 48 ++++++++++++++++++------- 1 file changed, 35 insertions(+), 13 deletions(-) (limited to 'lib/pq/pq-criteria/pq-table-toolbar-actions.tsx') diff --git a/lib/pq/pq-criteria/pq-table-toolbar-actions.tsx b/lib/pq/pq-criteria/pq-table-toolbar-actions.tsx index f168b83d..cdc4f813 100644 --- a/lib/pq/pq-criteria/pq-table-toolbar-actions.tsx +++ b/lib/pq/pq-criteria/pq-table-toolbar-actions.tsx @@ -17,37 +17,59 @@ import { type Table } from "@tanstack/react-table" import { DeletePqsDialog } from "./delete-pqs-dialog" import { AddPqDialog } from "./add-pq-dialog" import { PqCriterias } from "@/db/schema/pq" +import { toast } from "sonner" // import { ImportPqButton } from "./import-pq-button" // import { exportPqTemplate } from "./pq-excel-template" interface PqTableToolbarActionsProps { table: Table pqListId: number + pqListInfo: Awaited> } export function PqTableToolbarActions({ table, - pqListId + pqListId, + pqListInfo }: PqTableToolbarActionsProps) { - // const [refreshKey, setRefreshKey] = React.useState(0) + // PQ 리스트가 ACTIVE 상태인지 확인 + const isActive = pqListInfo.success && pqListInfo.data.status === "ACTIVE"; - // // Import 성공 후 테이블 갱신 - // const handleImportSuccess = () => { - // setRefreshKey(prev => prev + 1) - // } + // ACTIVE 상태일 때 기능 제한 + const handleRestrictedAction = () => { + toast.error("활성화된 PQ 목록은 수정할 수 없습니다. 먼저 PQ 목록을 비활성화해주세요."); + }; return (
{table.getFilteredSelectedRowModel().rows.length > 0 ? ( - row.original)} - onSuccess={() => table.toggleAllRowsSelected(false)} - /> + isActive ? ( + + ) : ( + row.original)} + onSuccess={() => table.toggleAllRowsSelected(false)} + /> + ) ) : null} - + {isActive ? ( + + ) : ( + + )} {/* Import 버튼 */} {/*