Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/app/companies/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export default function CompaniesPage() {
<div className="flex justify-between items-center mb-8">
<PageHeader
title="업체 정보"
description="위카 주식회사 정보와 직원 목록을 관리합니다"
description="회사 정보와 직원 목록을 관리합니다"
/>

<div className="hidden md:flex space-x-2">
Expand Down
6 changes: 6 additions & 0 deletions src/app/dashboard/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,7 @@ export default function DashboardPage() {
},
ticks: {
color: currentTheme.mode === 'dark' ? 'rgba(255, 255, 255, 0.7)' : 'rgba(0, 0, 0, 0.7)',
callback: (value) => `${Number(value).toLocaleString()} km`
},
},
x: {
Expand All @@ -474,6 +475,11 @@ export default function DashboardPage() {
legend: {
display: false,
},
tooltip: {
callbacks: {
label: (context) => `${Number(context.raw).toLocaleString()} km`
}
}
},
}}
/>
Expand Down
2 changes: 2 additions & 0 deletions src/components/layout/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
MapIcon,
ChevronLeftIcon,
ChevronRightIcon,
ChartBarIcon,
} from "@heroicons/react/24/outline";
import { useTheme, themes } from "@/contexts/ThemeContext";
import { useAuthStore } from "@/lib/authStore";
Expand All @@ -25,6 +26,7 @@ const navigation = [
{ name: "차량", href: "/vehicles", icon: TruckIcon },
{ name: "운행일지", href: "/logs", icon: ClipboardDocumentListIcon },
{ name: "실시간 관제", href: "/monitoring", icon: MapIcon },
{ name: "분석", href: "/statistics", icon: ChartBarIcon },
{ name: "회사", href: "/companies", icon: BuildingOfficeIcon },
];

Expand Down
32 changes: 12 additions & 20 deletions src/lib/carLogsStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,37 +97,29 @@ export const useCarLogsStore = create<CarLogsState>((set, get) => ({
const endDate = params?.endDate !== undefined ? params.endDate : currentFilter.endDate;
const driveType = params?.driveType !== undefined ? params.driveType : currentFilter.driveType;

const requestBody: Record<string, any> = {};
// 쿼리 파라미터 구성
const queryParams = new URLSearchParams();
queryParams.append('page', page.toString());
queryParams.append('size', size.toString());

if (vehicleNumber) {
requestBody.mdn = vehicleNumber;
queryParams.append('mdn', vehicleNumber);
}

if (startDate) {
const formattedStartDate = new Date(startDate);
formattedStartDate.setHours(0, 0, 0, 0);

// 한국 시간대로 변환 (UTC+9)
const koreaTimeString = formatToKoreaTime(formattedStartDate, true);
requestBody.startTime = koreaTimeString;
queryParams.append('from', startDate);
}

if (endDate) {
const formattedEndDate = new Date(endDate);
formattedEndDate.setHours(23, 59, 59, 999);

// 한국 시간대로 변환 (UTC+9)
const koreaTimeString = formatToKoreaTime(formattedEndDate, false);
requestBody.endTime = koreaTimeString;
queryParams.append('to', endDate);
}

if (driveType) {
requestBody.driveType = driveType;
queryParams.append('driveType', driveType);
}

const data = await fetchApi<{data: any, message: string, statusCode: number}>(`/api/carLogs?page=${page}&size=${size}`, undefined, {
method: 'POST',
body: JSON.stringify(requestBody)
const data = await fetchApi<{data: any, message: string, statusCode: number}>(`/api/carLogs?${queryParams.toString()}`, undefined, {
method: 'GET'
});

// 새로운 API 응답 형식 처리 (data 필드에 실제 데이터가 있음)
Expand Down Expand Up @@ -180,14 +172,14 @@ export const useCarLogsStore = create<CarLogsState>((set, get) => ({
method: 'GET'
});

// 새로운 API 응답 형식 처리 (data 필드에 실제 데이터가 있음)
// 새로운 API 응답 형식 처리
const data = response.data || response;

set({
stats: {
totalMileage: data.totalMileage || 0,
carLogsCount: data.carLogsCount || "0",
monthlyMileages: data.monthlyMileages || []
monthlyMileages: Array.isArray(data) ? data : []
},
isLoading: false
});
Expand Down