blob: 981659d54795b77c5823f6a6464080fc4d6ff249 (
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
// initial-rfq-detail-toolbar-actions.tsx
"use client"
import * as React from "react"
import { type Table } from "@tanstack/react-table"
import { Button } from "@/components/ui/button"
import {
Download,
Mail,
RefreshCw,
Settings,
Trash2,
FileText
} from "lucide-react"
interface InitialRfqDetailTableToolbarActionsProps {
table: Table<any>
rfqId?: number
}
export function InitialRfqDetailTableToolbarActions({
table,
rfqId
}: InitialRfqDetailTableToolbarActionsProps) {
// 선택된 행들 가져오기
const selectedRows = table.getFilteredSelectedRowModel().rows
const selectedDetails = selectedRows.map((row) => row.original)
const selectedCount = selectedRows.length
const handleBulkEmail = () => {
console.log("Bulk email to selected vendors:", selectedDetails)
// 벌크 이메일 로직 구현
}
const handleBulkDelete = () => {
console.log("Bulk delete selected items:", selectedDetails)
// 벌크 삭제 로직 구현
table.toggleAllRowsSelected(false)
}
const handleExport = () => {
console.log("Export data:", selectedCount > 0 ? selectedDetails : "all data")
// 데이터 엑스포트 로직 구현
}
const handleRefresh = () => {
window.location.reload()
}
return (
<div className="flex items-center gap-2">
{/** 선택된 항목이 있을 때만 표시되는 액션들 */}
{selectedCount > 0 && (
<>
<Button
variant="outline"
size="sm"
onClick={handleBulkEmail}
className="h-8"
>
<Mail className="mr-2 h-4 w-4" />
이메일 발송 ({selectedCount})
</Button>
<Button
variant="outline"
size="sm"
onClick={handleBulkDelete}
className="h-8 text-red-600 hover:text-red-700"
>
<Trash2 className="mr-2 h-4 w-4" />
삭제 ({selectedCount})
</Button>
</>
)}
{/** 항상 표시되는 액션들 */}
<Button
variant="outline"
size="sm"
onClick={handleExport}
className="h-8"
>
<Download className="mr-2 h-4 w-4" />
엑스포트
</Button>
<Button
variant="outline"
size="sm"
onClick={handleRefresh}
className="h-8"
>
<RefreshCw className="mr-2 h-4 w-4" />
새로고침
</Button>
<Button
variant="outline"
size="sm"
className="h-8"
>
<Settings className="mr-2 h-4 w-4" />
설정
</Button>
</div>
)
}
|