'use client'; import { useState, use } from 'react'; import Link from 'next/link'; import { useRouter } from 'next/navigation'; import { ArrowLeft, TrendingUp, Bike, DollarSign, Calendar, CreditCard, FileText, Download, Check, Printer, BarChart3, Wallet, Clock, Shield, Percent, Activity, AlertTriangle, Receipt, CreditCardIcon, Zap, Smartphone, ChevronRight } from 'lucide-react'; import { investors, bikes, transactions } from '@/data/mockData'; import toast from 'react-hot-toast'; export default function InvestorInvestmentDetailPage({ params }: { params: Promise<{ id: string }> }) { const resolvedParams = use(params); const { id: investmentId } = resolvedParams; const router = useRouter(); const investor = investors[0]; // mock logged-in investor const investment = investor.investments?.find((inv: any) => inv.id === investmentId); const [activeTab, setActiveTab] = useState('overview'); if (!investment) { return (

Investment Not Found

The investment you're looking for doesn't exist.

Back to Portfolio
); } const planConfig: Record = { silver: { bg: 'bg-slate-50', border: 'border-slate-200', text: 'text-slate-700', badge: 'bg-slate-200 text-slate-700', icon: Zap }, gold: { bg: 'bg-amber-50', border: 'border-amber-200', text: 'text-amber-700', badge: 'bg-amber-100 text-amber-700', icon: Shield }, platinum: { bg: 'bg-purple-50', border: 'border-purple-200', text: 'text-purple-700', badge: 'bg-purple-100 text-purple-700', icon: TrendingUp }, diamond: { bg: 'bg-blue-50', border: 'border-blue-200', text: 'text-blue-700', badge: 'bg-blue-100 text-blue-700', icon: Zap }, }; const style = planConfig[investment.planType] || planConfig.gold; const assignedBikes = bikes.filter((b: any) => b.investorId === investor.id && b.id === 'b1'); // mock filtering for this investment const investmentTransactions = transactions.filter((t: any) => t.investorId === investor.id && t.type === 'investment_return'); return (

{investment.planName}

{investment.planType} Plan {investment.status}

ID: #{investment.id?.toUpperCase()} Started: {investment.startDate}

Invested

৳{investment.totalInvestment.toLocaleString()}

Total Return

৳{investment.actualEarnings.toLocaleString()}

Pending

৳{(investment.totalInvestment * 0.24 - investment.actualEarnings).toLocaleString()}

ROI

{investment.expectedRoi}%

{['overview', 'bikes', 'pnl', 'transactions'].map((tab) => ( ))}
{activeTab === 'overview' && (

Investment Details

Plan Name {investment.planName}
Plan Type {investment.planType}
Period {investment.startDate} - {investment.endDate || 'Ongoing'}
Payment Method {investment.paymentMethod}

Plan Policy

Min Duration 12 Months
Lock-in Period 3 Months
Exit Penalty 10%
Maintenance Included

Profit Sharing Configuration

Your share based on rental model

Single Rent

55%

Rent to Own

45%

Share EV

40%

)} {activeTab === 'bikes' && (
{assignedBikes.length > 0 ? assignedBikes.map(bike => (
{bike.model}
{bike.model}

{bike.plateNumber} • {bike.brand}

{bike.status} Daily: ৳{bike.currentRent}

Total Earnings

৳{bike.totalEarnings?.toLocaleString()}

Live Track
)) : (

No bikes assigned yet.

Admin will assign bikes to this investment shortly.

)}
)} {activeTab === 'pnl' && (

Detailed P&L Statement

Gross Rental Revenue ৳{(investment.actualEarnings / 0.55).toFixed(0)}
Platform Management Fee (45%) -৳{((investment.actualEarnings / 0.55) * 0.45).toFixed(0)}
Fleet Insurance & Maintenance Included in Platform Fee
Net Return to Investor ৳{investment.actualEarnings.toLocaleString()}
)} {activeTab === 'transactions' && (
{investmentTransactions.map(t => ( ))}
Date Description Amount Status
{t.createdAt}

{t.description}

Ref: {t.id}

+৳{t.amount.toLocaleString()} Completed
)}

Quick Actions

Support Desk

Need help with this investment or bike assignment? Our team is available 24/7.

); }