차량 관리 (신규): - VehicleList/VehicleDetail: 차량 목록/상세 - ForkliftList/ForkliftDetail: 지게차 목록/상세 - VehicleLogList/VehicleLogDetail: 운행일지 목록/상세 - 관련 페이지 라우트 추가 (/vehicle-management/*) CEO 대시보드: - Enhanced 섹션 컴포넌트 적용 (아이콘 + 컬러 테마) - EnhancedStatusBoardSection, EnhancedDailyReportSection, EnhancedMonthlyExpenseSection - TodayIssueSection 개선 IntegratedDetailTemplate: - FieldInput, FieldRenderer 기능 확장 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
53 lines
1.5 KiB
TypeScript
53 lines
1.5 KiB
TypeScript
'use client';
|
|
|
|
/**
|
|
* 차량일지 상세 페이지
|
|
*/
|
|
|
|
import { useEffect, useState } from 'react';
|
|
import { useParams } from 'next/navigation';
|
|
import { VehicleLogDetail } from '@/components/vehicle-management/VehicleLogDetail';
|
|
import { getVehicleLogById } from '@/components/vehicle-management/VehicleLogList/actions';
|
|
import type { VehicleLog } from '@/components/vehicle-management/types';
|
|
|
|
export default function VehicleLogDetailPage() {
|
|
const params = useParams();
|
|
const id = params.id as string;
|
|
|
|
const [data, setData] = useState<VehicleLog | null>(null);
|
|
const [isLoading, setIsLoading] = useState(true);
|
|
const [error, setError] = useState<string | null>(null);
|
|
|
|
useEffect(() => {
|
|
if (!id) return;
|
|
|
|
getVehicleLogById(id)
|
|
.then((result) => {
|
|
if (result.success && result.data) {
|
|
setData(result.data);
|
|
} else {
|
|
setError(result.error || '데이터를 불러올 수 없습니다.');
|
|
}
|
|
})
|
|
.finally(() => setIsLoading(false));
|
|
}, [id]);
|
|
|
|
if (isLoading) {
|
|
return (
|
|
<div className="flex items-center justify-center min-h-[400px]">
|
|
<div className="text-muted-foreground">로딩 중...</div>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
if (error || !data) {
|
|
return (
|
|
<div className="flex items-center justify-center min-h-[400px]">
|
|
<div className="text-red-500">{error || '차량일지를 찾을 수 없습니다.'}</div>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
return <VehicleLogDetail mode="view" initialData={data} id={id} />;
|
|
}
|