SakibAhmed commited on
Commit
a6f8728
·
verified ·
1 Parent(s): fe6b222

Upload index.html

Browse files
Files changed (1) hide show
  1. index.html +426 -0
index.html ADDED
@@ -0,0 +1,426 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Lead Registration</title>
7
+ <style>
8
+ /* CSS Reset & Base */
9
+ * { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }
10
+ body {
11
+ background: linear-gradient(135deg, #a1c4fd 0%, #c2e9fb 100%);
12
+ display: flex;
13
+ justify-content: center;
14
+ align-items: center;
15
+ min-height: 100vh;
16
+ padding: 20px;
17
+ }
18
+
19
+ /* Card Container */
20
+ .card {
21
+ display: flex;
22
+ background: white;
23
+ border-radius: 15px;
24
+ box-shadow: 0 10px 30px rgba(0,0,0,0.2);
25
+ overflow: hidden;
26
+ width: 1000px;
27
+ max-width: 100%;
28
+ min-height: 600px;
29
+ }
30
+
31
+ /* Left Panel (White) */
32
+ .left-panel {
33
+ flex: 1;
34
+ padding: 50px;
35
+ background: #fff;
36
+ }
37
+
38
+ /* Right Panel (Blue) */
39
+ .right-panel {
40
+ flex: 1;
41
+ padding: 50px;
42
+ background: #4d4dff;
43
+ color: white;
44
+ }
45
+
46
+ /* Headings */
47
+ h2 { margin-bottom: 30px; font-weight: 600; font-size: 1.5rem; }
48
+ .left-panel h2 { color: #3b4d81; }
49
+ .right-panel h2 { color: white; }
50
+
51
+ /* Form Grid System */
52
+ .form-row {
53
+ display: flex;
54
+ gap: 20px;
55
+ margin-bottom: 25px;
56
+ }
57
+ .form-group {
58
+ flex: 1;
59
+ position: relative;
60
+ }
61
+
62
+ /* Inputs - General Styling */
63
+ input, select {
64
+ width: 100%;
65
+ padding: 12px 0 8px 0;
66
+ border: none;
67
+ outline: none;
68
+ font-size: 0.95rem;
69
+ transition: 0.3s;
70
+ background: transparent;
71
+ }
72
+
73
+ /* Left Panel Input Styling (Light) */
74
+ .left-panel input, .left-panel select {
75
+ border-bottom: 2px solid #ddd;
76
+ color: #333;
77
+ }
78
+ .left-panel input::placeholder {
79
+ color: #999;
80
+ opacity: 1;
81
+ }
82
+ .left-panel input:focus, .left-panel select:focus {
83
+ border-bottom-color: #4d4dff;
84
+ }
85
+ .left-panel select {
86
+ cursor: pointer;
87
+ appearance: none;
88
+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
89
+ background-repeat: no-repeat;
90
+ background-position: right center;
91
+ }
92
+ .left-panel select option {
93
+ color: #333;
94
+ background: white;
95
+ }
96
+
97
+ /* Right Panel Input Styling (Dark/Blue) */
98
+ .right-panel input, .right-panel select {
99
+ border-bottom: 2px solid rgba(255,255,255,0.4);
100
+ color: white;
101
+ }
102
+ .right-panel input::placeholder {
103
+ color: rgba(255,255,255,0.7);
104
+ opacity: 1;
105
+ }
106
+ .right-panel select {
107
+ cursor: pointer;
108
+ appearance: none;
109
+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23ffffff' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
110
+ background-repeat: no-repeat;
111
+ background-position: right center;
112
+ }
113
+ .right-panel select option {
114
+ color: #333;
115
+ background: #4d4dff;
116
+ }
117
+ .right-panel input:focus, .right-panel select:focus {
118
+ border-bottom-color: white;
119
+ }
120
+
121
+ /* Checkbox */
122
+ .checkbox-group {
123
+ display: flex;
124
+ align-items: center;
125
+ font-size: 0.85rem;
126
+ margin-top: 20px;
127
+ margin-bottom: 30px;
128
+ color: rgba(255,255,255,0.9);
129
+ }
130
+ .checkbox-group input {
131
+ width: auto;
132
+ margin-right: 10px;
133
+ cursor: pointer;
134
+ }
135
+ .checkbox-group label {
136
+ cursor: pointer;
137
+ }
138
+
139
+ /* Button */
140
+ .btn-submit {
141
+ background: white;
142
+ color: #4d4dff;
143
+ border: none;
144
+ padding: 12px 30px;
145
+ border-radius: 25px;
146
+ font-weight: bold;
147
+ cursor: pointer;
148
+ font-size: 1rem;
149
+ transition: all 0.2s;
150
+ }
151
+ .btn-submit:hover {
152
+ transform: scale(1.05);
153
+ box-shadow: 0 4px 15px rgba(255,255,255,0.3);
154
+ }
155
+ .btn-submit:disabled {
156
+ opacity: 0.6;
157
+ cursor: not-allowed;
158
+ transform: scale(1);
159
+ }
160
+
161
+ /* Alert Messages */
162
+ .alert {
163
+ padding: 15px 20px;
164
+ margin-bottom: 25px;
165
+ border-radius: 8px;
166
+ display: none; /* Hidden by default */
167
+ font-size: 0.9rem;
168
+ animation: slideIn 0.3s ease-out;
169
+ }
170
+ .alert.success {
171
+ background: #d4edda;
172
+ color: #155724;
173
+ border-left: 4px solid #28a745;
174
+ }
175
+ .alert.error {
176
+ background: #f8d7da;
177
+ color: #721c24;
178
+ border-left: 4px solid #dc3545;
179
+ }
180
+ .alert.show {
181
+ display: block; /* Visible when class 'show' is added */
182
+ }
183
+
184
+ @keyframes slideIn {
185
+ from {
186
+ opacity: 0;
187
+ transform: translateY(-10px);
188
+ }
189
+ to {
190
+ opacity: 1;
191
+ transform: translateY(0);
192
+ }
193
+ }
194
+
195
+ /* Responsive Mobile */
196
+ @media (max-width: 768px) {
197
+ .card { flex-direction: column; }
198
+ .left-panel, .right-panel { padding: 30px; }
199
+ .form-row { flex-direction: column; gap: 15px; }
200
+ }
201
+ </style>
202
+ </head>
203
+ <body>
204
+
205
+ <!-- Link to Dashboard for Hugging Face Space -->
206
+ <div style="position: absolute; top: 20px; right: 20px; z-index: 100;">
207
+ <a href="/" style="background: white; padding: 10px 20px; border-radius: 20px; text-decoration: none; font-weight: bold; color: #4d4dff; box-shadow: 0 2px 10px rgba(0,0,0,0.1); font-size: 0.9rem;">View CRM Dashboard &rarr;</a>
208
+ </div>
209
+
210
+ <div class="card">
211
+ <!-- Left Side: General Info -->
212
+ <div class="left-panel">
213
+ <h2>General Information</h2>
214
+
215
+ <!-- Alert Box for Success/Error -->
216
+ <div id="alertBox" class="alert"></div>
217
+
218
+ <form id="leadForm">
219
+ <div class="form-row">
220
+ <div class="form-group">
221
+ <input type="text" name="first_name" placeholder="First Name *" required>
222
+ </div>
223
+ <div class="form-group">
224
+ <input type="text" name="last_name" placeholder="Last Name *" required>
225
+ </div>
226
+ </div>
227
+
228
+ <div class="form-row">
229
+ <div class="form-group">
230
+ <input type="email" name="email" placeholder="Email Address *" required>
231
+ </div>
232
+ </div>
233
+
234
+ <div class="form-row">
235
+ <div class="form-group">
236
+ <select name="source" required>
237
+ <option value="" disabled selected>How did you hear about us? *</option>
238
+ <option value="Google Ads">Google Ads</option>
239
+ <option value="Facebook">Facebook</option>
240
+ <option value="LinkedIn">LinkedIn</option>
241
+ <option value="Twitter">Twitter</option>
242
+ <option value="Referral">Referral</option>
243
+ <option value="Direct">Direct</option>
244
+ <option value="Other">Other</option>
245
+ </select>
246
+ </div>
247
+ </div>
248
+
249
+ <div class="form-row">
250
+ <div class="form-group">
251
+ <input type="text" name="company" placeholder="Company Name (Optional)">
252
+ </div>
253
+ </div>
254
+
255
+ <div class="form-row">
256
+ <div class="form-group">
257
+ <select name="position">
258
+ <option value="" disabled selected>Position (Optional)</option>
259
+ <option value="Developer">Developer</option>
260
+ <option value="Manager">Manager</option>
261
+ <option value="Director">Director</option>
262
+ <option value="Executive">Executive</option>
263
+ <option value="Other">Other</option>
264
+ </select>
265
+ </div>
266
+ </div>
267
+ </div>
268
+
269
+ <!-- Right Side: Contact Details -->
270
+ <div class="right-panel">
271
+ <h2>Additional Information</h2>
272
+
273
+ <div class="form-row">
274
+ <div class="form-group">
275
+ <select name="city" required>
276
+ <option value="" disabled selected>City *</option>
277
+ <option value="Dhaka">Dhaka</option>
278
+ <option value="Chittagong">Chittagong</option>
279
+ <option value="Winnipeg">Winnipeg</option>
280
+ <option value="Toronto">Toronto</option>
281
+ <option value="Vancouver">Vancouver</option>
282
+ <option value="Montreal">Montreal</option>
283
+ <option value="Calgary">Calgary</option>
284
+ <option value="New York">New York</option>
285
+ <option value="Los Angeles">Los Angeles</option>
286
+ <option value="Chicago">Chicago</option>
287
+ <option value="Other">Other</option>
288
+ </select>
289
+ </div>
290
+ </div>
291
+
292
+ <div class="form-row">
293
+ <div class="form-group">
294
+ <select name="budget" required>
295
+ <option value="" disabled selected>Budget Range *</option>
296
+ <option value="1000">Under $1,000</option>
297
+ <option value="5000">$1,000 - $5,000</option>
298
+ <option value="10000">$5,000 - $10,000</option>
299
+ <option value="25000">$10,000 - $25,000</option>
300
+ <option value="50000">$25,000 - $50,000</option>
301
+ <option value="100000">$50,000+</option>
302
+ </select>
303
+ </div>
304
+ </div>
305
+
306
+ <div class="form-row">
307
+ <div class="form-group">
308
+ <input type="tel" name="phone" placeholder="Phone Number (Optional)">
309
+ </div>
310
+ </div>
311
+
312
+ <div class="form-row">
313
+ <div class="form-group">
314
+ <input type="text" name="address" placeholder="Street Address (Optional)">
315
+ </div>
316
+ </div>
317
+
318
+ <div class="form-row">
319
+ <div class="form-group">
320
+ <input type="text" name="zip_code" placeholder="Zip/Postal Code (Optional)">
321
+ </div>
322
+ </div>
323
+
324
+ <div class="checkbox-group">
325
+ <input type="checkbox" id="terms" required>
326
+ <label for="terms">I accept the Terms and Conditions *</label>
327
+ </div>
328
+
329
+ <button type="button" class="btn-submit" onclick="submitData()">Submit Lead</button>
330
+ </form>
331
+ </div>
332
+ </div>
333
+
334
+ <!-- JavaScript Handling Submission and Alerts -->
335
+ <script>
336
+ async function submitData() {
337
+ const form = document.getElementById('leadForm');
338
+ const alertBox = document.getElementById('alertBox');
339
+
340
+ // 1. Reset Alert State (Important for re-submission)
341
+ alertBox.className = 'alert';
342
+ alertBox.style.display = 'none';
343
+
344
+ // 2. Client-side Validation
345
+ if (!form.checkValidity()) {
346
+ showAlert("Please fill in all required fields marked with *", "error");
347
+ form.reportValidity();
348
+ return;
349
+ }
350
+
351
+ // 3. Gather Form Data
352
+ const formData = new FormData(form);
353
+ const data = Object.fromEntries(formData.entries());
354
+
355
+ // 4. UI Feedback (Disable Button)
356
+ const btn = document.querySelector('.btn-submit');
357
+ const originalText = btn.innerText;
358
+ btn.innerText = "Submitting...";
359
+ btn.disabled = true;
360
+
361
+ try {
362
+ // 5. Send POST Request
363
+ const response = await fetch('/submit', {
364
+ method: 'POST',
365
+ headers: { 'Content-Type': 'application/json' },
366
+ body: JSON.stringify(data)
367
+ });
368
+
369
+ const result = await response.json();
370
+
371
+ if (response.ok) {
372
+ // --- SUCCESS ---
373
+ const successMsg = result.message || "✅ Success! Lead submitted successfully.";
374
+ showAlert(successMsg, "success");
375
+
376
+ // Reset form fields
377
+ form.reset();
378
+ } else {
379
+ // --- SERVER/n8n ERROR ---
380
+ const errorMsg = result.error?.reason || result.message || "❌ Submission failed";
381
+ showAlert(`Error: ${errorMsg}`, "error");
382
+ }
383
+ } catch (error) {
384
+ // --- NETWORK ERROR ---
385
+ showAlert(`❌ Connection Error: ${error.message}`, "error");
386
+ } finally {
387
+ // 6. Reset Button State
388
+ btn.innerText = originalText;
389
+ btn.disabled = false;
390
+ }
391
+ }
392
+
393
+ function showAlert(message, type) {
394
+ const alertBox = document.getElementById('alertBox');
395
+
396
+ // Set message text
397
+ alertBox.textContent = message;
398
+
399
+ // Apply CSS classes (This triggers the visible styling)
400
+ alertBox.className = `alert ${type} show`;
401
+
402
+ // Ensure element is visible (Overrides any inline 'display: none')
403
+ alertBox.style.display = 'block';
404
+
405
+ // Scroll user to the message
406
+ alertBox.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
407
+
408
+ // Auto-hide success messages after 7 seconds
409
+ if (type === 'success') {
410
+ setTimeout(() => {
411
+ alertBox.style.display = 'none'; // Clean hide
412
+ alertBox.className = 'alert';
413
+ }, 7000);
414
+ }
415
+ }
416
+
417
+ // Allow submitting via Enter key
418
+ document.getElementById('leadForm').addEventListener('keypress', function(e) {
419
+ if (e.key === 'Enter' && e.target.tagName !== 'TEXTAREA') {
420
+ e.preventDefault();
421
+ submitData();
422
+ }
423
+ });
424
+ </script>
425
+ </body>
426
+ </html>