diff --git a/frontend/src/pages/AccessConsolePage.tsx b/frontend/src/pages/AccessConsolePage.tsx index bb1c56f..ee415c9 100644 --- a/frontend/src/pages/AccessConsolePage.tsx +++ b/frontend/src/pages/AccessConsolePage.tsx @@ -21,7 +21,7 @@ function accessBadge(record: AccessRecord): { className: string; label: string } } const status = record.status ?? 'APPROVED'; if (status === 'APPROVED') { - return { className: 'amber', label: '입장대기' }; + return { className: STATUS_CLASS.APPROVED, label: STATUS_LABEL.APPROVED }; } return { className: STATUS_CLASS[status], label: STATUS_LABEL[status] }; } @@ -146,7 +146,7 @@ export const AccessConsolePage: React.FC = () => { 금일완료 ) : ( - 입장대기 + {STATUS_LABEL.APPROVED} + ) : r.status === 'APPROVED' && !hasExitedToday(r) ? ( + + ) : ( + '-' )} diff --git a/frontend/src/pages/ApprovalQueuePage.tsx b/frontend/src/pages/ApprovalQueuePage.tsx index 5af4525..3983b87 100644 --- a/frontend/src/pages/ApprovalQueuePage.tsx +++ b/frontend/src/pages/ApprovalQueuePage.tsx @@ -5,6 +5,7 @@ import { formatVisitRange } from '../status'; import { Dialog } from '../components/Dialog'; type SortKey = 'visitorName' | 'company' | 'zoneName' | 'purpose' | 'visitFrom'; +type BusyAction = 'approve' | 'reject'; const COLUMNS: { key: SortKey; label: string }[] = [ { key: 'visitorName', label: '방문자' }, @@ -18,7 +19,7 @@ export const ApprovalQueuePage: React.FC = () => { const [items, setItems] = useState([]); const [error, setError] = useState(null); const [loading, setLoading] = useState(true); - const [busyId, setBusyId] = useState(null); + const [busyAction, setBusyAction] = useState<{ id: number; action: BusyAction } | null>(null); const [sortKey, setSortKey] = useState(null); const [sortDir, setSortDir] = useState<'asc' | 'desc'>('asc'); const [rejectingId, setRejectingId] = useState(null); @@ -56,14 +57,14 @@ export const ApprovalQueuePage: React.FC = () => { const approve = async (id: number) => { setError(null); - setBusyId(id); + setBusyAction({ id, action: 'approve' }); try { await approveRequest(id); load(); } catch (e) { setError(e instanceof Error ? e.message : '처리 실패'); } finally { - setBusyId(null); + setBusyAction(null); } }; @@ -72,14 +73,14 @@ export const ApprovalQueuePage: React.FC = () => { setRejectingId(null); if (id == null) return; setError(null); - setBusyId(id); + setBusyAction({ id, action: 'reject' }); try { await rejectRequest(id, comment); load(); } catch (e) { setError(e instanceof Error ? e.message : '처리 실패'); } finally { - setBusyId(null); + setBusyAction(null); } }; @@ -119,8 +120,26 @@ export const ApprovalQueuePage: React.FC = () => { {r.purpose} {formatVisitRange(r.visitFrom, r.visitTo)} - - + + ))}