blob: e078ea66fce0dee75d7f5b08d8302298e59f7ccc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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>
)
}
|