blob: 53798e5ffbb966972a60f19d92b32958fcd8f5c3 (
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
|
"use client"
import * as React from "react"
import { type Table } from "@tanstack/react-table"
import { Button } from "@/components/ui/button"
import { Input } from "@/components/ui/input"
import { DataTableViewOptions } from "@/components/data-table/data-table-view-options"
import { Plus, Download, Upload, Settings } from "lucide-react"
import { type ApprovalLine } from "../service"
import { CategoryManagementDialog } from "@/lib/approval-template/table/category-management-dialog"
interface ApprovalLineTableToolbarActionsProps {
table: Table<ApprovalLine>
onCreateLine: () => void
}
export function ApprovalLineTableToolbarActions({
table,
onCreateLine,
}: ApprovalLineTableToolbarActionsProps) {
const [showCategoryDialog, setShowCategoryDialog] = React.useState(false)
const isFiltered = table.getState().columnFilters.length > 0
return (
<div className="flex items-center justify-between">
<div className="flex flex-1 items-center space-x-2">
<Input
placeholder="결재선 검색..."
value={(table.getColumn("name")?.getFilterValue() as string) ?? ""}
onChange={(event) =>
table.getColumn("name")?.setFilterValue(event.target.value)
}
className="h-8 w-[150px] lg:w-[250px]"
/>
{isFiltered && (
<Button
variant="ghost"
onClick={() => table.resetColumnFilters()}
className="h-8 px-2 lg:px-3"
>
초기화
</Button>
)}
</div>
<div className="flex items-center space-x-2">
{/* 카테고리 관리 버튼 */}
<CategoryManagementDialog
open={showCategoryDialog}
onOpenChange={setShowCategoryDialog}
showTrigger={false}
/>
<Button
variant="outline"
size="sm"
onClick={() => setShowCategoryDialog(true)}
>
<Settings className="mr-2 h-4 w-4" />
카테고리 관리
</Button>
<Button
variant="outline"
size="sm"
className="ml-auto hidden h-8 lg:flex"
>
<Upload className="mr-2 h-4 w-4" />
가져오기
</Button>
<Button
variant="outline"
size="sm"
className="ml-auto hidden h-8 lg:flex"
>
<Download className="mr-2 h-4 w-4" />
내보내기
</Button>
<DataTableViewOptions table={table} />
<Button
variant="outline"
size="sm"
className="ml-auto h-8"
onClick={onCreateLine}
>
<Plus className="mr-2 h-4 w-4" />
결재선 생성
</Button>
</div>
</div>
)
}
|