diff --git a/src/app/investor/dashboard/page.tsx b/src/app/investor/dashboard/page.tsx index d6ca11d..8dfe28a 100644 --- a/src/app/investor/dashboard/page.tsx +++ b/src/app/investor/dashboard/page.tsx @@ -2,182 +2,186 @@ import { investors, bikes, transactions } from '@/data/mockData'; import { Wallet, TrendingUp, Bike, Target, DollarSign, FileText, Phone, BarChart3, Clock, ArrowRight, ShieldCheck, Zap, AlertCircle } from 'lucide-react'; import Link from 'next/link'; import TransactionList from '@/components/TransactionList'; +import InvestorNotification from '@/components/InvestorNotification'; export default function InvestorDashboardPage() { - const investor = investors[0]; // mock logged-in investor + const investor = investors[0]; const investorBikes = bikes.filter(b => b.investorId === investor?.id); const recentTransactions = transactions.filter(t => t.investorId === investor.id).slice(0, 5); const availableBalance = investor.totalEarnings - investor.totalWithdrawn - investor.withdrawalPending; return ( -
-
-
-

Welcome back, {investor.name.split(' ')[0]} 👋

-

Here's what's happening with your investments today.

-
-
- {investor.kycStatus === 'verified' ? ( - - KYC Verified - - ) : ( - - Complete KYC - - )} - - New Investment - -
-
- -
-
-
-
-
- -
-

Total Invested

+
+ +
+
+
+

Welcome back, {investor.name.split(' ')[0]} 👋

+

Here's what's happening with your investments today.

-

৳{(investor.totalInvested / 1000).toFixed(0)}k

-
- -
-
-
-
- -
-

Total Earnings

-
-

৳{(investor.totalEarnings / 1000).toFixed(1)}k

-
- -
-
-
-
- -
-

Active Bikes

-
-

{investor.activeBikes}

-
- -
-
-
-
- -
-

Avg. ROI

-
-

{investor.roi}%

-
-
- -
-
-
-

- My Portfolio Overview -

- - View All - -
-
- {investorBikes.length > 0 ? ( -
- {investorBikes.slice(0, 3).map(bike => ( - -
- {bike.model} -
-
-

{bike.model}

-

{bike.plateNumber}

-
-
-

৳{bike.currentRent || 0}

-

Daily Rent

-
-
- - {bike.status} - -
- - ))} -
+
+ {investor.kycStatus === 'verified' ? ( + + KYC Verified + ) : ( -
-
- -
-

No bikes assigned yet

-

Once you make an investment, assigned bikes will appear here.

-
+ + Complete KYC + )} + + New Investment +
-
-
-

Quick Actions

+
+
+
+
+
+ +
+

Total Invested

+
+

৳{(investor.totalInvested / 1000).toFixed(0)}k

-
-
-

Available to Withdraw

-

৳{availableBalance.toLocaleString()}

- - Withdraw Funds + +
+
+
+
+ +
+

Total Earnings

+
+

৳{(investor.totalEarnings / 1000).toFixed(1)}k

+
+ +
+
+
+
+ +
+

Active Bikes

+
+

{investor.activeBikes}

+
+ +
+
+
+
+ +
+

Avg. ROI

+
+

{investor.roi}%

+
+
+ +
+
+
+

+ My Portfolio Overview +

+ + View All
+
+ {investorBikes.length > 0 ? ( +
+ {investorBikes.slice(0, 3).map(bike => ( + +
+ {bike.model} +
+
+

{bike.model}

+

{bike.plateNumber}

+
+
+

৳{bike.currentRent || 0}

+

Daily Rent

+
+
+ + {bike.status} + +
+ + ))} +
+ ) : ( +
+
+ +
+

No bikes assigned yet

+

Once you make an investment, assigned bikes will appear here.

+
+ )} +
+
- -
- +
+
+

Quick Actions

+
+
+
+

Available to Withdraw

+

৳{availableBalance.toLocaleString()}

+ + Withdraw Funds +
-
-

Update KYC

-

Manage documents

-
- - -
- -
-
-

Earnings & P&L

-

View detailed reports

-
- + +
+ +
+
+

Update KYC

+

Manage documents

+
+ + + +
+ +
+
+

Earnings & P&L

+

View detailed reports

+
+ +
-
-
-
-

- Recent Transactions -

- -
-
- +
+
+

+ Recent Transactions +

+ +
+
+ +
diff --git a/src/app/investor/investments/[id]/page.tsx b/src/app/investor/investments/[id]/page.tsx index ddd30e4..183cc7a 100644 --- a/src/app/investor/investments/[id]/page.tsx +++ b/src/app/investor/investments/[id]/page.tsx @@ -11,6 +11,7 @@ import { } from 'lucide-react'; import { investors, bikes, transactions } from '@/data/mockData'; import toast from 'react-hot-toast'; +import InvestorNotification from '@/components/InvestorNotification'; export default function InvestorInvestmentDetailPage({ params }: { params: Promise<{ id: string }> }) { const resolvedParams = use(params); @@ -49,296 +50,299 @@ export default function InvestorInvestmentDetailPage({ params }: { params: Promi const investmentTransactions = transactions.filter((t: any) => t.investorId === investor.id && t.type === 'investment_return'); return ( -
-
-
- -
-
-

- {investment.planName}

- - {investment.planType} Plan - - - {investment.status} - +
+ +
+
+
+ +
+
+

+ {investment.planName}

+ + {investment.planType} Plan + + + {investment.status} + +
+

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

-

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

+
+
+
-
- -
-
-
-
-
-
- +
+
+
+
+ +
+

Invested

-

Invested

+

৳{investment.totalInvestment.toLocaleString()}

-

৳{investment.totalInvestment.toLocaleString()}

-
-
-
-
- +
+
+
+ +
+

Total Return

-

Total Return

+

৳{investment.actualEarnings.toLocaleString()}

-

৳{investment.actualEarnings.toLocaleString()}

-
-
-
-
- +
+
+
+ +
+

Pending

-

Pending

+

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

-

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

-
-
-
-
- +
+
+
+ +
+

ROI

-

ROI

+

{investment.expectedRoi}%

-

{investment.expectedRoi}%

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

- Investment Details +
+ {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

-
-
- Plan Name - {investment.planName} +

Your share based on rental model

+
+
+

Single Rent

+

55%

-
- Plan Type - {investment.planType} +
+

Rent to Own

+

45%

-
- 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 +
+

Share EV

+

40%

+ )} -
-

- Profit Sharing Configuration -

-

Your share based on rental model

-
-
-

Single Rent

-

55%

+ {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 + +
-
-

Rent to Own

-

45%

+ )) : ( +
+ +

No bikes assigned yet.

+

Admin will assign bikes to this investment shortly.

-
-

Share EV

-

40%

+ )} +
+ )} + + {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 === '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 => ( - - - - - + {activeTab === 'transactions' && ( +
+
DateDescriptionAmountStatus
{t.createdAt} -

{t.description}

-

Ref: {t.id}

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

- Quick Actions -

-
- - - + + + {investmentTransactions.map(t => ( + + {t.createdAt} + +

{t.description}

+

Ref: {t.id}

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

- Support Desk -

-

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

- +
+
+

+ Quick Actions +

+
+ + + +
+
+ +
+

+ Support Desk +

+

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

+ +
diff --git a/src/app/investor/plans/page.tsx b/src/app/investor/plans/page.tsx index f495079..dd059db 100644 --- a/src/app/investor/plans/page.tsx +++ b/src/app/investor/plans/page.tsx @@ -5,6 +5,7 @@ import Link from 'next/link'; import { Target, Plus, Zap, ChevronRight, ArrowRight, Edit, Trash2, Eye, TrendingUp, X, CreditCard } from 'lucide-react'; import { investors } from '@/data/mockData'; import toast from 'react-hot-toast'; +import InvestorNotification from '@/components/InvestorNotification'; export default function MyInvestmentsPage() { const investor = investors[0]; @@ -47,388 +48,391 @@ export default function MyInvestmentsPage() { }; return ( -
- {/* Header */} -
-
-
-

- My Investments -

-

Manage your active portfolios and track your earnings.

-
- -
-
- - {/* Investment Plans Cards */} -
-
-
-

Investment Plans

-

Manage investment portfolios for this investor

-
-
- -
- {investor.investments?.map((inv) => { - const style = planConfig[inv.planType] || planConfig.gold; - return ( -
-
-
-

{inv.planName}

-

{inv.planType} Plan

-
- - {inv.status} - -
-
-
-
-

Investment

-

৳{inv.totalInvestment.toLocaleString()}

-
-
-

Total Return

-

৳{inv.actualEarnings.toLocaleString()}

-
-
-
-
- Duration - 12 months -
-
- Lock-in Period - 3 months -
-
- Early Exit Penalty - 10% -
-
-
- {inv.startDate} - {inv.endDate || 'Ongoing'} - {inv.paymentMethod} -
-
-

ID: #{inv.id?.slice(-6) || 'N/A'}

-
- - View - -
-
-
-
- ); - })} -
- - {(!investor.investments || investor.investments.length === 0) && ( -
- -

No Investments Yet

-

Create your first investment plan

-
+
+ + {/* Investment Plans Cards */} +
+
+
+

Investment Plans

+

Manage investment portfolios for this investor

+
+
+ +
+ {investor.investments?.map((inv) => { + const style = planConfig[inv.planType] || planConfig.gold; + return ( +
+
+
+

{inv.planName}

+

{inv.planType} Plan

+
+ + {inv.status} + +
+
+
+
+

Investment

+

৳{inv.totalInvestment.toLocaleString()}

+
+
+

Total Return

+

৳{inv.actualEarnings.toLocaleString()}

+
+
+
+
+ Duration + 12 months +
+
+ Lock-in Period + 3 months +
+
+ Early Exit Penalty + 10% +
+
+
+ {inv.startDate} - {inv.endDate || 'Ongoing'} + {inv.paymentMethod} +
+
+

ID: #{inv.id?.slice(-6) || 'N/A'}

+
+ + View + +
+
+
+
+ ); + })} +
+ + {(!investor.investments || investor.investments.length === 0) && ( +
+ +

No Investments Yet

+

Create your first investment plan

+ +
+ )} +
+ + {/* Create Investment Modal */} + {showCreateModal && ( +
+
+
+
+

+ Create New Investment +

+

Set up investment for {investor.name}

+
+ +
+ +
+ {!selectedTemplate ? ( + <> +
+ +
+ {PLAN_TEMPLATES.map(plan => ( + + ))} +
+
+ + ) : ( + <> +
+ + | + {selectedTemplate.name} +
+ +
+
+ + setNewInvestment({ ...newInvestment, planName: e.target.value })} + className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm" + placeholder="Plan name" + /> +
+
+ + +
+
+ +
+
+ + +
+
+ + +
+
+ + +

= Qty × Base Price

+
+
+ +
+
+ + setNewInvestment({ ...newInvestment, totalInvestment: Number(e.target.value) })} + className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm bg-yellow-50" + /> +
+
+ + +
+
+ +
+

+ Payment Options +

+
+ + +
+ {newInvestment.paymentType === 'partial' && ( +
+ + { + const val = Number(e.target.value); + if (val >= newInvestment.totalInvestment * 0.5 && val <= newInvestment.totalInvestment) { + setNewInvestment({ ...newInvestment, initialPayment: val }); + } + }} + className="w-full px-3 py-2 border border-investor rounded-lg text-sm bg-white" + /> +

Balance: ৳{(newInvestment.totalInvestment - newInvestment.initialPayment).toLocaleString()}

+
+ )} +
+ +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+

+ FICO Share - Profit per Ride +

+

Profit sharing when bikes are rented to end customers

+
+
+ + +
+
+ + +
+
+ + +
+
+
+ +
+
+ + setNewInvestment({ ...newInvestment, startDate: e.target.value })} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm" /> +
+
+ + setNewInvestment({ ...newInvestment, endDate: e.target.value })} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm" /> +
+
+ +
+
+ + +
+
+ + setNewInvestment({ ...newInvestment, transactionReference: e.target.value })} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm" placeholder="Auto-generated if empty" /> +
+
+ +
+ +