Add full FOCO investor management system with CRUD, investments, and transactions
This commit is contained in:
76
src/app/investor/page.tsx
Normal file
76
src/app/investor/page.tsx
Normal file
@@ -0,0 +1,76 @@
|
||||
import StatCard from '@/components/StatCard';
|
||||
import TransactionList from '@/components/TransactionList';
|
||||
import { investors, bikes, transactions } from '@/data/mockData';
|
||||
import { Wallet, TrendingUp, Bike, Target, DollarSign, FileText, Phone, BarChart3, Send, ArrowDownToLine } from 'lucide-react';
|
||||
|
||||
export default function InvestorPage() {
|
||||
const investor = investors[0];
|
||||
const investorBikes = bikes.filter(b => b.investorId === investor?.id || b.status === 'rented');
|
||||
|
||||
return (
|
||||
<div className="p-4 lg:p-6">
|
||||
<div className="mb-6">
|
||||
<h1 className="text-xl lg:text-2xl font-extrabold text-slate-800">Investor Dashboard</h1>
|
||||
<p className="text-sm text-slate-500">Track your investments and earnings</p>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-2 lg:grid-cols-4 gap-4 mb-6">
|
||||
<StatCard label="Total Invested" value={`৳${(investor.totalInvested / 1000).toFixed(0)}k`} icon={Wallet} color="text-investor" />
|
||||
<StatCard label="Total Earnings" value={`৳${(investor.totalEarnings / 1000).toFixed(1)}k`} icon={TrendingUp} color="text-green-600" trend="+2.3%" trendUp />
|
||||
<StatCard label="Active Bikes" value={investor.activeBikes} icon={Bike} color="text-biker" />
|
||||
<StatCard label="ROI" value={`${investor.roi}%`} icon={Target} color="text-purple-600" />
|
||||
</div>
|
||||
|
||||
<div className="grid lg:grid-cols-2 gap-6 mb-6">
|
||||
<div className="bg-white rounded-xl p-5 shadow-sm border border-slate-100">
|
||||
<div className="flex items-center justify-between mb-4">
|
||||
<h2 className="font-bold text-slate-800">My Portfolio</h2>
|
||||
<span className="text-xs font-semibold px-2 py-1 bg-purple-100 text-purple-700 rounded-full">
|
||||
{investorBikes.length} bikes
|
||||
</span>
|
||||
</div>
|
||||
<div className="space-y-3">
|
||||
{investorBikes.map(bike => (
|
||||
<div key={bike.id} className="flex items-center justify-between p-3 bg-slate-50 rounded-lg">
|
||||
<div>
|
||||
<p className="font-medium text-slate-700">{bike.model}</p>
|
||||
<p className="text-xs text-slate-400">{bike.plateNumber}</p>
|
||||
</div>
|
||||
<span className={`text-xs font-medium px-2 py-1 rounded-full ${
|
||||
bike.status === 'rented' ? 'bg-green-100 text-green-700' :
|
||||
bike.status === 'available' ? 'bg-blue-100 text-blue-700' :
|
||||
'bg-amber-100 text-amber-700'
|
||||
}`}>
|
||||
{bike.status}
|
||||
</span>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="bg-white rounded-xl p-5 shadow-sm border border-slate-100">
|
||||
<h2 className="font-bold text-slate-800 mb-4">Quick Actions</h2>
|
||||
<div className="grid grid-cols-2 gap-3">
|
||||
<button className="py-3 bg-investor text-white rounded-lg font-semibold text-sm hover:bg-investor-dark flex items-center justify-center gap-2">
|
||||
<DollarSign className="w-4 h-4" /> Withdraw
|
||||
</button>
|
||||
<button className="py-3 bg-purple-600 text-white rounded-lg font-semibold text-sm hover:bg-purple-700 flex items-center justify-center gap-2">
|
||||
<FileText className="w-4 h-4" /> Statement
|
||||
</button>
|
||||
<button className="py-3 border border-slate-200 text-slate-600 rounded-lg font-semibold text-sm hover:bg-slate-50 flex items-center justify-center gap-2">
|
||||
<Phone className="w-4 h-4" /> Support
|
||||
</button>
|
||||
<button className="py-3 border border-slate-200 text-slate-600 rounded-lg font-semibold text-sm hover:bg-slate-50 flex items-center justify-center gap-2">
|
||||
<BarChart3 className="w-4 h-4" /> Analytics
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<h2 className="text-lg font-bold text-slate-800 mb-3">Transaction History</h2>
|
||||
<TransactionList transactions={transactions.filter(t => t.userId === 'u7')} />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
98
src/app/investor/portfolio/page.tsx
Normal file
98
src/app/investor/portfolio/page.tsx
Normal file
@@ -0,0 +1,98 @@
|
||||
import { Wallet, TrendingUp, Bike, DollarSign, Calendar, Download, ArrowUpRight } from 'lucide-react';
|
||||
import { investors, bikes } from '@/data/mockData';
|
||||
|
||||
const investor = investors[0];
|
||||
const investorBikes = bikes.filter(b => b.investorId === investor?.id);
|
||||
|
||||
export default function InvestorPortfolioPage() {
|
||||
return (
|
||||
<div className="p-4 lg:p-6">
|
||||
<div className="flex flex-col lg:flex-row lg:items-center lg:justify-between gap-4 mb-6">
|
||||
<div>
|
||||
<h1 className="text-2xl lg:text-3xl font-extrabold text-slate-800">My Portfolio</h1>
|
||||
<p className="text-sm text-slate-500 mt-1">Track your investments</p>
|
||||
</div>
|
||||
<button className="py-2 px-4 bg-accent text-white rounded-lg text-sm font-semibold hover:bg-accent-dark flex items-center gap-2">
|
||||
<Download className="w-4 h-4" /> Export Statement
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-2 lg:grid-cols-4 gap-4 mb-8">
|
||||
<div className="bg-white rounded-xl p-5 shadow-sm border border-slate-100">
|
||||
<div className="flex items-center gap-3 mb-2">
|
||||
<Wallet className="w-5 h-5 text-purple-600" />
|
||||
<span className="text-sm text-slate-500">Invested</span>
|
||||
</div>
|
||||
<p className="text-2xl font-extrabold text-slate-800">৳{investor.totalInvested.toLocaleString()}</p>
|
||||
</div>
|
||||
<div className="bg-white rounded-xl p-5 shadow-sm border border-slate-100">
|
||||
<div className="flex items-center gap-3 mb-2">
|
||||
<TrendingUp className="w-5 h-5 text-green-600" />
|
||||
<span className="text-sm text-slate-500">Earnings</span>
|
||||
</div>
|
||||
<p className="text-2xl font-extrabold text-green-600">৳{investor.totalEarnings.toLocaleString()}</p>
|
||||
<span className="text-xs text-green-600 flex items-center gap-1 mt-1">
|
||||
<ArrowUpRight className="w-3 h-3" /> +2.3%
|
||||
</span>
|
||||
</div>
|
||||
<div className="bg-white rounded-xl p-5 shadow-sm border border-slate-100">
|
||||
<div className="flex items-center gap-3 mb-2">
|
||||
<Bike className="w-5 h-5 text-blue-600" />
|
||||
<span className="text-sm text-slate-500">Active Bikes</span>
|
||||
</div>
|
||||
<p className="text-2xl font-extrabold text-slate-800">{investor.activeBikes}</p>
|
||||
</div>
|
||||
<div className="bg-white rounded-xl p-5 shadow-sm border border-slate-100">
|
||||
<div className="flex items-center gap-3 mb-2">
|
||||
<DollarSign className="w-5 h-5 text-amber-600" />
|
||||
<span className="text-sm text-slate-500">ROI</span>
|
||||
</div>
|
||||
<p className="text-2xl font-extrabold text-slate-800">{investor.roi}%</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="bg-white rounded-xl shadow-sm border border-slate-100 overflow-hidden">
|
||||
<div className="px-5 py-4 border-b border-slate-100">
|
||||
<h2 className="font-bold text-slate-800">My Bikes</h2>
|
||||
</div>
|
||||
<div className="overflow-x-auto">
|
||||
<table className="w-full">
|
||||
<thead className="bg-slate-50">
|
||||
<tr>
|
||||
<th className="px-4 py-3 text-left text-xs font-semibold text-slate-500 uppercase">Bike</th>
|
||||
<th className="px-4 py-3 text-left text-xs font-semibold text-slate-500 uppercase">Plate</th>
|
||||
<th className="px-4 py-3 text-left text-xs font-semibold text-slate-500 uppercase">Location</th>
|
||||
<th className="px-4 py-3 text-left text-xs font-semibold text-slate-500 uppercase">Status</th>
|
||||
<th className="px-4 py-3 text-left text-xs font-semibold text-slate-500 uppercase">Earnings</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody className="divide-y divide-slate-50">
|
||||
{investorBikes.map(bike => (
|
||||
<tr key={bike.id} className="hover:bg-slate-50">
|
||||
<td className="px-4 py-3">
|
||||
<div className="flex items-center gap-3">
|
||||
<Bike className="w-5 h-5 text-slate-400" />
|
||||
<span className="text-sm font-medium text-slate-700">{bike.model}</span>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-4 py-3 text-sm text-slate-600">{bike.plateNumber}</td>
|
||||
<td className="px-4 py-3 text-sm text-slate-600">{bike.location}</td>
|
||||
<td className="px-4 py-3">
|
||||
<span className={`text-xs font-medium px-2.5 py-1 rounded-full ${
|
||||
bike.status === 'rented' ? 'bg-green-100 text-green-700' :
|
||||
bike.status === 'available' ? 'bg-blue-100 text-blue-700' :
|
||||
'bg-amber-100 text-amber-700'
|
||||
}`}>
|
||||
{bike.status}
|
||||
</span>
|
||||
</td>
|
||||
<td className="px-4 py-3 text-sm font-semibold text-green-600">৳2,500</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
123
src/app/investor/withdraw/page.tsx
Normal file
123
src/app/investor/withdraw/page.tsx
Normal file
@@ -0,0 +1,123 @@
|
||||
import { DollarSign, Banknote, Clock, Check, X, AlertCircle } from 'lucide-react';
|
||||
import { investors } from '@/data/mockData';
|
||||
|
||||
const investor = investors[0];
|
||||
|
||||
const withdrawalHistory = [
|
||||
{ id: 'w1', amount: 3000, method: 'bKash', status: 'pending', date: '2024-03-20' },
|
||||
{ id: 'w2', amount: 5000, method: 'Bank Transfer', status: 'completed', date: '2024-03-15' },
|
||||
{ id: 'w3', amount: 2500, method: 'bKash', status: 'completed', date: '2024-02-28' },
|
||||
];
|
||||
|
||||
export default function WithdrawPage() {
|
||||
return (
|
||||
<div className="p-4 lg:p-6">
|
||||
<div className="flex flex-col lg:flex-row lg:items-center lg:justify-between gap-4 mb-6">
|
||||
<div>
|
||||
<h1 className="text-2xl lg:text-3xl font-extrabold text-slate-800">Withdraw Earnings</h1>
|
||||
<p className="text-sm text-slate-500 mt-1">Request withdrawals to your bank or bKash</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="grid lg:grid-cols-3 gap-6 mb-8">
|
||||
<div className="lg:col-span-2 bg-white rounded-xl shadow-sm border border-slate-100 p-6">
|
||||
<h2 className="font-bold text-slate-800 mb-4">Request Withdrawal</h2>
|
||||
<div className="mb-4">
|
||||
<label className="text-sm font-medium text-slate-600 mb-2 block">Available Balance</label>
|
||||
<p className="text-3xl font-extrabold text-green-600">৳{(investor.totalEarnings - investor.withdrawalPending).toLocaleString()}</p>
|
||||
</div>
|
||||
<div className="mb-4">
|
||||
<label className="text-sm font-medium text-slate-600 mb-2 block">Amount</label>
|
||||
<input
|
||||
type="number"
|
||||
placeholder="Enter amount"
|
||||
className="w-full px-4 py-3 border border-slate-200 rounded-lg text-lg focus:outline-none focus:ring-2 focus:ring-accent focus:border-transparent"
|
||||
/>
|
||||
</div>
|
||||
<div className="mb-4">
|
||||
<label className="text-sm font-medium text-slate-600 mb-2 block">Withdrawal Method</label>
|
||||
<div className="grid grid-cols-2 gap-3">
|
||||
<button className="py-3 px-4 border-2 border-accent bg-accent-light rounded-lg font-medium text-accent">
|
||||
bKash
|
||||
</button>
|
||||
<button className="py-3 px-4 border border-slate-200 rounded-lg font-medium text-slate-600 hover:bg-slate-50">
|
||||
Bank Transfer
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div className="mb-4">
|
||||
<label className="text-sm font-medium text-slate-600 mb-2 block">Account Number</label>
|
||||
<input
|
||||
type="text"
|
||||
placeholder="01XXXXXXXXX"
|
||||
className="w-full px-4 py-3 border border-slate-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-accent focus:border-transparent"
|
||||
/>
|
||||
</div>
|
||||
<button className="w-full py-3 bg-accent text-white rounded-lg font-semibold hover:bg-accent-dark">
|
||||
Request Withdrawal
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div className="bg-white rounded-xl shadow-sm border border-slate-100 p-5">
|
||||
<h2 className="font-bold text-slate-800 mb-4">Quick Withdraw</h2>
|
||||
<div className="space-y-2 mb-4">
|
||||
<button className="w-full py-2 px-4 border border-slate-200 rounded-lg text-sm text-left hover:bg-slate-50">
|
||||
৳1,000
|
||||
</button>
|
||||
<button className="w-full py-2 px-4 border border-slate-200 rounded-lg text-sm text-left hover:bg-slate-50">
|
||||
৳2,500
|
||||
</button>
|
||||
<button className="w-full py-2 px-4 border border-slate-200 rounded-lg text-sm text-left hover:bg-slate-50">
|
||||
৳5,000
|
||||
</button>
|
||||
<button className="w-full py-2 px-4 border border-slate-200 rounded-lg text-sm text-left hover:bg-slate-50">
|
||||
All Available
|
||||
</button>
|
||||
</div>
|
||||
<div className="p-3 bg-blue-50 rounded-lg">
|
||||
<p className="text-sm text-blue-700 flex items-center gap-2">
|
||||
<AlertCircle className="w-4 h-4" />
|
||||
Processing time: 1-3 business days
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="bg-white rounded-xl shadow-sm border border-slate-100 overflow-hidden">
|
||||
<div className="px-5 py-4 border-b border-slate-100">
|
||||
<h2 className="font-bold text-slate-800">Withdrawal History</h2>
|
||||
</div>
|
||||
<div className="overflow-x-auto">
|
||||
<table className="w-full">
|
||||
<thead className="bg-slate-50">
|
||||
<tr>
|
||||
<th className="px-4 py-3 text-left text-xs font-semibold text-slate-500 uppercase">Date</th>
|
||||
<th className="px-4 py-3 text-left text-xs font-semibold text-slate-500 uppercase">Method</th>
|
||||
<th className="px-4 py-3 text-left text-xs font-semibold text-slate-500 uppercase">Amount</th>
|
||||
<th className="px-4 py-3 text-left text-xs font-semibold text-slate-500 uppercase">Status</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody className="divide-y divide-slate-50">
|
||||
{withdrawalHistory.map(w => (
|
||||
<tr key={w.id} className="hover:bg-slate-50">
|
||||
<td className="px-4 py-3 text-sm text-slate-600">{w.date}</td>
|
||||
<td className="px-4 py-3 text-sm text-slate-600">{w.method}</td>
|
||||
<td className="px-4 py-3 text-sm font-semibold text-slate-700">৳{w.amount}</td>
|
||||
<td className="px-4 py-3">
|
||||
<span className={`inline-flex items-center gap-1 text-xs font-medium px-2.5 py-1 rounded-full ${
|
||||
w.status === 'completed' ? 'bg-green-100 text-green-700' :
|
||||
'bg-amber-100 text-amber-700'
|
||||
}`}>
|
||||
{w.status === 'completed' ? <Check className="w-3 h-3" /> : <Clock className="w-3 h-3" />}
|
||||
{w.status}
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user