File size: 13,649 Bytes
4ed6779
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Withdraw - BitVault Pro</title>
    <link rel="icon" type="image/x-icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>πŸ”</text></svg>">
    <link rel="stylesheet" href="style.css">
    <script src="https://cdn.tailwindcss.com"></script>
    <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
</head>
<body class="bg-slate-950 text-slate-100 min-h-screen">
    <!-- Dashboard Navigation -->
    <dashboard-nav></dashboard-nav>

    <!-- Main Content -->
    <main class="pt-24 pb-12 px-4 sm:px-6 lg:px-8 max-w-2xl mx-auto">
        <!-- Back Link -->
        <a href="index.html#dashboard" class="inline-flex items-center gap-2 text-slate-400 hover:text-violet-400 transition-colors mb-6">
            <i data-feather="arrow-left" class="w-4 h-4"></i>
            Back to Dashboard
        </a>

        <!-- Withdraw Card -->
        <div class="bg-slate-900/80 backdrop-blur-xl rounded-2xl border border-slate-800 p-8">
            <div class="text-center mb-8">
                <div class="w-20 h-20 rounded-full bg-violet-500/20 flex items-center justify-center mx-auto mb-4">
                    <i data-feather="arrow-up-right" class="w-10 h-10 text-violet-400"></i>
                </div>
                <h1 class="text-3xl font-bold mb-2">Withdraw Bitcoin</h1>
                <p class="text-slate-400">Send BTC to an external wallet address</p>
            </div>

            <!-- Balance Info -->
            <div class="p-4 rounded-xl bg-slate-800/50 mb-6 text-center">
                <div class="text-sm text-slate-400 mb-1">Available Balance</div>
                <div class="text-2xl font-bold text-emerald-400">7.0246 BTC</div>
                <div class="text-sm text-slate-500">β‰ˆ $470,000.00</div>
            </div>

            <!-- Withdraw Form -->
            <form id="withdraw-form" class="space-y-6">
                <!-- Amount -->
                <div>
                    <label class="block text-sm font-medium text-slate-300 mb-2">Amount (BTC)</label>
                    <div class="relative">
                        <input type="number" id="withdraw-amount" step="0.00000001" max="7.0246" class="w-full px-4 py-4 bg-slate-800 border border-slate-700 rounded-xl focus:outline-none focus:border-violet-500 focus:ring-1 focus:ring-violet-500 transition-colors text-lg" placeholder="0.00000000">
                        <button type="button" onclick="setMaxAmount()" class="absolute right-4 top-1/2 -translate-y-1/2 text-sm font-semibold text-violet-400 hover:text-violet-300">MAX</button>
                    </div>
                    <div class="mt-2 text-sm text-slate-500">Maximum: 7.0246 BTC</div>
                </div>

                <!-- Recipient Address -->
                <div>
                    <label class="block text-sm font-medium text-slate-300 mb-2">Recipient Bitcoin Address</label>
                    <input type="text" id="withdraw-address" class="w-full px-4 py-4 bg-slate-800 border border-slate-700 rounded-xl focus:outline-none focus:border-violet-500 focus:ring-1 focus:ring-violet-500 transition-colors font-mono" placeholder="bc1q... or 1... or 3...">
                </div>

                <!-- Network Fee -->
                <div class="p-4 rounded-xl bg-slate-800/50">
                    <div class="flex items-center justify-between text-sm mb-2">
                        <span class="text-slate-400">Network Fee</span>
                        <span class="text-slate-300">0.0001 BTC (~$6.50)</span>
                    </div>
                    <div class="flex items-center justify-between">
                        <span class="text-slate-400">You will receive</span>
                        <span class="font-bold text-lg" id="receive-amount">0.0000 BTC</span>
                    </div>
                </div>

                <!-- Security Notice -->
                <div class="p-4 rounded-xl bg-amber-500/10 border border-amber-500/20">
                    <div class="flex items-start gap-3">
                        <i data-feather="shield" class="w-5 h-5 text-amber-400 flex-shrink-0 mt-0.5"></i>
                        <div class="text-sm text-amber-200">
                            <strong>Security Check:</strong> Please verify the recipient address carefully. Bitcoin transactions cannot be reversed once confirmed.
                        </div>
                    </div>
                </div>

                <!-- Submit Button -->
                <button type="submit" class="w-full py-4 bg-gradient-to-r from-violet-500 to-violet-600 hover:from-violet-400 hover:to-violet-500 rounded-xl font-semibold transition-all duration-300 shadow-lg shadow-violet-500/25 flex items-center justify-center gap-2">
                    <i data-feather="send" class="w-5 h-5"></i>
                    Continue Withdrawal
                </button>
            </form>
        </div>

        <!-- Recent Withdrawals -->
        <div class="mt-8 bg-slate-900/80 backdrop-blur-xl rounded-2xl border border-slate-800 p-6">
            <h2 class="text-lg font-semibold mb-4">Recent Withdrawals</h2>
            <div class="space-y-3">
                <div class="flex items-center justify-between p-4 rounded-xl bg-slate-800/50">
                    <div class="flex items-center gap-3">
                        <div class="w-10 h-10 rounded-full bg-violet-500/20 flex items-center justify-center">
                            <i data-feather="arrow-up-right" class="w-5 h-5 text-violet-400"></i>
                        </div>
                        <div>
                            <div class="font-medium">Withdrawal Sent</div>
                            <div class="text-sm text-slate-500">Dec 15, 2024</div>
                        </div>
                    </div>
                    <div class="text-right">
                        <div class="font-semibold text-violet-400">-0.5 BTC</div>
                        <div class="text-sm text-emerald-400">Completed</div>
                    </div>
                </div>
                <div class="flex items-center justify-between p-4 rounded-xl bg-slate-800/50">
                    <div class="flex items-center gap-3">
                        <div class="w-10 h-10 rounded-full bg-violet-500/20 flex items-center justify-center">
                            <i data-feather="arrow-up-right" class="w-5 h-5 text-violet-400"></i>
                        </div>
                        <div>
                            <div class="font-medium">Withdrawal Sent</div>
                            <div class="text-sm text-slate-500">Dec 10, 2024</div>
                        </div>
                    </div>
                    <div class="text-right">
                        <div class="font-semibold text-violet-400">-1.2 BTC</div>
                        <div class="text-sm text-emerald-400">Completed</div>
                    </div>
                </div>
            </div>
        </div>
    </main>

    <!-- Confirmation Modal -->
    <div id="confirm-modal" class="fixed inset-0 z-50 hidden">
        <div class="absolute inset-0 bg-slate-950/80 backdrop-blur-sm"></div>
        <div class="relative flex items-center justify-center min-h-screen p-4">
            <div class="w-full max-w-md bg-slate-900 rounded-2xl border border-slate-800 p-8 shadow-2xl">
                <div class="text-center mb-6">
                    <div class="w-16 h-16 rounded-full bg-amber-500/20 flex items-center justify-center mx-auto mb-4">
                        <i data-feather="alert-triangle" class="w-8 h-8 text-amber-400"></i>
                    </div>
                    <h2 class="text-2xl font-bold">Confirm Withdrawal</h2>
                    <p class="text-slate-400">Please review the details carefully</p>
                </div>

                <div class="space-y-4 mb-6">
                    <div class="flex items-center justify-between p-3 rounded-lg bg-slate-800/50">
                        <span class="text-slate-400">Amount</span>
                        <span class="font-semibold" id="confirm-amount">-</span>
                    </div>
                    <div class="flex items-center justify-between p-3 rounded-lg bg-slate-800/50">
                        <span class="text-slate-400">Network Fee</span>
                        <span class="font-semibold">0.0001 BTC</span>
                    </div>
                    <div class="flex items-center justify-between p-3 rounded-lg bg-slate-800/50">
                        <span class="text-slate-400">Total Deduction</span>
                        <span class="font-semibold text-violet-400" id="confirm-total">-</span>
                    </div>
                    <div class="p-3 rounded-lg bg-slate-800/50">
                        <div class="text-sm text-slate-400 mb-1">Recipient Address</div>
                        <div class="font-mono text-sm break-all" id="confirm-address">-</div>
                    </div>
                </div>

                <div class="flex gap-3">
                    <button onclick="closeConfirmModal()" class="flex-1 py-3 bg-slate-700 hover:bg-slate-600 rounded-xl font-semibold transition-colors">
                        Cancel
                    </button>
                    <button onclick="processWithdrawal()" class="flex-1 py-3 bg-gradient-to-r from-violet-500 to-violet-600 hover:from-violet-400 hover:to-violet-500 rounded-xl font-semibold transition-all">
                        Confirm & Send
                    </button>
                </div>
            </div>
        </div>
    </div>

    <!-- Success Modal -->
    <div id="success-modal" class="fixed inset-0 z-50 hidden">
        <div class="absolute inset-0 bg-slate-950/80 backdrop-blur-sm"></div>
        <div class="relative flex items-center justify-center min-h-screen p-4">
            <div class="w-full max-w-md bg-slate-900 rounded-2xl border border-slate-800 p-8 shadow-2xl text-center">
                <div class="w-20 h-20 rounded-full bg-emerald-500/20 flex items-center justify-center mx-auto mb-4">
                    <i data-feather="check-circle" class="w-10 h-10 text-emerald-400"></i>
                </div>
                <h2 class="text-2xl font-bold mb-2">Withdrawal Initiated</h2>
                <p class="text-slate-400 mb-6">Your transaction has been submitted and is being processed.</p>
                <div class="p-4 rounded-xl bg-slate-800/50 mb-6">
                    <div class="text-sm text-slate-400 mb-1">Transaction ID</div>
                    <div class="font-mono text-sm text-emerald-400">txid_8f2a9b4c7d1e5f3a6b8c2d4e7f9a1b3c</div>
                </div>
                <button onclick="closeSuccessModal()" class="w-full py-3 bg-emerald-500 hover:bg-emerald-400 rounded-xl font-semibold transition-colors">
                    Back to Dashboard
                </button>
            </div>
        </div>
    </div>

    <script src="components/dashboard-nav.js"></script>
    <script>
        feather.replace();

        const btcBalance = 7.0246;
        const networkFee = 0.0001;

        // Check login status
        if (!sessionStorage.getItem('isLoggedIn')) {
            window.location.href = 'index.html';
        }

        // Amount input handler
        document.getElementById('withdraw-amount').addEventListener('input', updateReceiveAmount);

        function updateReceiveAmount() {
            const amount = parseFloat(document.getElementById('withdraw-amount').value) || 0;
            const receive = Math.max(0, amount - networkFee);
            document.getElementById('receive-amount').textContent = receive.toFixed(8) + ' BTC';
        }

        function setMaxAmount() {
            document.getElementById('withdraw-amount').value = btcBalance.toFixed(8);
            updateReceiveAmount();
        }

        // Form submission
        document.getElementById('withdraw-form').addEventListener('submit', function(e) {
            e.preventDefault();
            
            const amount = parseFloat(document.getElementById('withdraw-amount').value);
            const address = document.getElementById('withdraw-address').value.trim();

            if (!amount || amount <= 0 || amount > btcBalance) {
                alert('Please enter a valid amount');
                return;
            }
            if (!address || address.length < 10) {
                alert('Please enter a valid Bitcoin address');
                return;
            }

            // Show confirmation modal
            document.getElementById('confirm-amount').textContent = amount.toFixed(8) + ' BTC';
            document.getElementById('confirm-total').textContent = (amount + networkFee).toFixed(8) + ' BTC';
            document.getElementById('confirm-address').textContent = address;
            document.getElementById('confirm-modal').classList.remove('hidden');
        });

        function closeConfirmModal() {
            document.getElementById('confirm-modal').classList.add('hidden');
        }

        function processWithdrawal() {
            closeConfirmModal();
            document.getElementById('success-modal').classList.remove('hidden');
        }

        function closeSuccessModal() {
            document.getElementById('success-modal').classList.add('hidden');
            window.location.href = 'index.html#dashboard';
        }
    </script>
</body>
</html>