summaryrefslogtreecommitdiff
path: root/lib/b-rfq/attachment/attachment-toolbar-action.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'lib/b-rfq/attachment/attachment-toolbar-action.tsx')
-rw-r--r--lib/b-rfq/attachment/attachment-toolbar-action.tsx60
1 files changed, 60 insertions, 0 deletions
diff --git a/lib/b-rfq/attachment/attachment-toolbar-action.tsx b/lib/b-rfq/attachment/attachment-toolbar-action.tsx
new file mode 100644
index 00000000..e078ea66
--- /dev/null
+++ b/lib/b-rfq/attachment/attachment-toolbar-action.tsx
@@ -0,0 +1,60 @@
+"use client"
+
+import * as React from "react"
+import { type Table } from "@tanstack/react-table"
+
+import { AddAttachmentDialog } from "./add-attachment-dialog"
+import { ConfirmDocumentsDialog } from "./confirm-documents-dialog"
+import { TbeRequestDialog } from "./tbe-request-dialog"
+import { DeleteAttachmentsDialog } from "./delete-attachment-dialog"
+
+interface RfqAttachmentsTableToolbarActionsProps {
+ table: Table<any>
+ rfqId: number
+}
+
+export function RfqAttachmentsTableToolbarActions({
+ table,
+ rfqId
+}: RfqAttachmentsTableToolbarActionsProps) {
+
+ // 선택된 행들 가져오기
+ const selectedRows = table.getFilteredSelectedRowModel().rows
+ const selectedAttachments = selectedRows.map((row) => row.original)
+ const selectedCount = selectedRows.length
+
+ return (
+ <div className="flex items-center gap-2">
+ {/** 선택된 로우가 있으면 삭제 다이얼로그 */}
+ {selectedCount > 0 && (
+ <DeleteAttachmentsDialog
+ attachments={selectedAttachments}
+ onSuccess={() => table.toggleAllRowsSelected(false)}
+ />
+ )}
+
+ {/** 새 첨부 추가 다이얼로그 */}
+ <AddAttachmentDialog rfqId={rfqId} />
+
+ {/** 문서 확정 다이얼로그 */}
+ <ConfirmDocumentsDialog
+ rfqId={rfqId}
+ onSuccess={() => {
+ // 성공 후 필요한 작업 (예: 페이지 새로고침)
+ window.location.reload()
+ }}
+ />
+
+ {/** TBE 요청 다이얼로그 (선택된 행이 있을 때만 활성화) */}
+ <TbeRequestDialog
+ rfqId={rfqId}
+ attachments={selectedAttachments}
+ onSuccess={() => {
+ // 선택 해제 및 페이지 새로고침
+ table.toggleAllRowsSelected(false)
+ window.location.reload()
+ }}
+ />
+ </div>
+ )
+} \ No newline at end of file