fix: include batteryRentPending in rental interface and sanitize pending rent calculation
This commit is contained in:
@@ -36,6 +36,7 @@ interface Rental {
|
||||
batteryId?: string;
|
||||
batteryName?: string;
|
||||
batteryRent?: number;
|
||||
batteryRentPending?: number;
|
||||
type: RentalType;
|
||||
status: RentalStatus;
|
||||
startDate: string;
|
||||
@@ -702,7 +703,7 @@ export default function RentalsPage() {
|
||||
? Math.round(batteryRent / 4)
|
||||
: batteryRent;
|
||||
const totalRent = bikeRent + batteryRentAdjusted;
|
||||
const due = rental.pendingRent + rental.batteryRentPending || 0;
|
||||
const due = (rental.pendingRent || 0) + (rental.batteryRentPending || 0);
|
||||
const penalty = rental.penaltyAmount || 0;
|
||||
const totalDue = due + penalty;
|
||||
const periodLabel = rental.subscriptionType === 'daily' ? 'day' : rental.subscriptionType === 'weekly' ? 'wk' : 'mo';
|
||||
|
||||
Reference in New Issue
Block a user