refactor: redesign withdrawal page layout and UI components for improved clarity

This commit is contained in:
sazzadulalambd
2026-05-15 01:48:56 +06:00
parent 0ff4fcf351
commit 775299fc6c

View File

@@ -1,7 +1,7 @@
'use client'; 'use client';
import { useState } from 'react'; import { useState } from 'react';
import { CreditCard, Wallet, ArrowUpRight, History, CheckCircle, Clock, Building2, Smartphone, AlertCircle, ChevronDown, Settings, X, Bike } from 'lucide-react'; import { CreditCard, Wallet, ArrowUpRight, History, CheckCircle, Clock, Building2, Smartphone, AlertCircle, Settings, X, Bike } from 'lucide-react';
import { investors, transactions, bikes } from '@/data/mockData'; import { investors, transactions, bikes } from '@/data/mockData';
import toast from 'react-hot-toast'; import toast from 'react-hot-toast';
@@ -96,73 +96,68 @@ export default function InvestorWithdrawPage() {
}; };
return ( return (
<div className="p-4 lg:p-6 max-w-8xl mx-auto mb-20 lg:mb-0"> <div className="p-4 lg:p-6 max-w-7xl mx-auto">
<div className="mb-6"> {/* Header */}
<h1 className="text-xl lg:text-2xl font-extrabold text-slate-800">Withdraw Funds</h1> <div className="mb-6 flex items-center justify-between">
<div>
<h1 className="text-xl lg:text-2xl font-bold text-slate-800">Withdraw Funds</h1>
<p className="text-sm text-slate-500">Request withdrawals to your bank or mobile banking accounts</p> <p className="text-sm text-slate-500">Request withdrawals to your bank or mobile banking accounts</p>
</div> </div>
<button
onClick={() => setShowAutoWithdrawModal(true)}
className="px-4 py-2.5 border border-slate-200 text-slate-600 rounded-lg text-sm font-medium hover:bg-slate-50 flex items-center gap-2 shadow-sm"
>
<Settings className="w-4 h-4" /> Configure Auto-Withdraw
</button>
</div>
<div className="grid lg:grid-cols-3 gap-6 mb-8"> {/* Balance Cards */}
{/* Balance Overview */} <div className="grid grid-cols-1 md:grid-cols-4 gap-4 mb-6">
<div className="lg:col-span-1 space-y-4"> <div className="md:col-span-2 bg-investor rounded-xl p-5 text-white shadow-lg relative overflow-hidden">
<div className="bg-investor rounded-2xl p-6 text-white shadow-lg shadow-investor/20 relative overflow-hidden">
<div className="absolute top-0 right-0 w-32 h-32 bg-white/10 rounded-full -translate-y-1/2 translate-x-1/3 blur-2xl"></div> <div className="absolute top-0 right-0 w-32 h-32 bg-white/10 rounded-full -translate-y-1/2 translate-x-1/3 blur-2xl"></div>
<div className="relative z-10"> <div className="relative z-10">
<div className="flex items-center gap-2 text-investor-light mb-2"> <div className="flex items-center gap-2 text-investor-light mb-2">
<Wallet className="w-5 h-5" /> <Wallet className="w-5 h-5" />
<span className="font-medium text-sm">Available Balance</span> <span className="font-medium text-sm">Available Balance</span>
</div> </div>
<h2 className="text-3xl lg:text-4xl font-extrabold mb-1"> <h2 className="text-3xl font-bold mb-1">{availableBalance.toLocaleString()}</h2>
{availableBalance.toLocaleString()}
</h2>
<p className="text-xs text-white/80">Ready to withdraw</p> <p className="text-xs text-white/80">Ready to withdraw</p>
</div> </div>
<div className="mt-6 pt-4 border-t border-white/20 grid grid-cols-2 gap-4 relative z-10">
<div>
<p className="text-xs text-white/70 mb-1">Pending Request</p>
<p className="font-semibold">{investor.pendingEarnings.toLocaleString()}</p>
</div> </div>
<div> <div className="bg-white rounded-xl p-5 border border-slate-200 shadow-sm">
<p className="text-xs text-white/70 mb-1">Total Withdrawn</p> <p className="text-sm text-amber-600 font-medium mb-1">Pending Request</p>
<p className="font-semibold">{investor.totalWithdrawn.toLocaleString()}</p> <p className="text-2xl font-bold text-amber-600">{investor.pendingEarnings.toLocaleString()}</p>
</div> </div>
<div className="bg-white rounded-xl p-5 border border-slate-200 shadow-sm">
<p className="text-sm text-slate-600 font-medium mb-1">Total Withdrawn</p>
<p className="text-2xl font-bold text-slate-700">{investor.totalWithdrawn.toLocaleString()}</p>
</div> </div>
</div> </div>
<div className="bg-amber-50 border border-amber-200 rounded-xl p-4 flex gap-3"> {/* Alert + Action Button */}
<div className="flex items-center gap-4 mb-6">
<div className="flex-1 bg-amber-50 border border-amber-200 rounded-xl p-4 flex gap-3">
<AlertCircle className="w-5 h-5 text-amber-600 shrink-0 mt-0.5" /> <AlertCircle className="w-5 h-5 text-amber-600 shrink-0 mt-0.5" />
<div> <div>
<h4 className="text-sm font-bold text-amber-800 mb-1">Pending Requests</h4> <h4 className="text-sm font-bold text-amber-800 mb-1">Pending Requests</h4>
<p className="text-xs text-amber-700">You currently have <b>{investor.pendingEarnings.toLocaleString()}</b> in pending withdrawals. Processing takes 1-3 business days.</p> <p className="text-xs text-amber-700">You currently have <b>{investor.pendingEarnings.toLocaleString()}</b> in pending withdrawals. Processing takes 1-3 business days.</p>
</div> </div>
</div> </div>
</div>
{/* Right Side */}
<div className="lg:col-span-2 space-y-6">
<button
onClick={() => setShowAutoWithdrawModal(true)}
className="px-4 py-2 text-sm text-slate-600 hover:text-investor flex items-center gap-1"
>
<Settings className="w-4 h-4" /> Configure Auto-Withdraw
</button>
{/* Withdraw Button */}
<button <button
onClick={() => setShowWithdrawModal(true)} onClick={() => setShowWithdrawModal(true)}
className="w-full py-4 bg-investor text-white rounded-xl font-bold text-base shadow-md shadow-investor/20 hover:bg-investor-dark transition-all flex items-center justify-center gap-2" className="px-6 py-3 bg-investor text-white rounded-xl font-bold text-sm shadow-md hover:bg-investor-dark transition-all flex items-center gap-2 whitespace-nowrap"
> >
<CreditCard className="w-5 h-5" /> Withdrawal Request <CreditCard className="w-4 h-4" /> Withdrawal Request
</button> </button>
</div> </div>
</div>
{/* Withdrawal History */} {/* Recent Withdrawals */}
<div> <div className="bg-white rounded-xl border border-slate-200 shadow-sm overflow-hidden">
<h3 className="text-lg font-bold text-slate-800 mb-4 flex items-center gap-2"> <div className="p-4 border-b border-slate-100 bg-slate-50">
<h3 className="font-semibold text-slate-800 flex items-center gap-2">
<History className="w-5 h-5 text-slate-400" /> Recent Withdrawals <History className="w-5 h-5 text-slate-400" /> Recent Withdrawals
</h3> </h3>
<div className="bg-white rounded-xl border border-slate-200 shadow-sm overflow-hidden"> </div>
<div className="overflow-x-auto"> <div className="overflow-x-auto">
<table className="w-full text-left border-collapse"> <table className="w-full text-left border-collapse">
<thead> <thead>
@@ -197,7 +192,8 @@ export default function InvestorWithdrawPage() {
</tr> </tr>
)) : ( )) : (
<tr> <tr>
<td colSpan={5} className="px-5 py-8 text-center text-sm text-slate-500"> <td colSpan={5} className="px-5 py-12 text-center text-sm text-slate-500">
<History className="w-10 h-10 mx-auto mb-2 text-slate-300" />
No withdrawal history found. No withdrawal history found.
</td> </td>
</tr> </tr>
@@ -206,15 +202,14 @@ export default function InvestorWithdrawPage() {
</table> </table>
</div> </div>
</div> </div>
</div>
{/* Withdrawal Request Modal */} {/* Withdrawal Request Modal */}
{showWithdrawModal && ( {showWithdrawModal && (
<div className="fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4"> <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-2xl max-h-[90vh] overflow-hidden flex flex-col"> <div className="bg-white rounded-xl shadow-xl w-full max-w-2xl max-h-[90vh] overflow-hidden flex flex-col">
<div className="p-5 border-b border-slate-100 flex items-center justify-between"> <div className="p-5 border-b border-slate-100 flex items-center justify-between bg-gradient-to-r from-slate-50 to-white">
<h3 className="text-lg font-bold text-slate-800">Create Withdrawal Request</h3> <h3 className="text-lg font-bold text-slate-800">Create Withdrawal Request</h3>
<button onClick={() => setShowWithdrawModal(false)} className="p-1 hover:bg-slate-100 rounded-lg"> <button onClick={() => setShowWithdrawModal(false)} className="p-1.5 hover:bg-slate-100 rounded-lg transition-colors">
<X className="w-5 h-5 text-slate-400" /> <X className="w-5 h-5 text-slate-400" />
</button> </button>
</div> </div>
@@ -222,15 +217,15 @@ export default function InvestorWithdrawPage() {
<div className="p-5 overflow-y-auto flex-1 space-y-5"> <div className="p-5 overflow-y-auto flex-1 space-y-5">
{/* Balance Cards */} {/* Balance Cards */}
<div className="grid grid-cols-3 gap-4"> <div className="grid grid-cols-3 gap-4">
<div className="bg-green-50 rounded-lg p-4 border border-green-100"> <div className="bg-green-50 rounded-lg p-4 border border-green-200">
<p className="text-xs text-green-600 font-medium">Available Balance</p> <p className="text-xs text-green-600 font-medium">Available Balance</p>
<p className="text-lg font-bold text-green-700">{availableBalance.toLocaleString()}</p> <p className="text-lg font-bold text-green-700">{availableBalance.toLocaleString()}</p>
</div> </div>
<div className="bg-amber-50 rounded-lg p-4 border border-amber-100"> <div className="bg-amber-50 rounded-lg p-4 border border-amber-200">
<p className="text-xs text-amber-600 font-medium">Pending Request</p> <p className="text-xs text-amber-600 font-medium">Pending Request</p>
<p className="text-lg font-bold text-amber-700">{investor.pendingEarnings.toLocaleString()}</p> <p className="text-lg font-bold text-amber-700">{investor.pendingEarnings.toLocaleString()}</p>
</div> </div>
<div className="bg-slate-50 rounded-lg p-4 border border-slate-100"> <div className="bg-slate-50 rounded-lg p-4 border border-slate-200">
<p className="text-xs text-slate-600 font-medium">Total Withdrawn</p> <p className="text-xs text-slate-600 font-medium">Total Withdrawn</p>
<p className="text-lg font-bold text-slate-700">{investor.totalWithdrawn.toLocaleString()}</p> <p className="text-lg font-bold text-slate-700">{investor.totalWithdrawn.toLocaleString()}</p>
</div> </div>
@@ -247,18 +242,18 @@ export default function InvestorWithdrawPage() {
id="selectAll" id="selectAll"
checked={selectAll} checked={selectAll}
onChange={(e) => toggleSelectAll(e.target.checked)} onChange={(e) => toggleSelectAll(e.target.checked)}
className="w-4 h-4 text-investor rounded" className="w-5 h-5 text-investor rounded border-slate-300"
/> />
<label htmlFor="selectAll" className="flex-1"> <label htmlFor="selectAll" className="flex-1 cursor-pointer">
<span className="font-medium text-slate-800">Select All</span> <span className="font-semibold text-slate-800">Select All</span>
<p className="text-xs text-slate-500">Include all investments and bikes</p> <p className="text-xs text-slate-500">Include all investments and bikes</p>
</label> </label>
</div> </div>
{/* Investment Plans with Bikes */} {/* Investment Plans with Bikes */}
<div className="border border-slate-200 rounded-lg overflow-hidden"> <div className="border border-slate-200 rounded-lg overflow-hidden">
<div className="bg-slate-50 px-4 py-2 border-b border-slate-200"> <div className="bg-slate-100 px-4 py-3 border-b border-slate-200">
<p className="text-sm font-medium text-slate-700">Investment Plans</p> <p className="text-sm font-semibold text-slate-700">Investment Plans</p>
</div> </div>
<div className="divide-y divide-slate-100"> <div className="divide-y divide-slate-100">
{investor.investments?.map((inv: any) => { {investor.investments?.map((inv: any) => {
@@ -273,34 +268,37 @@ export default function InvestorWithdrawPage() {
checked={selectAll || selectedPlans.includes(inv.id)} checked={selectAll || selectedPlans.includes(inv.id)}
disabled={selectAll} disabled={selectAll}
onChange={() => togglePlan(inv.id, invBikes)} onChange={() => togglePlan(inv.id, invBikes)}
className="w-4 h-4 text-investor rounded" className="w-5 h-5 text-investor rounded border-slate-300"
/> />
<label htmlFor={`plan-${inv.id}`} className="flex-1 flex items-center justify-between"> <label htmlFor={`plan-${inv.id}`} className="flex-1 flex items-center justify-between cursor-pointer">
<div> <div className="flex items-center gap-2">
<span className="font-medium text-slate-800">{inv.planName}</span> <span className="font-semibold text-slate-800">{inv.planName}</span>
<span className={`ml-2 px-2 py-0.5 rounded text-xs capitalize ${planColors[inv.planType]}`}>{inv.planType}</span> <span className={`px-2 py-0.5 rounded text-xs capitalize font-medium ${planColors[inv.planType]}`}>{inv.planType}</span>
</div> </div>
<span className="text-sm font-bold text-green-600">{invEarnings.toLocaleString()}</span> <span className="text-base font-bold text-green-600">{invEarnings.toLocaleString()}</span>
</label> </label>
</div> </div>
{!selectAll && invBikes.length > 0 && ( {!selectAll && invBikes.length > 0 && (
<div className="ml-7 pl-4 border-l-2 border-slate-200 space-y-2"> <div className="ml-8 pl-4 border-l-2 border-slate-200 space-y-2">
{invBikes.map((bike: any) => { {invBikes.map((bike: any) => {
const statusStyle = bikeStatusColors[bike.status] || bikeStatusColors.available; const statusStyle = bikeStatusColors[bike.status] || bikeStatusColors.available;
return ( return (
<div key={bike.id} className="flex items-center gap-2"> <div key={bike.id} className="flex items-center gap-3 p-2 bg-white rounded-lg border border-slate-100">
<input <input
type="checkbox" type="checkbox"
id={`bike-${bike.id}`} id={`bike-${bike.id}`}
checked={selectAll || selectedBikes.includes(bike.id)} checked={selectAll || selectedBikes.includes(bike.id)}
onChange={() => toggleBike(bike.id)} onChange={() => toggleBike(bike.id)}
className="w-3 h-3 text-investor rounded" className="w-4 h-4 text-investor rounded border-slate-300"
/> />
<label htmlFor={`bike-${bike.id}`} className="flex-1 text-sm text-slate-600"> <label htmlFor={`bike-${bike.id}`} className="flex-1 flex items-center gap-2 cursor-pointer">
<span className="font-medium">{bike.model}</span> <Bike className="w-4 h-4 text-slate-400" />
<div>
<span className="text-sm font-medium text-slate-700">{bike.model}</span>
<span className="text-xs text-slate-400 ml-2">{bike.plateNumber}</span> <span className="text-xs text-slate-400 ml-2">{bike.plateNumber}</span>
</div>
</label> </label>
<span className="text-xs text-green-600 font-medium">{bike.totalEarnings?.toLocaleString() || 0}</span> <span className="text-xs text-green-600 font-semibold">{bike.totalEarnings?.toLocaleString() || 0}</span>
</div> </div>
); );
})} })}
@@ -315,23 +313,18 @@ export default function InvestorWithdrawPage() {
</div> </div>
{/* Withdrawal Amount */} {/* Withdrawal Amount */}
<div>
<h4 className="font-semibold text-slate-800 mb-3">Withdrawal Amount</h4>
<div className="bg-gradient-to-r from-green-50 to-emerald-50 border border-green-200 rounded-xl p-5"> <div className="bg-gradient-to-r from-green-50 to-emerald-50 border border-green-200 rounded-xl p-5">
<div className="flex items-center justify-between mb-2"> <div className="flex items-center justify-between mb-3">
<span className="text-sm text-slate-600">Calculated Amount</span> <h4 className="font-semibold text-slate-800">Withdrawal Amount</h4>
<span className={`text-xs px-2 py-0.5 rounded-full ${selectAll ? 'bg-green-100 text-green-700' : 'bg-amber-100 text-amber-700'}`}> <span className={`text-xs px-3 py-1 rounded-full font-medium ${selectAll ? 'bg-green-100 text-green-700' : 'bg-amber-100 text-amber-700'}`}>
{selectAll ? 'All Selected' : `${selectedBikes.length} bikes`} {selectAll ? 'All Selected' : `${selectedBikes.length} bikes`}
</span> </span>
</div> </div>
<p className="text-3xl font-bold text-green-700 mb-1"> <p className="text-3xl font-bold text-green-700 mb-2">{calculatedAmount.toLocaleString()}</p>
{calculatedAmount.toLocaleString()}
</p>
<p className="text-xs text-slate-500"> <p className="text-xs text-slate-500">
Based on {selectAll ? 'all' : selectedBikes.length} selected bike(s) earnings Based on {selectAll ? 'all' : selectedBikes.length} selected bike(s) earnings
</p> </p>
</div> </div>
</div>
{/* Payment Method */} {/* Payment Method */}
<div> <div>
@@ -341,33 +334,32 @@ export default function InvestorWithdrawPage() {
<div <div
key={account.id} key={account.id}
onClick={() => { setPaymentMethod('bank'); setSelectedAccount(account.id); }} onClick={() => { setPaymentMethod('bank'); setSelectedAccount(account.id); }}
className={`p-4 rounded-lg border cursor-pointer transition-all ${selectedAccount === account.id ? 'border-investor bg-investor/5' : 'border-slate-200 hover:border-slate-300'}`} className={`p-4 rounded-lg border cursor-pointer transition-all ${selectedAccount === account.id ? 'border-investor bg-investor/5 ring-2 ring-investor/20' : 'border-slate-200 hover:border-slate-300 hover:shadow-sm'}`}
> >
<div className="flex items-center gap-2 mb-1"> <div className="flex items-center gap-3">
<div className={`w-8 h-8 rounded-lg flex items-center justify-center ${account.isPrimary ? 'bg-green-100' : 'bg-slate-100'}`}> <div className="w-10 h-10 rounded-lg flex items-center justify-center bg-slate-100">
<Building2 className={`w-4 h-4 ${account.isPrimary ? 'text-green-600' : 'text-slate-500'}`} /> <Building2 className="w-5 h-5 text-slate-500" />
</div> </div>
<div> <div>
<p className="text-sm font-medium text-slate-800">{account.bankName}</p> <p className="text-sm font-semibold text-slate-800">{account.bankName}</p>
{account.isPrimary && <span className="text-xs text-green-600">Primary</span>} <p className="text-xs text-slate-500 font-mono">{account.accountNumber}</p>
</div> </div>
</div> </div>
<p className="text-xs text-slate-500">{account.accountNumber}</p>
</div> </div>
))} ))}
</div> </div>
{(investor as any).mobileBanking && ( {(investor as any).mobileBanking && (
<div <div
onClick={() => { setPaymentMethod('mobile'); setSelectedAccount('mobile'); }} onClick={() => { setPaymentMethod('mobile'); setSelectedAccount('mobile'); }}
className={`mt-3 p-4 rounded-lg border cursor-pointer transition-all ${selectedAccount === 'mobile' ? 'border-investor bg-investor/5' : 'border-slate-200 hover:border-slate-300'}`} className={`mt-3 p-4 rounded-lg border cursor-pointer transition-all ${selectedAccount === 'mobile' ? 'border-investor bg-investor/5 ring-2 ring-investor/20' : 'border-slate-200 hover:border-slate-300 hover:shadow-sm'}`}
> >
<div className="flex items-center gap-2"> <div className="flex items-center gap-3">
<div className="w-8 h-8 rounded-lg bg-pink-100 flex items-center justify-center"> <div className="w-10 h-10 rounded-lg bg-pink-100 flex items-center justify-center">
<Smartphone className="w-4 h-4 text-pink-600" /> <Smartphone className="w-5 h-5 text-pink-600" />
</div> </div>
<div> <div>
<p className="text-sm font-medium text-slate-800">{(investor as any).mobileBanking}</p> <p className="text-sm font-semibold text-slate-800">{(investor as any).mobileBanking}</p>
<p className="text-xs text-slate-500">{(investor as any).mobileBankingNumber}</p> <p className="text-xs text-slate-500 font-mono">{(investor as any).mobileBankingNumber}</p>
</div> </div>
</div> </div>
</div> </div>
@@ -375,23 +367,20 @@ export default function InvestorWithdrawPage() {
</div> </div>
</div> </div>
<div className="p-5 border-t border-slate-100 flex justify-between items-center"> <div className="p-5 border-t border-slate-200 flex justify-end gap-3 bg-slate-50">
<button onClick={() => setShowWithdrawModal(false)} className="px-5 py-2.5 border border-slate-300 text-slate-600 rounded-lg text-sm font-medium hover:bg-white hover:shadow-sm transition-all">
<div className="flex gap-3">
<button onClick={() => setShowWithdrawModal(false)} className="px-4 py-2 border border-slate-200 text-slate-600 rounded-lg text-sm hover:bg-slate-50">
Cancel Cancel
</button> </button>
<button <button
onClick={handleSubmitWithdraw} onClick={handleSubmitWithdraw}
disabled={!selectedAccount || (selectedBikes.length === 0 && !selectAll)} disabled={!selectedAccount || (selectedBikes.length === 0 && !selectAll)}
className="px-6 py-2 bg-investor text-white rounded-lg text-sm font-medium hover:bg-investor-dark disabled:opacity-50 disabled:cursor-not-allowed" className="px-6 py-2.5 bg-investor text-white rounded-lg text-sm font-semibold hover:bg-investor-dark disabled:opacity-50 disabled:cursor-not-allowed shadow-sm transition-all flex items-center gap-2"
> >
Submit Request <CreditCard className="w-4 h-4" /> Submit Request
</button> </button>
</div> </div>
</div> </div>
</div> </div>
</div>
)} )}
{/* Auto-Withdraw Modal */} {/* Auto-Withdraw Modal */}
@@ -400,11 +389,11 @@ export default function InvestorWithdrawPage() {
<div className="bg-white rounded-xl shadow-xl w-full max-w-md"> <div className="bg-white rounded-xl shadow-xl w-full max-w-md">
<div className="p-5 border-b border-slate-100 flex items-center justify-between"> <div className="p-5 border-b border-slate-100 flex items-center justify-between">
<h3 className="text-lg font-bold text-slate-800">Auto-Withdraw Settings</h3> <h3 className="text-lg font-bold text-slate-800">Auto-Withdraw Settings</h3>
<button onClick={() => setShowAutoWithdrawModal(false)} className="p-1 hover:bg-slate-100 rounded-lg"> <button onClick={() => setShowAutoWithdrawModal(false)} className="p-1.5 hover:bg-slate-100 rounded-lg">
<X className="w-5 h-5 text-slate-400" /> <X className="w-5 h-5 text-slate-400" />
</button> </button>
</div> </div>
<div className="p-5 space-y-4"> <div className="p-5 space-y-5">
<div> <div>
<label className="text-sm font-medium text-slate-700 mb-2 block">Enable Auto-Withdraw</label> <label className="text-sm font-medium text-slate-700 mb-2 block">Enable Auto-Withdraw</label>
<div className="flex items-center gap-3 p-3 bg-slate-50 rounded-lg"> <div className="flex items-center gap-3 p-3 bg-slate-50 rounded-lg">
@@ -423,7 +412,7 @@ export default function InvestorWithdrawPage() {
<select <select
value={autoWithdrawFreq} value={autoWithdrawFreq}
onChange={(e) => setAutoWithdrawFreq(e.target.value)} onChange={(e) => setAutoWithdrawFreq(e.target.value)}
className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm" className="w-full px-3 py-2.5 border border-slate-200 rounded-lg text-sm bg-white"
> >
<option value="as_per_request">As Requested</option> <option value="as_per_request">As Requested</option>
<option value="weekly">Weekly</option> <option value="weekly">Weekly</option>
@@ -434,59 +423,57 @@ export default function InvestorWithdrawPage() {
<div> <div>
<label className="text-sm font-medium text-slate-700 mb-2 block">Minimum Amount</label> <label className="text-sm font-medium text-slate-700 mb-2 block">Minimum Amount</label>
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">
<span className="px-3 py-2 bg-slate-100 rounded-lg text-slate-500 font-bold"></span> <span className="px-3 py-2.5 bg-slate-100 rounded-lg text-slate-500 font-bold"></span>
<input <input
type="number" type="number"
value={autoWithdrawMin} value={autoWithdrawMin}
onChange={(e) => setAutoWithdrawMin(e.target.value)} onChange={(e) => setAutoWithdrawMin(e.target.value)}
className="flex-1 px-3 py-2 border border-slate-200 rounded-lg text-sm" className="flex-1 px-3 py-2.5 border border-slate-200 rounded-lg text-sm"
placeholder="1000" placeholder="1000"
/> />
</div> </div>
<p className="text-xs text-slate-500 mt-1">Minimum balance required for auto-withdrawal</p> <p className="text-xs text-slate-500 mt-1.5">Minimum balance required for auto-withdrawal</p>
</div> </div>
<div> <div>
<label className="text-sm font-medium text-slate-700 mb-2 block">Destination Account</label> <label className="text-sm font-medium text-slate-700 mb-2 block">Destination Account</label>
<div className="space-y-2"> <div className="space-y-2">
{(investor as any).bankAccounts?.map((account: any) => ( {(investor as any).bankAccounts?.map((account: any) => (
<div key={account.id} className="flex items-center gap-3 p-3 bg-slate-50 rounded-lg"> <div key={account.id} className="flex items-center gap-3 p-3 bg-slate-50 rounded-lg border border-slate-100">
<input <input
type="radio" type="radio"
name="destAccount" name="destAccount"
checked={autoWithdrawAccount === account.id} checked={autoWithdrawAccount === account.id}
onChange={() => setAutoWithdrawAccount(account.id)} onChange={() => setAutoWithdrawAccount(account.id)}
className="text-investor" className="w-4 h-4 text-investor"
/> />
<div className="flex-1"> <div className="flex-1">
<p className="font-medium text-slate-700">{account.bankName}</p> <p className="font-medium text-slate-700">{account.bankName}</p>
<p className="text-xs text-slate-500 font-mono">{account.accountNumber}</p> <p className="text-xs text-slate-500 font-mono">{account.accountNumber}</p>
</div> </div>
{account.isPrimary && <span className="text-xs bg-green-100 text-green-700 px-2 py-1 rounded-full">Primary</span>}
</div> </div>
))} ))}
{(investor as any).mobileBanking && ( {(investor as any).mobileBanking && (
<div className="flex items-center gap-3 p-3 bg-purple-50 rounded-lg"> <div className="flex items-center gap-3 p-3 bg-purple-50 rounded-lg border border-purple-100">
<input <input
type="radio" type="radio"
name="destAccount" name="destAccount"
checked={autoWithdrawAccount === 'mobile'} checked={autoWithdrawAccount === 'mobile'}
onChange={() => setAutoWithdrawAccount('mobile')} onChange={() => setAutoWithdrawAccount('mobile')}
className="text-investor" className="w-4 h-4 text-investor"
/> />
<div className="flex-1"> <div className="flex-1">
<p className="font-medium text-slate-700">{(investor as any).mobileBanking}</p> <p className="font-medium text-slate-700">{(investor as any).mobileBanking}</p>
<p className="text-xs text-slate-500 font-mono">{(investor as any).mobileBankingNumber}</p> <p className="text-xs text-slate-500 font-mono">{(investor as any).mobileBankingNumber}</p>
</div> </div>
<span className="text-xs bg-purple-100 text-purple-700 px-2 py-1 rounded-full">Primary</span>
</div> </div>
)} )}
</div> </div>
</div> </div>
</div> </div>
<div className="p-5 border-t border-slate-100 flex justify-end gap-3"> <div className="p-5 border-t border-slate-100 flex justify-end gap-3 bg-slate-50">
<button onClick={() => setShowAutoWithdrawModal(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={() => setShowAutoWithdrawModal(false)} className="px-4 py-2 border border-slate-200 text-slate-600 rounded-lg text-sm font-medium hover:bg-white">Cancel</button>
<button onClick={handleSaveAutoWithdraw} className="px-4 py-2 bg-investor text-white rounded-lg text-sm font-medium hover:bg-investor-dark">Save Settings</button> <button onClick={handleSaveAutoWithdraw} className="px-5 py-2 bg-investor text-white rounded-lg text-sm font-medium hover:bg-investor-dark shadow-sm">Save Settings</button>
</div> </div>
</div> </div>
</div> </div>