diff --git a/src/app/admin/investors/[id]/investments/[investmentId]/page.tsx b/src/app/admin/investors/[id]/investments/[investmentId]/page.tsx index 555baa9..f0d715f 100644 --- a/src/app/admin/investors/[id]/investments/[investmentId]/page.tsx +++ b/src/app/admin/investors/[id]/investments/[investmentId]/page.tsx @@ -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(null); const [selectedBikeId, setSelectedBikeId] = useState(''); const [editForm, setEditForm] = useState({}); + const [statementHistory, setStatementHistory] = useState([ + { 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([ + { 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 + + + +
+
+
+

Total Investment

+

৳{investment.totalInvestment.toLocaleString()}

+
+
+

Paid Amount

+

৳{investmentPayments.reduce((sum, p) => sum + p.amount, 0).toLocaleString()}

+
+
+

Remaining

+

৳{(investment.totalInvestment - investmentPayments.reduce((sum, p) => sum + p.amount, 0)).toLocaleString()}

+
+
+ +
+
sum + p.amount, 0) / investment.totalInvestment) * 100)}%` }} + /> +
+
+ +
+ + + + + + + + + + + + {investmentPayments.map((payment: any) => ( + + + + + + + + ))} + +
DateAmountMethodReferenceStatus
{payment.date}৳{payment.amount.toLocaleString()}{payment.paymentMethod}{payment.transactionRef} + + {payment.status} + +
+
+
+ )} + {activeTab === 'journals' && (

Accounting Journal Entries

@@ -712,6 +804,192 @@ export default function InvestmentDetailPage({ params }: { params: Promise<{ id:
)} + + {showStatementHistory && ( +
+
+
+

+ Statement History +

+ +
+
+ {statementHistory.length > 0 ? ( +
+ {statementHistory.map((stmt: any) => ( +
+
+ +
+
+

{stmt.type}

+

{stmt.period}

+
+
+

{stmt.downloadedAt}

+

by {stmt.downloadedBy}

+
+
+ ))} +
+ ) : ( +
+ +

No statements generated yet

+
+ )} +
+
+ +
+
+
+ )} + + {showPartialPaymentModal && ( +
+
+
+

+ Record Partial Payment +

+ +
+
+
+
+ Total Investment + ৳{investment.totalInvestment.toLocaleString()} +
+
+ Already Paid + ৳{investmentPayments.reduce((sum, p) => sum + p.amount, 0).toLocaleString()} +
+
+ Remaining + ৳{(investment.totalInvestment - investmentPayments.reduce((sum, p) => sum + p.amount, 0)).toLocaleString()} +
+
+ +
+ + 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" + /> +

Minimum: ৳1,000

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