From 2645aeca30fe7b7a53a8e32a0a68138ceffab395 Mon Sep 17 00:00:00 2001 From: sazzadulalambd Date: Tue, 19 May 2026 16:35:11 +0600 Subject: [PATCH] feat: add investor co-ownership tracking and management fields to battery details view --- src/app/admin/batteries/[id]/page.tsx | 87 +++++++++++++++++++++++++++ src/app/admin/batteries/page.tsx | 32 +++------- 2 files changed, 97 insertions(+), 22 deletions(-) diff --git a/src/app/admin/batteries/[id]/page.tsx b/src/app/admin/batteries/[id]/page.tsx index 0ce336d..84cbe75 100644 --- a/src/app/admin/batteries/[id]/page.tsx +++ b/src/app/admin/batteries/[id]/page.tsx @@ -994,6 +994,47 @@ export default function BatteryDetailPage({ params }: { params: Promise<{ id: st )} + {battery.investorId && ( +
+
+
+
+ +
+
+

Investor Co-Ownership Details

+ Active Investment +
+
+
+ +
+
+

Investor Name

+ + {battery.investorName} + +

ID: {battery.investorId}

+
+
+

Ownership Share (%)

+

{battery.investorSharePercentage}%

+

Share of Daily Rent Revenue

+
+
+

Invested Amount

+

৳{(battery.investedAmount || 0).toLocaleString()}

+

Total Capital Contributed

+
+
+

Investor Daily Payout

+

৳{(((battery.rentPrice || 150) * (battery.investorSharePercentage || 0)) / 100).toLocaleString()}/day

+

Calculated from Daily Rent

+
+
+
+ )} + {showEditModal && ( + +
+

Investor Assignment (Co-Ownership)

+
+
+ + handleChange('investorId', e.target.value)} + placeholder="INV-001" + className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm" + /> +
+
+ + handleChange('investorName', e.target.value)} + placeholder="Tahmid Rahman" + className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm" + /> +
+
+ + handleChange('investorSharePercentage', parseInt(e.target.value))} + placeholder="60" + className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm" + /> +
+
+ + handleChange('investedAmount', parseInt(e.target.value))} + placeholder="45000" + className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm" + /> +
+
+
)} - {/* Details Modal */} - {showDetailsModal && selectedBattery && ( -
-
-
-

Battery Details

- -
- setShowDetailsModal(false)} - /> -
-
- )} + {/* History Modal */} {showHistoryModal && selectedBattery && (