feat: replace monthly rent with daily rent and deposit fields in battery schema and UI
This commit is contained in:
@@ -97,7 +97,12 @@ interface Battery {
|
||||
lastMaintenance?: string;
|
||||
nextMaintenance?: string;
|
||||
bmsData?: BMSData;
|
||||
monthlyRent?: number;
|
||||
deposit?: number;
|
||||
rentPrice?: number;
|
||||
investorId?: string;
|
||||
investorName?: string;
|
||||
investorSharePercentage?: number;
|
||||
investedAmount?: number;
|
||||
ownershipLogs: OwnershipLog[];
|
||||
damageHistory?: DamageRecord[];
|
||||
maintenanceHistory?: MaintenanceRecord[];
|
||||
@@ -126,7 +131,12 @@ const mockBattery: Battery = {
|
||||
assignedBikerPhone: '01712345678',
|
||||
currentHubId: 'HUB-001',
|
||||
currentHubName: 'JAIBEN Head Office',
|
||||
monthlyRent: 1500,
|
||||
deposit: 5000,
|
||||
rentPrice: 150,
|
||||
investorId: 'INV-001',
|
||||
investorName: 'Tahmid Rahman',
|
||||
investorSharePercentage: 60,
|
||||
investedAmount: 45000,
|
||||
lastMaintenance: '2024-03-01',
|
||||
nextMaintenance: '2024-06-01',
|
||||
bmsData: { voltage: 67.2, current: -2.5, soc: 78, temperature: 32, cycles: 156, health: 95, timestamp: '2024-03-28 12:00:00' },
|
||||
@@ -549,12 +559,14 @@ export default function BatteryDetailPage({ params }: { params: Promise<{ id: st
|
||||
<p className="text-xs text-slate-500">Purchase Price</p>
|
||||
<p className="font-medium text-slate-700">৳{battery.purchasePrice.toLocaleString()}</p>
|
||||
</div>
|
||||
{battery.monthlyRent && (
|
||||
<div className="bg-slate-50 rounded-lg p-3">
|
||||
<p className="text-xs text-slate-500">Monthly Rent</p>
|
||||
<p className="font-medium text-green-600">৳{battery.monthlyRent}/month</p>
|
||||
<p className="text-xs text-slate-500">Deposit</p>
|
||||
<p className="font-medium text-emerald-600">৳{(battery.deposit || 5000).toLocaleString()}</p>
|
||||
</div>
|
||||
<div className="bg-slate-50 rounded-lg p-3">
|
||||
<p className="text-xs text-slate-500">Daily Rent Price</p>
|
||||
<p className="font-medium text-blue-600">৳{(battery.rentPrice || 150).toLocaleString()}/day</p>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -646,13 +658,18 @@ export default function BatteryDetailPage({ params }: { params: Promise<{ id: st
|
||||
<DollarSign className="w-5 h-5 text-green-600" />
|
||||
<h4 className="font-medium text-slate-700">Rent Information</h4>
|
||||
</div>
|
||||
{battery.monthlyRent ? (
|
||||
{battery.rentPrice ? (
|
||||
<div className="bg-green-50 rounded-lg p-5 border border-green-100">
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
|
||||
<div className="grid grid-cols-1 md:grid-cols-3 gap-6">
|
||||
<div>
|
||||
<p className="text-sm text-green-600 mb-1">Monthly Rent Amount</p>
|
||||
<p className="text-3xl font-bold text-green-700">৳{battery.monthlyRent}</p>
|
||||
<p className="text-xs text-green-500 mt-1">per month</p>
|
||||
<p className="text-sm text-blue-600 mb-1">Daily Rent Price</p>
|
||||
<p className="text-2xl font-bold text-blue-700">৳{battery.rentPrice.toLocaleString()}</p>
|
||||
<p className="text-xs text-blue-500 mt-1">per day</p>
|
||||
</div>
|
||||
<div>
|
||||
<p className="text-sm text-emerald-600 mb-1">Battery Deposit</p>
|
||||
<p className="text-2xl font-bold text-emerald-700">৳{(battery.deposit || 0).toLocaleString()}</p>
|
||||
<p className="text-xs text-emerald-500 mt-1">refundable</p>
|
||||
</div>
|
||||
<div>
|
||||
<p className="text-sm text-green-600 mb-1">Status</p>
|
||||
@@ -970,8 +987,8 @@ export default function BatteryDetailPage({ params }: { params: Promise<{ id: st
|
||||
<p className="font-medium text-blue-900">{battery.currentHubName || battery.currentStationName || 'Not Assigned'}</p>
|
||||
</div>
|
||||
<div className="bg-white rounded-lg p-3">
|
||||
<p className="text-xs text-blue-500 mb-1">Monthly Rent</p>
|
||||
<p className="font-medium text-green-600">৳{battery.monthlyRent}/month</p>
|
||||
<p className="text-xs text-blue-500 mb-1">Daily Rent</p>
|
||||
<p className="font-medium text-green-600">৳{(battery.rentPrice || 150)}/day</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1099,11 +1116,20 @@ function EditBatteryModal({
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-slate-700 mb-1">Monthly Rent (৳)</label>
|
||||
<label className="block text-sm font-medium text-slate-700 mb-1">Deposit (৳) *</label>
|
||||
<input
|
||||
type="number"
|
||||
value={formData.monthlyRent || 0}
|
||||
onChange={(e) => handleChange('monthlyRent', parseInt(e.target.value))}
|
||||
value={formData.deposit || 0}
|
||||
onChange={(e) => handleChange('deposit', parseInt(e.target.value))}
|
||||
className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-slate-700 mb-1">Daily Rent Price (৳) *</label>
|
||||
<input
|
||||
type="number"
|
||||
value={formData.rentPrice || 0}
|
||||
onChange={(e) => handleChange('rentPrice', parseInt(e.target.value))}
|
||||
className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm"
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -63,6 +63,8 @@ interface Battery {
|
||||
lastMaintenance?: string;
|
||||
nextMaintenance?: string;
|
||||
bmsData?: BMSData;
|
||||
deposit?: number;
|
||||
rentPrice?: number;
|
||||
history: BatteryHistory[];
|
||||
}
|
||||
|
||||
@@ -99,6 +101,8 @@ const mockBatteries: Battery[] = [
|
||||
voltage: 60,
|
||||
purchaseDate: '2024-01-15',
|
||||
purchasePrice: 45000,
|
||||
deposit: 5000,
|
||||
rentPrice: 150,
|
||||
warrantyExpiry: '2027-01-15',
|
||||
status: 'in-use',
|
||||
currentSoc: 78,
|
||||
@@ -129,6 +133,8 @@ const mockBatteries: Battery[] = [
|
||||
voltage: 48,
|
||||
purchaseDate: '2024-02-01',
|
||||
purchasePrice: 38000,
|
||||
deposit: 4000,
|
||||
rentPrice: 120,
|
||||
warrantyExpiry: '2027-02-01',
|
||||
status: 'available',
|
||||
currentSoc: 100,
|
||||
@@ -150,6 +156,8 @@ const mockBatteries: Battery[] = [
|
||||
voltage: 60,
|
||||
purchaseDate: '2024-01-20',
|
||||
purchasePrice: 42000,
|
||||
deposit: 4500,
|
||||
rentPrice: 130,
|
||||
warrantyExpiry: '2027-01-20',
|
||||
status: 'maintenance',
|
||||
currentSoc: 15,
|
||||
@@ -172,6 +180,8 @@ const mockBatteries: Battery[] = [
|
||||
voltage: 60,
|
||||
purchaseDate: '2024-02-15',
|
||||
purchasePrice: 46000,
|
||||
deposit: 5000,
|
||||
rentPrice: 150,
|
||||
warrantyExpiry: '2027-02-15',
|
||||
status: 'in-use',
|
||||
currentSoc: 92,
|
||||
@@ -200,6 +210,8 @@ const mockBatteries: Battery[] = [
|
||||
voltage: 60,
|
||||
purchaseDate: '2024-03-01',
|
||||
purchasePrice: 50000,
|
||||
deposit: 5500,
|
||||
rentPrice: 160,
|
||||
warrantyExpiry: '2027-03-01',
|
||||
status: 'charging',
|
||||
currentSoc: 85,
|
||||
@@ -221,6 +233,8 @@ const mockBatteries: Battery[] = [
|
||||
voltage: 48,
|
||||
purchaseDate: '2023-06-15',
|
||||
purchasePrice: 28000,
|
||||
deposit: 3000,
|
||||
rentPrice: 90,
|
||||
warrantyExpiry: '2026-06-15',
|
||||
status: 'retired',
|
||||
currentSoc: 0,
|
||||
@@ -896,6 +910,26 @@ function BatteryForm({ battery, onSave, onCancel }: { battery: Battery | null; o
|
||||
className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-accent"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-slate-700 mb-1">Deposit (৳) *</label>
|
||||
<input
|
||||
type="number"
|
||||
value={formData.deposit || 0}
|
||||
onChange={(e) => handleChange('deposit', parseInt(e.target.value))}
|
||||
placeholder="5000"
|
||||
className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-accent"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-slate-700 mb-1">Daily Rent Price (৳) *</label>
|
||||
<input
|
||||
type="number"
|
||||
value={formData.rentPrice || 0}
|
||||
onChange={(e) => handleChange('rentPrice', parseInt(e.target.value))}
|
||||
placeholder="150"
|
||||
className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-accent"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-slate-700 mb-1">Transaction Method</label>
|
||||
<select
|
||||
@@ -1044,6 +1078,14 @@ function BatteryDetails({
|
||||
<p className="text-xs text-slate-500 mb-1">Purchase Price</p>
|
||||
<p className="font-semibold text-slate-700">৳{battery.purchasePrice.toLocaleString()}</p>
|
||||
</div>
|
||||
<div className="bg-slate-50 rounded-lg p-3">
|
||||
<p className="text-xs text-slate-500 mb-1">Battery Deposit</p>
|
||||
<p className="font-semibold text-emerald-700">৳{(battery.deposit || 0).toLocaleString()}</p>
|
||||
</div>
|
||||
<div className="bg-slate-50 rounded-lg p-3">
|
||||
<p className="text-xs text-slate-500 mb-1">Daily Rent Price</p>
|
||||
<p className="font-semibold text-blue-700">৳{(battery.rentPrice || 0).toLocaleString()}/day</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{battery.bmsData && (
|
||||
|
||||
Reference in New Issue
Block a user