From 36b12772b7e5a910b4f8d17b98069092482c3a0e Mon Sep 17 00:00:00 2001 From: sazzadulalambd Date: Sat, 16 May 2026 20:00:28 +0600 Subject: [PATCH] feat: include hub information in battery damage and maintenance records --- src/app/admin/batteries/[id]/page.tsx | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/app/admin/batteries/[id]/page.tsx b/src/app/admin/batteries/[id]/page.tsx index f4e46c4..45335fd 100644 --- a/src/app/admin/batteries/[id]/page.tsx +++ b/src/app/admin/batteries/[id]/page.tsx @@ -132,13 +132,13 @@ const mockBattery: Battery = { { id: 'OL-003', batteryId: 'BAT-001', fromOwner: 'JAIBEN Hub', fromOwnerType: 'hub', toOwner: 'Rahim Ahmed', toOwnerType: 'biker', toBikeId: 'EV001', toBikeModel: 'Etron ET50', toHubId: 'HUB-001', toHubName: 'JAIBEN Head Office', action: 'rented', rentAmount: 1500, timestamp: '2024-03-28 18:30:00' }, ], damageHistory: [ - { id: 'DMG-001', date: '2024-02-15', type: 'Physical Damage', description: 'Battery casing cracked due to drop', reportedBy: 'Rahim Ahmed', estimatedCost: 5000, actualCost: 4500, status: 'resolved' }, - { id: 'DMG-002', date: '2024-03-20', type: 'Connector Damage', description: 'Charging connector bent', reportedBy: 'Tech Staff', estimatedCost: 1500, status: 'in-progress' }, + { id: 'DMG-001', date: '2024-02-15', type: 'Physical Damage', description: 'Battery casing cracked due to drop', reportedBy: 'Rahim Ahmed', estimatedCost: 5000, actualCost: 4500, status: 'resolved', hubId: 'HUB-001', hubName: 'Gulshan Hub' }, + { id: 'DMG-002', date: '2024-03-20', type: 'Connector Damage', description: 'Charging connector bent', reportedBy: 'Tech Staff', estimatedCost: 1500, status: 'in-progress', hubId: 'HUB-002', hubName: 'Banani Hub' }, ], maintenanceHistory: [ - { id: 'MNT-001', date: '2024-01-20', type: 'routine', description: 'General inspection and cleaning', cost: 500, performedBy: 'Tech Team', nextDueDate: '2024-04-20', status: 'completed' }, - { id: 'MNT-002', date: '2024-03-01', type: 'inspection', description: 'BMS calibration and cell balancing', cost: 800, performedBy: 'Engineer Team', nextDueDate: '2024-06-01', status: 'completed' }, - { id: 'MNT-003', date: '2024-04-15', type: 'repair', description: 'Replaced faulty connector', cost: 1500, performedBy: 'Tech Team', status: 'pending' }, + { id: 'MNT-001', date: '2024-01-20', type: 'routine', description: 'General inspection and cleaning', cost: 500, performedBy: 'Tech Team', nextDueDate: '2024-04-20', status: 'completed', hubId: 'HUB-001', hubName: 'Gulshan Hub' }, + { id: 'MNT-002', date: '2024-03-01', type: 'inspection', description: 'BMS calibration and cell balancing', cost: 800, performedBy: 'Engineer Team', nextDueDate: '2024-06-01', status: 'completed', hubId: 'HUB-003', hubName: 'Uttara Hub' }, + { id: 'MNT-003', date: '2024-04-15', type: 'repair', description: 'Replaced faulty connector', cost: 1500, performedBy: 'Tech Team', status: 'pending', hubId: 'HUB-004', hubName: 'Mirpur Hub' }, ], }; @@ -302,8 +302,8 @@ export default function BatteryDetailPage({ params }: { params: Promise<{ id: st estimatedCost: damage.estimatedCost, actualCost: damage.actualCost || 0, status: damage.status, - hubId: '', - hubName: '', + hubId: damage.hubId || '', + hubName: damage.hubName || '', }); setEditingDamage(damage); setShowDamageModal(true); @@ -379,8 +379,8 @@ export default function BatteryDetailPage({ params }: { params: Promise<{ id: st performedBy: maintenance.performedBy, nextDueDate: maintenance.nextDueDate || '', status: maintenance.status, - hubId: '', - hubName: '', + hubId: maintenance.hubId || '', + hubName: maintenance.hubName || '', }); setEditingMaintenance(maintenance); setShowMaintenanceModal(true); @@ -697,7 +697,7 @@ export default function BatteryDetailPage({ params }: { params: Promise<{ id: st {damage.date} {damage.type} {damage.description} - {damageForm.hubName || '-'} + {damage.hubName || '-'} ৳{damage.estimatedCost.toLocaleString()} {damage.actualCost ? `৳${damage.actualCost.toLocaleString()}` : '-'} @@ -761,7 +761,7 @@ export default function BatteryDetailPage({ params }: { params: Promise<{ id: st {maint.date} {maint.type} {maint.description} - {maintenanceForm.hubName || '-'} + {maint.hubName || '-'} ৳{maint.cost.toLocaleString()} {maint.performedBy} {maint.nextDueDate || '-'}