diff --git a/frontend/app/(main)/admin/approvalBox/page.tsx b/frontend/app/(main)/admin/approvalBox/page.tsx index f0cd1438..1d2e11d5 100644 --- a/frontend/app/(main)/admin/approvalBox/page.tsx +++ b/frontend/app/(main)/admin/approvalBox/page.tsx @@ -254,22 +254,36 @@ function ReceivedTab() { const [processOpen, setProcessOpen] = useState(false); const [selectedLine, setSelectedLine] = useState(null); + const [selectedRequest, setSelectedRequest] = useState(null); + const [detailLoading, setDetailLoading] = useState(false); const [comment, setComment] = useState(""); const [isProcessing, setIsProcessing] = useState(false); const fetchPending = useCallback(async () => { setLoading(true); - const res = await getMyPendingApprovals(); - if (res.success && res.data) setPendingLines(res.data); + try { + const res = await getMyPendingApprovals(); + if (res.success && res.data) setPendingLines(res.data); + } catch { + setPendingLines([]); + } setLoading(false); }, []); useEffect(() => { fetchPending(); }, [fetchPending]); - const openProcess = (line: ApprovalLine) => { + const openProcess = async (line: ApprovalLine) => { setSelectedLine(line); + setSelectedRequest(null); setComment(""); setProcessOpen(true); + // 결재 상세 내용(결재선 포함) 비동기 로드 + if (line.request_id) { + setDetailLoading(true); + const res = await getApprovalRequest(line.request_id); + if (res.success && res.data) setSelectedRequest(res.data); + setDetailLoading(false); + } }; const handleProcess = async (action: "approved" | "rejected") => { @@ -342,14 +356,14 @@ function ReceivedTab() { {/* 결재 처리 모달 */} - + 결재 처리 {selectedLine?.title} -
+
요청자 @@ -359,18 +373,84 @@ function ReceivedTab() { 결재 단계

{selectedLine?.step_order}차 결재

+ {selectedLine?.target_table && ( +
+ 대상 테이블 +

{selectedLine.target_table}

+
+ )} +
+ 요청일 +

{formatDate(selectedLine?.request_created_at || selectedLine?.created_at)}

+
+ + {/* 결재선 상세 */} + {detailLoading ? ( +
+ + 결재선 로딩 중... +
+ ) : selectedRequest?.lines && selectedRequest.lines.length > 0 && ( +
+ 전체 결재선 +
+ {selectedRequest.lines + .sort((a, b) => a.step_order - b.step_order) + .map((line) => ( +
+
+ + {line.step_order}차 + + {line.approver_name || line.approver_id} + {line.approver_position && ( + ({line.approver_position}) + )} + {line.line_id === selectedLine?.line_id && ( + 내 차례 + )} +
+
+ + {line.processed_at && ( + {formatDate(line.processed_at)} + )} +
+
+ ))} +
+
+ )} + + {/* 의견 입력 */}
- +