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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
|
'use client'
import { useState } from 'react';
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
import { Badge } from '@/components/ui/badge';
import { Separator } from '@/components/ui/separator';
import { FileText, Eye, XCircle, List, History, Settings } from 'lucide-react';
// 결재 컴포넌트들
import ApprovalSubmit from './ApprovalSubmit';
import ApprovalDetail from './ApprovalDetail';
import ApprovalCancel from './ApprovalCancel';
import ApprovalList from './ApprovalList';
interface ApprovalManagerProps {
defaultTab?: string;
}
export default function ApprovalManager({
defaultTab = 'submit'
}: ApprovalManagerProps) {
const [currentTab, setCurrentTab] = useState(defaultTab);
const [selectedApInfId, setSelectedApInfId] = useState<string>('');
const handleSubmitSuccess = (apInfId: string) => {
setSelectedApInfId(apInfId);
setCurrentTab('detail');
};
const handleCancelSuccess = (apInfId: string) => {
setSelectedApInfId(apInfId);
setCurrentTab('detail');
};
const handleListItemClick = (apInfId: string) => {
setSelectedApInfId(apInfId);
setCurrentTab('detail');
};
return (
<div className="w-full max-w-5xl mx-auto space-y-6">
{/* 헤더 */}
<Card>
<CardHeader>
<CardTitle className="flex items-center gap-2">
<FileText className="w-6 h-6" />
Knox 결재 시스템
</CardTitle>
<CardDescription>
결재 상신, 조회, 취소 등 모든 결재 업무를 관리할 수 있습니다.
</CardDescription>
</CardHeader>
<CardContent>
<div className="flex items-center justify-between">
{/* 좌측 영역 - 현재는 테스트 모드 UI 제거로 여백 유지 */}
<div />
{process.env.NEXT_PUBLIC_KNOX_SYSTEM_ID && (
<div className="flex items-center gap-2 text-sm text-gray-500">
<span>시스템 ID:</span>
<Badge variant="outline">{process.env.NEXT_PUBLIC_KNOX_SYSTEM_ID}</Badge>
</div>
)}
</div>
</CardContent>
</Card>
{/* 메인 탭 */}
<Tabs value={currentTab} onValueChange={setCurrentTab} className="w-full">
<TabsList className="grid w-full grid-cols-5">
<TabsTrigger value="submit" className="flex items-center gap-2">
<FileText className="w-4 h-4" />
상신
</TabsTrigger>
<TabsTrigger value="detail" className="flex items-center gap-2">
<Eye className="w-4 h-4" />
상세조회
</TabsTrigger>
<TabsTrigger value="cancel" className="flex items-center gap-2">
<XCircle className="w-4 h-4" />
취소
</TabsTrigger>
<TabsTrigger value="list" className="flex items-center gap-2">
<List className="w-4 h-4" />
상신함
</TabsTrigger>
<TabsTrigger value="history" className="flex items-center gap-2">
<History className="w-4 h-4" />
이력
</TabsTrigger>
</TabsList>
{/* 결재 상신 탭 */}
<TabsContent value="submit" className="space-y-6">
<div className="w-full">
<ApprovalSubmit onSubmitSuccess={handleSubmitSuccess} />
</div>
</TabsContent>
{/* 결재 상세 조회 탭 */}
<TabsContent value="detail" className="space-y-6">
<div className="w-full">
<ApprovalDetail initialApInfId={selectedApInfId} />
</div>
</TabsContent>
{/* 결재 취소 탭 */}
<TabsContent value="cancel" className="space-y-6">
<div className="w-full">
<ApprovalCancel
initialApInfId={selectedApInfId}
onCancelSuccess={handleCancelSuccess}
/>
</div>
</TabsContent>
{/* 상신함 탭 */}
<TabsContent value="list" className="space-y-6">
<div className="w-full">
<ApprovalList
type="submission"
onItemClick={handleListItemClick}
/>
</div>
</TabsContent>
{/* 결재 이력 탭 */}
<TabsContent value="history" className="space-y-6">
<div className="w-full">
<ApprovalList
type="history"
onItemClick={handleListItemClick}
/>
</div>
</TabsContent>
</Tabs>
{/* 하단 정보 */}
<Card>
<CardContent className="pt-6">
<div className="flex items-center justify-between text-sm text-gray-500">
<div className="flex items-center gap-4">
<div className="flex items-center gap-2">
<Settings className="w-4 h-4" />
<span>Knox API 결재 시스템</span>
</div>
<Separator orientation="vertical" className="h-4" />
<div>
Next.js 15 + shadcn/ui + TypeScript
</div>
</div>
<div className="flex items-center gap-2">
<span>버전:</span>
<Badge variant="outline">v1.0.0</Badge>
</div>
</div>
</CardContent>
</Card>
</div>
);
}
|