From 1ab2bfb3c338ddbe35d6c11d909b966f31005e2e Mon Sep 17 00:00:00 2001 From: mariomitte Date: Tue, 14 Jul 2026 23:09:00 +0200 Subject: [PATCH] =?UTF-8?q?patch=20prika=C5=BEi=20stranicu=20servisnih=20z?= =?UTF-8?q?apisa=20sa=20SN=20dizalice?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/modules/fleet/serializers.py | 9 ++++++++- .../src/components/dashboard/FleetDashboardShell.jsx | 7 +++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/backend/modules/fleet/serializers.py b/backend/modules/fleet/serializers.py index 5a72815..a068f65 100644 --- a/backend/modules/fleet/serializers.py +++ b/backend/modules/fleet/serializers.py @@ -207,12 +207,13 @@ class VehicleServiceRecordSerializer(serializers.ModelSerializer): performed_by_name = serializers.SerializerMethodField() vehicle_registration = serializers.SerializerMethodField() task_label = serializers.SerializerMethodField() + crane_serial_number = serializers.SerializerMethodField() class Meta: model = VehicleServiceRecord fields = [ 'id', 'vehicle', 'crane', 'vehicle_registration', 'crane_registration', - 'task', 'task_label', + 'task', 'task_label', 'crane_serial_number', 'performed_by', 'performed_by_name', 'service_title', 'description', 'parts', 'cost', 'service_date', 'mileage', 'next_service_due_at', @@ -261,6 +262,12 @@ class VehicleServiceRecordSerializer(serializers.ModelSerializer): return None return obj.task.title + def get_crane_serial_number(self, obj): + # Provjeri je li povezano vozilo/dizalica postoji i vrati serijski broj + if hasattr(obj, 'vehicle') and obj.vehicle: + return getattr(obj.vehicle, 'crane_serial_number', None) + return None + def create(self, validated_data): request = self.context.get('request') user = getattr(request, 'user', None) diff --git a/frontend/src/components/dashboard/FleetDashboardShell.jsx b/frontend/src/components/dashboard/FleetDashboardShell.jsx index e0c6373..bf17be7 100644 --- a/frontend/src/components/dashboard/FleetDashboardShell.jsx +++ b/frontend/src/components/dashboard/FleetDashboardShell.jsx @@ -898,7 +898,7 @@ export default function FleetDashboardShell({ initialSection = 'dashboard', page ( <> + {/*
+                                                                    {JSON.stringify(group, null, 2)}
+                                                                    
*/} {formatDate(record.service_date)} - {record.crane_registration || record.vehicle_registration || '-'} + {record.crane_serial_number || record.vehicle_registration || '-'} {record.description || '-'}