From 35d02607326187f4a64025e48da78fd83d9feb21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=B3=B4=EA=B3=A4?= Date: Tue, 3 Feb 2026 13:27:56 +0900 Subject: [PATCH] =?UTF-8?q?feat:=EC=B0=A8=EB=9F=89=EC=9D=BC=EC=A7=80=20?= =?UTF-8?q?=EA=B5=AC=EB=B6=84=20=EC=9C=A0=ED=98=95=20=ED=99=95=EC=9E=A5=20?= =?UTF-8?q?=EB=B0=8F=20=EB=9D=BC=EB=B2=A8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 구분 유형 추가: 출퇴근용(왕복), 업무용(왕복), 비업무용(왕복) - 비업무 라벨을 '비업무용(개인)'으로 변경 - 출발지/도착지 장소명 라벨 수정 (장소명 → 출발지명/도착지명) - 새 유형별 색상 추가 Co-Authored-By: Claude --- .../Controllers/Finance/VehicleLogController.php | 12 ++++++------ app/Models/VehicleLog.php | 8 +++++++- resources/views/finance/vehicle-logs.blade.php | 11 +++++++---- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/app/Http/Controllers/Finance/VehicleLogController.php b/app/Http/Controllers/Finance/VehicleLogController.php index 0963376f..3f745284 100644 --- a/app/Http/Controllers/Finance/VehicleLogController.php +++ b/app/Http/Controllers/Finance/VehicleLogController.php @@ -66,8 +66,8 @@ public function list(Request $request): JsonResponse // 월별 합계 $totals = [ - 'business_km' => $logs->whereIn('trip_type', ['commute_to', 'commute_from', 'business'])->sum('distance_km'), - 'personal_km' => $logs->where('trip_type', 'personal')->sum('distance_km'), + 'business_km' => $logs->whereIn('trip_type', ['commute_to', 'commute_from', 'business', 'commute_round', 'business_round'])->sum('distance_km'), + 'personal_km' => $logs->whereIn('trip_type', ['personal', 'personal_round'])->sum('distance_km'), 'total_km' => $logs->sum('distance_km'), ]; @@ -90,7 +90,7 @@ public function store(Request $request): JsonResponse 'vehicle_id' => 'required|integer|exists:corporate_vehicles,id', 'log_date' => 'required|date', 'driver_name' => 'required|string|max:50', - 'trip_type' => 'required|in:commute_to,commute_from,business,personal', + 'trip_type' => 'required|in:commute_to,commute_from,business,personal,commute_round,business_round,personal_round', 'distance_km' => 'required|integer|min:0', ]); @@ -131,7 +131,7 @@ public function update(Request $request, int $id): JsonResponse $request->validate([ 'log_date' => 'required|date', 'driver_name' => 'required|string|max:50', - 'trip_type' => 'required|in:commute_to,commute_from,business,personal', + 'trip_type' => 'required|in:commute_to,commute_from,business,personal,commute_round,business_round,personal_round', 'distance_km' => 'required|integer|min:0', ]); @@ -234,8 +234,8 @@ public function export(Request $request): StreamedResponse } // 합계 - $businessKm = $logs->whereIn('trip_type', ['commute_to', 'commute_from', 'business'])->sum('distance_km'); - $personalKm = $logs->where('trip_type', 'personal')->sum('distance_km'); + $businessKm = $logs->whereIn('trip_type', ['commute_to', 'commute_from', 'business', 'commute_round', 'business_round'])->sum('distance_km'); + $personalKm = $logs->whereIn('trip_type', ['personal', 'personal_round'])->sum('distance_km'); $totalKm = $logs->sum('distance_km'); $sheet->setCellValue('A' . $row, '합계'); diff --git a/app/Models/VehicleLog.php b/app/Models/VehicleLog.php index d9aeba0e..ded7a901 100644 --- a/app/Models/VehicleLog.php +++ b/app/Models/VehicleLog.php @@ -37,6 +37,9 @@ class VehicleLog extends Model public const TRIP_TYPE_COMMUTE_FROM = 'commute_from'; public const TRIP_TYPE_BUSINESS = 'business'; public const TRIP_TYPE_PERSONAL = 'personal'; + public const TRIP_TYPE_COMMUTE_ROUND = 'commute_round'; + public const TRIP_TYPE_BUSINESS_ROUND = 'business_round'; + public const TRIP_TYPE_PERSONAL_ROUND = 'personal_round'; // location_type 상수 public const LOCATION_TYPE_HOME = 'home'; @@ -50,7 +53,10 @@ public static function tripTypeLabels(): array self::TRIP_TYPE_COMMUTE_TO => '출근용', self::TRIP_TYPE_COMMUTE_FROM => '퇴근용', self::TRIP_TYPE_BUSINESS => '업무용', - self::TRIP_TYPE_PERSONAL => '비업무', + self::TRIP_TYPE_PERSONAL => '비업무용(개인)', + self::TRIP_TYPE_COMMUTE_ROUND => '출퇴근용(왕복)', + self::TRIP_TYPE_BUSINESS_ROUND => '업무용(왕복)', + self::TRIP_TYPE_PERSONAL_ROUND => '비업무용(왕복)', ]; } diff --git a/resources/views/finance/vehicle-logs.blade.php b/resources/views/finance/vehicle-logs.blade.php index 8e1bb38b..0342f694 100644 --- a/resources/views/finance/vehicle-logs.blade.php +++ b/resources/views/finance/vehicle-logs.blade.php @@ -313,6 +313,9 @@ function VehicleLogsManagement() { case 'commute_from': return 'bg-indigo-100 text-indigo-700'; case 'business': return 'bg-emerald-100 text-emerald-700'; case 'personal': return 'bg-orange-100 text-orange-700'; + case 'commute_round': return 'bg-purple-100 text-purple-700'; + case 'business_round': return 'bg-teal-100 text-teal-700'; + case 'personal_round': return 'bg-rose-100 text-rose-700'; default: return 'bg-gray-100 text-gray-700'; } }; @@ -655,12 +658,12 @@ className="w-full px-2 py-2 border border-gray-300 rounded-lg text-sm"
- + setFormData(prev => ({ ...prev, departure_name: e.target.value }))} - placeholder="장소명" + placeholder="출발지명" className="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm" />
@@ -697,12 +700,12 @@ className="w-full px-2 py-2 border border-gray-300 rounded-lg text-sm"
- + setFormData(prev => ({ ...prev, arrival_name: e.target.value }))} - placeholder="장소명" + placeholder="도착지명" className="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm" />