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

@@ -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>
);
}