refactor: remove investor portfolio and withdrawal pages and clean up related sidebar and admin navigation links.

This commit is contained in:
sazzadulalambd
2026-05-14 23:15:10 +06:00
parent 38c8461f0d
commit f6b394aded
5 changed files with 392 additions and 226 deletions

View File

@@ -6,7 +6,8 @@ import { useRouter } from 'next/navigation';
import {
ArrowLeft, TrendingUp, Plus, X, Edit, Trash2, Bike, DollarSign, Calendar,
CreditCard, FileText, Users, TrendingDown, ArrowRight, Download, Check,
Printer, BarChart3, Wallet, Clock, Shield, Percent, Activity, AlertTriangle
Printer, BarChart3, Wallet, Clock, Shield, Percent, Activity, AlertTriangle,
Receipt, CreditCardIcon
} from 'lucide-react';
import { investors as initialInvestors, bikes as initialBikes, transactions as initialTransactions } from '@/data/mockData';
@@ -22,9 +23,27 @@ export default function InvestmentDetailPage({ params }: { params: Promise<{ id:
const [showAddBikeModal, setShowAddBikeModal] = useState(false);
const [showDeleteBikeModal, setShowDeleteBikeModal] = useState(false);
const [showEditModal, setShowEditModal] = useState(false);
const [showStatementHistory, setShowStatementHistory] = useState(false);
const [showPartialPaymentModal, setShowPartialPaymentModal] = useState(false);
const [bikeToDelete, setBikeToDelete] = useState<any>(null);
const [selectedBikeId, setSelectedBikeId] = useState('');
const [editForm, setEditForm] = useState<any>({});
const [statementHistory, setStatementHistory] = useState<any[]>([
{ id: 'stmt1', date: '2024-03-25', type: 'Monthly Statement', period: 'March 2024', downloadedBy: 'Admin', downloadedAt: '2024-03-25 10:30' },
{ id: 'stmt2', date: '2024-02-28', type: 'Monthly Statement', period: 'February 2024', downloadedBy: 'Admin', downloadedAt: '2024-02-28 14:15' },
{ id: 'stmt3', date: '2024-01-31', type: 'Monthly Statement', period: 'January 2024', downloadedBy: 'Admin', downloadedAt: '2024-01-31 09:00' },
]);
const [partialPayment, setPartialPayment] = useState({
amount: 0,
paymentMethod: 'bank',
transactionRef: '',
date: new Date().toISOString().split('T')[0],
notes: ''
});
const [investmentPayments, setInvestmentPayments] = useState<any[]>([
{ id: 'pay1', date: '2024-01-15', amount: 50000, paymentMethod: 'bank', transactionRef: 'TXN-001', status: 'completed', notes: 'First installment' },
{ id: 'pay2', date: '2024-01-20', amount: 35000, paymentMethod: 'mobile', transactionRef: 'TXN-002', status: 'completed', notes: 'Second installment' },
]);
if (!investor || !investment) {
return (
@@ -147,6 +166,12 @@ export default function InvestmentDetailPage({ params }: { params: Promise<{ id:
>
Transactions
</button>
<button
onClick={() => setActiveTab('payments')}
className={`px-4 py-2 text-sm font-medium rounded-lg transition-colors ${activeTab === 'payments' ? 'bg-investor text-white' : 'text-slate-600 hover:bg-slate-100'}`}
>
Payments
</button>
<button
onClick={() => setActiveTab('pnl')}
className={`px-4 py-2 text-sm font-medium rounded-lg transition-colors ${activeTab === 'pnl' ? 'bg-investor text-white' : 'text-slate-600 hover:bg-slate-100'}`}
@@ -326,6 +351,73 @@ export default function InvestmentDetailPage({ params }: { params: Promise<{ id:
</div>
)}
{activeTab === 'payments' && (
<div className="space-y-4">
<div className="flex items-center justify-between">
<h4 className="font-semibold text-slate-800">Payment History</h4>
<button
onClick={() => setShowPartialPaymentModal(true)}
className="px-3 py-1.5 text-xs bg-investor text-white rounded-lg flex items-center gap-1 hover:bg-investor-dark"
>
<Plus className="w-3 h-3" /> Record Payment
</button>
</div>
<div className="bg-slate-50 rounded-xl p-4">
<div className="grid grid-cols-3 gap-4 mb-4">
<div className="text-center">
<p className="text-xs text-slate-500">Total Investment</p>
<p className="text-lg font-bold text-slate-800">{investment.totalInvestment.toLocaleString()}</p>
</div>
<div className="text-center">
<p className="text-xs text-slate-500">Paid Amount</p>
<p className="text-lg font-bold text-green-600">{investmentPayments.reduce((sum, p) => sum + p.amount, 0).toLocaleString()}</p>
</div>
<div className="text-center">
<p className="text-xs text-slate-500">Remaining</p>
<p className="text-lg font-bold text-amber-600">{(investment.totalInvestment - investmentPayments.reduce((sum, p) => sum + p.amount, 0)).toLocaleString()}</p>
</div>
</div>
<div className="w-full bg-slate-200 rounded-full h-3 mb-4">
<div
className="bg-gradient-to-r from-green-500 to-green-600 h-3 rounded-full transition-all"
style={{ width: `${Math.min(100, (investmentPayments.reduce((sum, p) => sum + p.amount, 0) / investment.totalInvestment) * 100)}%` }}
/>
</div>
</div>
<div className="bg-white rounded-xl border border-slate-200 overflow-hidden">
<table className="w-full">
<thead className="bg-slate-50">
<tr>
<th className="px-4 py-3 text-left text-xs font-medium text-slate-500">Date</th>
<th className="px-4 py-3 text-left text-xs font-medium text-slate-500">Amount</th>
<th className="px-4 py-3 text-left text-xs font-medium text-slate-500">Method</th>
<th className="px-4 py-3 text-left text-xs font-medium text-slate-500">Reference</th>
<th className="px-4 py-3 text-left text-xs font-medium text-slate-500">Status</th>
</tr>
</thead>
<tbody className="divide-y divide-slate-100">
{investmentPayments.map((payment: any) => (
<tr key={payment.id}>
<td className="px-4 py-3 text-sm text-slate-500">{payment.date}</td>
<td className="px-4 py-3 text-sm font-bold text-green-600">{payment.amount.toLocaleString()}</td>
<td className="px-4 py-3 text-sm capitalize">{payment.paymentMethod}</td>
<td className="px-4 py-3 text-sm text-slate-500">{payment.transactionRef}</td>
<td className="px-4 py-3">
<span className={`px-2 py-1 rounded text-xs font-medium ${payment.status === 'completed' ? 'bg-green-100 text-green-700' : 'bg-amber-100 text-amber-700'}`}>
{payment.status}
</span>
</td>
</tr>
))}
</tbody>
</table>
</div>
</div>
)}
{activeTab === 'journals' && (
<div>
<h4 className="font-semibold text-slate-800 mb-4">Accounting Journal Entries</h4>
@@ -712,6 +804,192 @@ export default function InvestmentDetailPage({ params }: { params: Promise<{ id:
</div>
</div>
)}
{showStatementHistory && (
<div className="fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4">
<div className="bg-white rounded-xl shadow-xl w-full max-w-lg">
<div className="p-5 border-b border-slate-100 flex items-center justify-between">
<h3 className="text-lg font-bold text-slate-800 flex items-center gap-2">
<FileText className="w-5 h-5 text-investor" /> Statement History
</h3>
<button onClick={() => setShowStatementHistory(false)} className="p-1 hover:bg-slate-100 rounded-lg">
<X className="w-5 h-5 text-slate-500" />
</button>
</div>
<div className="p-5">
{statementHistory.length > 0 ? (
<div className="space-y-3">
{statementHistory.map((stmt: any) => (
<div key={stmt.id} className="flex items-center gap-3 p-3 bg-slate-50 rounded-lg hover:bg-slate-100 transition-colors">
<div className="w-10 h-10 bg-purple-100 rounded-lg flex items-center justify-center">
<FileText className="w-5 h-5 text-purple-600" />
</div>
<div className="flex-1">
<p className="text-sm font-medium text-slate-800">{stmt.type}</p>
<p className="text-xs text-slate-500">{stmt.period}</p>
</div>
<div className="text-right">
<p className="text-xs text-slate-400">{stmt.downloadedAt}</p>
<p className="text-xs text-slate-500">by {stmt.downloadedBy}</p>
</div>
</div>
))}
</div>
) : (
<div className="text-center py-8">
<FileText className="w-10 h-10 mx-auto mb-3 text-slate-300" />
<p className="text-slate-500">No statements generated yet</p>
</div>
)}
</div>
<div className="p-5 border-t border-slate-100 flex justify-end">
<button onClick={() => setShowStatementHistory(false)} className="px-4 py-2 border border-slate-200 text-slate-600 rounded-lg text-sm hover:bg-slate-50">
Close
</button>
</div>
</div>
</div>
)}
{showPartialPaymentModal && (
<div className="fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4">
<div className="bg-white rounded-xl shadow-xl w-full max-w-lg">
<div className="p-5 border-b border-slate-100 flex items-center justify-between">
<h3 className="text-lg font-bold text-slate-800 flex items-center gap-2">
<CreditCardIcon className="w-5 h-5 text-investor" /> Record Partial Payment
</h3>
<button onClick={() => setShowPartialPaymentModal(false)} className="p-1 hover:bg-slate-100 rounded-lg">
<X className="w-5 h-5 text-slate-500" />
</button>
</div>
<div className="p-5 space-y-4">
<div className="bg-amber-50 border border-amber-200 rounded-lg p-4">
<div className="flex justify-between items-center">
<span className="text-sm text-slate-600">Total Investment</span>
<span className="font-bold text-slate-800">{investment.totalInvestment.toLocaleString()}</span>
</div>
<div className="flex justify-between items-center mt-2">
<span className="text-sm text-slate-600">Already Paid</span>
<span className="font-bold text-green-600">{investmentPayments.reduce((sum, p) => sum + p.amount, 0).toLocaleString()}</span>
</div>
<div className="flex justify-between items-center mt-2 pt-2 border-t border-amber-200">
<span className="text-sm font-semibold text-slate-700">Remaining</span>
<span className="font-bold text-amber-600">{(investment.totalInvestment - investmentPayments.reduce((sum, p) => sum + p.amount, 0)).toLocaleString()}</span>
</div>
</div>
<div>
<label className="text-sm font-medium text-slate-700 mb-1 block">Amount () <span className="text-red-500">*</span></label>
<input
type="number"
value={partialPayment.amount || ''}
onChange={(e) => setPartialPayment({ ...partialPayment, amount: Number(e.target.value) })}
className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-investor"
placeholder="Enter payment amount"
/>
<p className="text-xs text-slate-400 mt-1">Minimum: 1,000</p>
</div>
<div className="grid grid-cols-2 gap-4">
<div>
<label className="text-sm font-medium text-slate-700 mb-1 block">Date</label>
<input
type="date"
value={partialPayment.date}
onChange={(e) => setPartialPayment({ ...partialPayment, date: e.target.value })}
className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-investor"
/>
</div>
<div>
<label className="text-sm font-medium text-slate-700 mb-1 block">Payment Method</label>
<select
value={partialPayment.paymentMethod}
onChange={(e) => setPartialPayment({ ...partialPayment, paymentMethod: e.target.value })}
className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-investor"
>
<option value="bank">Bank Transfer</option>
<option value="mobile">Mobile Banking</option>
<option value="cash">Cash</option>
<option value="cheque">Cheque</option>
</select>
</div>
</div>
<div>
<label className="text-sm font-medium text-slate-700 mb-1 block">Transaction Reference</label>
<input
type="text"
value={partialPayment.transactionRef}
onChange={(e) => setPartialPayment({ ...partialPayment, transactionRef: e.target.value })}
className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-investor"
placeholder="e.g., TXN-12345"
/>
</div>
<div>
<label className="text-sm font-medium text-slate-700 mb-1 block">Notes</label>
<textarea
value={partialPayment.notes}
onChange={(e) => setPartialPayment({ ...partialPayment, notes: e.target.value })}
className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-investor"
rows={2}
placeholder="Optional notes for this payment"
/>
</div>
<div className="bg-green-50 border border-green-200 rounded-lg p-3">
<h4 className="text-xs font-semibold text-green-800 mb-2">Journal Entry Preview</h4>
<div className="space-y-1 text-xs">
<div className="flex justify-between">
<span className="text-green-600">Dr: Bank - City Bank (1200)</span>
<span className="font-medium">{partialPayment.amount?.toLocaleString() || 0}</span>
</div>
<div className="flex justify-between">
<span className="text-blue-600">Cr: Investor Liabilities (2200)</span>
<span className="font-medium">{partialPayment.amount?.toLocaleString() || 0}</span>
</div>
</div>
</div>
</div>
<div className="p-5 border-t border-slate-100 flex justify-end gap-3">
<button onClick={() => setShowPartialPaymentModal(false)} className="px-4 py-2 border border-slate-200 text-slate-600 rounded-lg text-sm hover:bg-slate-50">
Cancel
</button>
<button
onClick={() => {
if (partialPayment.amount <= 0) {
alert('Please enter a valid amount');
return;
}
const newPayment = {
id: `pay${Date.now()}`,
date: partialPayment.date,
amount: partialPayment.amount,
paymentMethod: partialPayment.paymentMethod,
transactionRef: partialPayment.transactionRef || `AUTO-${Date.now()}`,
status: 'completed',
notes: partialPayment.notes
};
setInvestmentPayments([...investmentPayments, newPayment]);
setPartialPayment({
amount: 0,
paymentMethod: 'bank',
transactionRef: '',
date: new Date().toISOString().split('T')[0],
notes: ''
});
setShowPartialPaymentModal(false);
alert('Payment recorded successfully!');
}}
disabled={partialPayment.amount <= 0}
className="px-4 py-2 bg-investor text-white rounded-lg text-sm font-medium hover:bg-investor-dark disabled:opacity-50"
>
Record Payment
</button>
</div>
</div>
</div>
)}
</div>
);
}

View File

@@ -141,6 +141,17 @@ export default function InvestorDetailPage() {
transactionReference: '',
notes: ''
});
const [showAddPaymentModal, setShowAddPaymentModal] = useState(false);
const [newPayment, setNewPayment] = useState({
amount: 0,
paymentMethod: 'bank' as 'bank' | 'mobile' | 'cash' | 'cheque',
transactionRef: '',
date: new Date().toISOString().split('T')[0],
notes: ''
});
const [investmentPayments, setInvestmentPayments] = useState<any[]>([
{ id: 'pay1', date: '2024-01-15', amount: 50000, paymentMethod: 'bank', transactionRef: 'TXN-001', status: 'completed', notes: 'First payment' }
]);
if (!investor) {
return (
@@ -3006,6 +3017,106 @@ export default function InvestorDetailPage() {
</div>
</div>
)}
{showAddPaymentModal && (
<div className="fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4">
<div className="bg-white rounded-xl shadow-xl w-full max-w-lg">
<div className="p-5 border-b border-slate-100 flex items-center justify-between">
<h3 className="text-lg font-bold text-slate-800 flex items-center gap-2">
<CreditCard className="w-5 h-5 text-investor" /> Record Payment
</h3>
<button onClick={() => setShowAddPaymentModal(false)} className="p-1 hover:bg-slate-100 rounded-lg">
<X className="w-5 h-5 text-slate-500" />
</button>
</div>
<div className="p-5 space-y-4">
<div>
<label className="text-sm font-medium text-slate-700 mb-1 block">Amount () <span className="text-red-500">*</span></label>
<input
type="number"
value={newPayment.amount || ''}
onChange={(e) => setNewPayment({ ...newPayment, amount: Number(e.target.value) })}
className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-investor"
placeholder="Enter payment amount"
/>
</div>
<div className="grid grid-cols-2 gap-4">
<div>
<label className="text-sm font-medium text-slate-700 mb-1 block">Date</label>
<input
type="date"
value={newPayment.date}
onChange={(e) => setNewPayment({ ...newPayment, date: e.target.value })}
className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-investor"
/>
</div>
<div>
<label className="text-sm font-medium text-slate-700 mb-1 block">Payment Method</label>
<select
value={newPayment.paymentMethod}
onChange={(e) => setNewPayment({ ...newPayment, paymentMethod: e.target.value as any })}
className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-investor"
>
<option value="bank">Bank Transfer</option>
<option value="mobile">Mobile Banking</option>
<option value="cash">Cash</option>
<option value="cheque">Cheque</option>
</select>
</div>
</div>
<div>
<label className="text-sm font-medium text-slate-700 mb-1 block">Transaction Reference</label>
<input
type="text"
value={newPayment.transactionRef}
onChange={(e) => setNewPayment({ ...newPayment, transactionRef: e.target.value })}
className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-investor"
placeholder="e.g., TXN-12345"
/>
</div>
<div>
<label className="text-sm font-medium text-slate-700 mb-1 block">Notes</label>
<textarea
value={newPayment.notes}
onChange={(e) => setNewPayment({ ...newPayment, notes: e.target.value })}
className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-investor"
rows={2}
/>
</div>
</div>
<div className="p-5 border-t border-slate-100 flex justify-end gap-3">
<button onClick={() => setShowAddPaymentModal(false)} className="px-4 py-2 border border-slate-200 text-slate-600 rounded-lg text-sm hover:bg-slate-50">
Cancel
</button>
<button
onClick={() => {
if (newPayment.amount <= 0) {
alert('Please enter a valid amount');
return;
}
const payment = {
id: `pay${Date.now()}`,
date: newPayment.date,
amount: newPayment.amount,
paymentMethod: newPayment.paymentMethod,
transactionRef: newPayment.transactionRef || `AUTO-${Date.now()}`,
status: 'completed',
notes: newPayment.notes
};
setInvestmentPayments([...investmentPayments, payment]);
setNewPayment({ amount: 0, paymentMethod: 'bank', transactionRef: '', date: new Date().toISOString().split('T')[0], notes: '' });
setShowAddPaymentModal(false);
alert('Payment recorded successfully!');
}}
disabled={newPayment.amount <= 0}
className="px-4 py-2 bg-investor text-white rounded-lg text-sm font-medium hover:bg-investor-dark disabled:opacity-50"
>
Record Payment
</button>
</div>
</div>
</div>
)}
</div>
);
}

View File

@@ -1,98 +0,0 @@
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>
);
}

View File

@@ -1,123 +0,0 @@
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>
);
}

View File

@@ -65,8 +65,6 @@ const bikerNavItems = [
const investorNavItems = [
{ label: 'Dashboard', href: '/investor', icon: Wallet },
{ label: 'Portfolio', href: '/investor/portfolio', icon: BarChart3 },
{ label: 'Withdraw', href: '/investor/withdraw', icon: CreditCard },
];
const shopNavItems = [