-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
222 lines (189 loc) · 7.86 KB
/
index.html
File metadata and controls
222 lines (189 loc) · 7.86 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Payment Calculator</title>
<style>
:root {
--primary-color: #25D366; /* WhatsApp Green */
--primary-hover: #128C7E;
--bg-color: #f0f2f5;
--card-bg: #ffffff;
--text-color: #333333;
--border-radius: 12px;
}
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
background-color: var(--bg-color);
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
margin: 0;
color: var(--text-color);
}
.container {
background-color: var(--card-bg);
padding: 2rem;
border-radius: var(--border-radius);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
width: 100%;
max-width: 400px;
text-align: center;
}
h2 {
margin-bottom: 1.5rem;
color: #1a1a1a;
}
.input-group {
margin-bottom: 1.5rem;
text-align: left;
}
label {
display: block;
margin-bottom: 0.5rem;
font-weight: 600;
font-size: 0.9rem;
color: #555;
}
input[type="number"] {
width: 100%;
padding: 12px;
border: 2px solid #ddd;
border-radius: 8px;
font-size: 1rem;
box-sizing: border-box; /* Ensures padding doesn't affect width */
transition: border-color 0.3s;
}
input[type="number"]:focus {
border-color: var(--primary-color);
outline: none;
}
.btn-calc {
background-color: #007bff;
color: white;
border: none;
padding: 12px 24px;
font-size: 1rem;
border-radius: 8px;
cursor: pointer;
width: 100%;
transition: background-color 0.2s;
}
.btn-calc:hover {
background-color: #0056b3;
}
/* Results Section (Hidden by default) */
#result-section {
display: none;
margin-top: 2rem;
border-top: 1px solid #eee;
padding-top: 1.5rem;
animation: fadeIn 0.5s ease-in-out;
}
@keyframes fadeIn {
from { opacity: 0; transform: translateY(10px); }
to { opacity: 1; transform: translateY(0); }
}
.amount-display {
font-size: 2rem;
font-weight: bold;
color: #1a1a1a;
margin: 0.5rem 0;
}
.amount-label {
font-size: 0.9rem;
color: #666;
}
.whatsapp-btn {
display: inline-flex;
align-items: center;
justify-content: center;
background-color: var(--primary-color);
color: white;
text-decoration: none;
padding: 12px 20px;
border-radius: 8px;
font-weight: bold;
margin-top: 1rem;
width: 100%;
box-sizing: border-box;
transition: background-color 0.2s;
}
.whatsapp-btn:hover {
background-color: var(--primary-hover);
}
.whatsapp-icon {
width: 20px;
height: 20px;
margin-right: 8px;
fill: white;
}
.error-msg {
color: #dc3545;
font-size: 0.85rem;
margin-top: 0.5rem;
display: none;
}
</style>
</head>
<body>
<div class="container">
<h2>Payment Calculator</h2>
<div class="input-group">
<label for="bdtInput">Enter Total Amount (BDT)</label>
<input type="number" id="bdtInput" placeholder="e.g., 1000" min="0">
<div id="error-msg" class="error-msg">Please enter a valid positive number.</div>
</div>
<button class="btn-calc" onclick="calculatePayment()">Calculate Payable Amount</button>
<div id="result-section">
<div class="amount-label">You need to pay (80%):</div>
<div class="amount-display" id="displayAmount">৳ 0</div>
<p style="font-size: 0.9rem; color: #666; margin-bottom: 1rem;">
Click below to contact us on WhatsApp to complete your payment.
</p>
<a href="#" id="whatsappLink" class="whatsapp-btn" target="_blank">
<svg class="whatsapp-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M.057 24l1.687-6.163c-1.041-1.804-1.588-3.849-1.587-5.946.003-6.556 5.338-11.891 11.893-11.891 3.181.001 6.167 1.24 8.413 3.488 2.245 2.248 3.481 5.236 3.48 8.414-.003 6.557-5.338 11.892-11.893 11.892-1.99-.001-3.951-.5-5.688-1.448l-6.305 1.654zm6.597-3.807c1.676.995 3.276 1.591 5.392 1.592 5.448 0 9.886-4.434 9.889-9.885.002-5.462-4.415-9.89-9.881-9.892-5.452 0-9.887 4.434-9.889 9.884-.001 2.225.651 3.891 1.746 5.634l-.999 3.648 3.742-.981zm11.387-5.464c-.074-.124-.272-.198-.57-.347-.297-.149-1.758-868-2.031-.967-.272-.099-.47-.149-.669.149-.198.297-.768.967-.941 1.165-.173.198-.347.223-.644.074-.297-.149-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.297-.347.446-.521.151-.172.2-.296.3-.495.099-.198.05-.372-.025-.521-.075-.148-.669-1.611-.916-2.206-.242-.579-.487-.501-.669-.51l-.57-.01c-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.095 3.2 5.076 4.487.709.306 1.263.489 1.694.626.712.226 1.36.194 1.872.118.571-.085 1.758-.719 2.006-1.413.248-.695.248-1.29.173-1.414z"/></svg>
Pay via WhatsApp
</a>
</div>
</div>
<script>
// --- CONFIGURATION ---
// Replace this with your actual WhatsApp number (include country code, e.g., 880 for BD)
// Example: '8801712345678'
const WHATSAPP_NUMBER = '8801788001682';
// ---------------------
function calculatePayment() {
const inputField = document.getElementById('bdtInput');
const errorMsg = document.getElementById('error-msg');
const resultSection = document.getElementById('result-section');
const displayAmount = document.getElementById('displayAmount');
const whatsappLink = document.getElementById('whatsappLink');
const originalAmount = parseFloat(inputField.value);
// Validation
if (isNaN(originalAmount) || originalAmount <= 0) {
errorMsg.style.display = 'block';
resultSection.style.display = 'none';
return;
}
// Hide error if valid
errorMsg.style.display = 'none';
// Calculate 80%
const payableAmount = originalAmount * 0.80;
// Update UI
// Format number to 2 decimal places with currency symbol
displayAmount.textContent = `৳ ${payableAmount.toLocaleString('en-BD', { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`;
// Create the WhatsApp Message
// Message: "Hello, I want to pay [Amount] BDT (80% of [Original]). Please provide payment details."
const message = `Hello, I want to pay ${payableAmount} BDT (80% of ${originalAmount}). Please provide payment details.`;
// Generate the link
const encodedMessage = encodeURIComponent(message);
whatsappLink.href = `https://wa.me/${WHATSAPP_NUMBER}?text=${encodedMessage}`;
// Show results
resultSection.style.display = 'block';
}
</script>
</body>
</html>