feat: include hub information in battery damage and maintenance records
This commit is contained in:
@@ -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' },
|
{ 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: [
|
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-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' },
|
{ 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: [
|
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-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' },
|
{ 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' },
|
{ 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,
|
estimatedCost: damage.estimatedCost,
|
||||||
actualCost: damage.actualCost || 0,
|
actualCost: damage.actualCost || 0,
|
||||||
status: damage.status,
|
status: damage.status,
|
||||||
hubId: '',
|
hubId: damage.hubId || '',
|
||||||
hubName: '',
|
hubName: damage.hubName || '',
|
||||||
});
|
});
|
||||||
setEditingDamage(damage);
|
setEditingDamage(damage);
|
||||||
setShowDamageModal(true);
|
setShowDamageModal(true);
|
||||||
@@ -379,8 +379,8 @@ export default function BatteryDetailPage({ params }: { params: Promise<{ id: st
|
|||||||
performedBy: maintenance.performedBy,
|
performedBy: maintenance.performedBy,
|
||||||
nextDueDate: maintenance.nextDueDate || '',
|
nextDueDate: maintenance.nextDueDate || '',
|
||||||
status: maintenance.status,
|
status: maintenance.status,
|
||||||
hubId: '',
|
hubId: maintenance.hubId || '',
|
||||||
hubName: '',
|
hubName: maintenance.hubName || '',
|
||||||
});
|
});
|
||||||
setEditingMaintenance(maintenance);
|
setEditingMaintenance(maintenance);
|
||||||
setShowMaintenanceModal(true);
|
setShowMaintenanceModal(true);
|
||||||
@@ -697,7 +697,7 @@ export default function BatteryDetailPage({ params }: { params: Promise<{ id: st
|
|||||||
<td className="px-4 py-3 text-sm text-slate-600">{damage.date}</td>
|
<td className="px-4 py-3 text-sm text-slate-600">{damage.date}</td>
|
||||||
<td className="px-4 py-3 text-sm text-slate-700">{damage.type}</td>
|
<td className="px-4 py-3 text-sm text-slate-700">{damage.type}</td>
|
||||||
<td className="px-4 py-3 text-sm text-slate-600">{damage.description}</td>
|
<td className="px-4 py-3 text-sm text-slate-600">{damage.description}</td>
|
||||||
<td className="px-4 py-3 text-sm text-slate-600">{damageForm.hubName || '-'}</td>
|
<td className="px-4 py-3 text-sm text-slate-600">{damage.hubName || '-'}</td>
|
||||||
<td className="px-4 py-3 text-sm font-medium text-amber-600">৳{damage.estimatedCost.toLocaleString()}</td>
|
<td className="px-4 py-3 text-sm font-medium text-amber-600">৳{damage.estimatedCost.toLocaleString()}</td>
|
||||||
<td className="px-4 py-3 text-sm font-medium text-green-600">{damage.actualCost ? `৳${damage.actualCost.toLocaleString()}` : '-'}</td>
|
<td className="px-4 py-3 text-sm font-medium text-green-600">{damage.actualCost ? `৳${damage.actualCost.toLocaleString()}` : '-'}</td>
|
||||||
<td className="px-4 py-3">
|
<td className="px-4 py-3">
|
||||||
@@ -761,7 +761,7 @@ export default function BatteryDetailPage({ params }: { params: Promise<{ id: st
|
|||||||
<td className="px-4 py-3 text-sm text-slate-600">{maint.date}</td>
|
<td className="px-4 py-3 text-sm text-slate-600">{maint.date}</td>
|
||||||
<td className="px-4 py-3 text-sm text-slate-700 capitalize">{maint.type}</td>
|
<td className="px-4 py-3 text-sm text-slate-700 capitalize">{maint.type}</td>
|
||||||
<td className="px-4 py-3 text-sm text-slate-600">{maint.description}</td>
|
<td className="px-4 py-3 text-sm text-slate-600">{maint.description}</td>
|
||||||
<td className="px-4 py-3 text-sm text-slate-600">{maintenanceForm.hubName || '-'}</td>
|
<td className="px-4 py-3 text-sm text-slate-600">{maint.hubName || '-'}</td>
|
||||||
<td className="px-4 py-3 text-sm font-medium text-green-600">৳{maint.cost.toLocaleString()}</td>
|
<td className="px-4 py-3 text-sm font-medium text-green-600">৳{maint.cost.toLocaleString()}</td>
|
||||||
<td className="px-4 py-3 text-sm text-slate-600">{maint.performedBy}</td>
|
<td className="px-4 py-3 text-sm text-slate-600">{maint.performedBy}</td>
|
||||||
<td className="px-4 py-3 text-sm text-slate-600">{maint.nextDueDate || '-'}</td>
|
<td className="px-4 py-3 text-sm text-slate-600">{maint.nextDueDate || '-'}</td>
|
||||||
|
|||||||
Reference in New Issue
Block a user