Spaces:
Running

File size: 20,583 Bytes
23bb73d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b36d344
23bb73d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>User Registration Portal</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        .animate-fade-in {
            animation: fadeIn 0.5s ease-in-out;
        }
        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(10px); }
            to { opacity: 1; transform: translateY(0); }
        }
        .input-highlight:focus {
            box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
        }
    </style>
</head>
<body class="bg-gradient-to-br from-blue-50 to-indigo-100 min-h-screen">
    <div class="container mx-auto px-4 py-12">
        <!-- Header -->
        <header class="text-center mb-12 animate-fade-in">
            <h1 class="text-4xl font-bold text-indigo-800 mb-2">User Registration</h1>
            <p class="text-lg text-gray-600 max-w-2xl mx-auto">Join our community by filling out this simple form. We'll keep your information secure.</p>
        </header>

        <!-- Main Content -->
        <div class="flex flex-col lg:flex-row gap-8 items-center justify-center">
            <!-- Illustration -->
            <div class="hidden lg:block lg:w-1/2 animate-fade-in">
                <div class="bg-indigo-100 rounded-2xl p-8">
                    <img src="https://illustrations.popsy.co/amber/secure-login.svg" alt="Registration illustration" class="w-full h-auto">
                    <div class="mt-6">
                        <h3 class="text-xl font-semibold text-indigo-800 mb-2">Why Register With Us?</h3>
                        <ul class="space-y-2 text-gray-700">
                            <li class="flex items-start">
                                <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                                <span>Secure data storage</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                                <span>Exclusive member benefits</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                                <span>Personalized experience</span>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>

            <!-- Registration Form -->
            <div class="w-full lg:w-1/2 animate-fade-in">
                <div class="bg-white rounded-2xl shadow-xl overflow-hidden">
                    <div class="p-8">
                        <form id="registrationForm" class="space-y-6">
                            <!-- Name Field -->
                            <div>
                                <label for="name" class="block text-sm font-medium text-gray-700 mb-1">Full Name</label>
                                <div class="relative">
                                    <div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
                                        <i class="fas fa-user text-gray-400"></i>
                                    </div>
                                    <input type="text" id="name" name="name" required
                                        class="input-highlight pl-10 w-full px-4 py-3 rounded-lg border border-gray-300 focus:border-indigo-500 focus:ring-1 focus:ring-indigo-500 transition duration-200"
                                        placeholder="John Doe">
                                </div>
                            </div>

                            <!-- Email Field -->
                            <div>
                                <label for="email" class="block text-sm font-medium text-gray-700 mb-1">Email Address</label>
                                <div class="relative">
                                    <div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
                                        <i class="fas fa-envelope text-gray-400"></i>
                                    </div>
                                    <input type="email" id="email" name="email" required
                                        class="input-highlight pl-10 w-full px-4 py-3 rounded-lg border border-gray-300 focus:border-indigo-500 focus:ring-1 focus:ring-indigo-500 transition duration-200"
                                        placeholder="your@email.com">
                                </div>
                            </div>

                            <!-- Phone Field -->
                            <div>
                                <label for="phone" class="block text-sm font-medium text-gray-700 mb-1">Phone Number</label>
                                <div class="relative">
                                    <div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
                                        <i class="fas fa-phone text-gray-400"></i>
                                    </div>
                                    <input type="tel" id="phone" name="phone"
                                        class="input-highlight pl-10 w-full px-4 py-3 rounded-lg border border-gray-300 focus:border-indigo-500 focus:ring-1 focus:ring-indigo-500 transition duration-200"
                                        placeholder="+1 (123) 456-7890">
                                </div>
                            </div>

                            <!-- Age Field -->
                            <div>
                                <label for="age" class="block text-sm font-medium text-gray-700 mb-1">Age</label>
                                <div class="relative">
                                    <div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
                                        <i class="fas fa-birthday-cake text-gray-400"></i>
                                    </div>
                                    <input type="number" id="age" name="age" min="13" max="120"
                                        class="input-highlight pl-10 w-full px-4 py-3 rounded-lg border border-gray-300 focus:border-indigo-500 focus:ring-1 focus:ring-indigo-500 transition duration-200"
                                        placeholder="Your age">
                                </div>
                            </div>

                            <!-- Gender Field -->
                            <div>
                                <label class="block text-sm font-medium text-gray-700 mb-1">Gender</label>
                                <div class="grid grid-cols-3 gap-3">
                                    <div>
                                        <input type="radio" id="male" name="gender" value="Male" class="hidden peer">
                                        <label for="male" class="flex items-center justify-center px-4 py-3 border border-gray-300 rounded-lg cursor-pointer peer-checked:border-indigo-500 peer-checked:bg-indigo-50 peer-checked:text-indigo-700 transition duration-200">
                                            <i class="fas fa-mars mr-2"></i> Male
                                        </label>
                                    </div>
                                    <div>
                                        <input type="radio" id="female" name="gender" value="Female" class="hidden peer">
                                        <label for="female" class="flex items-center justify-center px-4 py-3 border border-gray-300 rounded-lg cursor-pointer peer-checked:border-indigo-500 peer-checked:bg-indigo-50 peer-checked:text-indigo-700 transition duration-200">
                                            <i class="fas fa-venus mr-2"></i> Female
                                        </label>
                                    </div>
                                    <div>
                                        <input type="radio" id="other" name="gender" value="Other" class="hidden peer">
                                        <label for="other" class="flex items-center justify-center px-4 py-3 border border-gray-300 rounded-lg cursor-pointer peer-checked:border-indigo-500 peer-checked:bg-indigo-50 peer-checked:text-indigo-700 transition duration-200">
                                            <i class="fas fa-genderless mr-2"></i> Other
                                        </label>
                                    </div>
                                </div>
                            </div>

                            <!-- Interests Field -->
                            <div>
                                <label class="block text-sm font-medium text-gray-700 mb-1">Interests (Select up to 3)</label>
                                <div class="grid grid-cols-2 md:grid-cols-3 gap-2">
                                    <div>
                                        <input type="checkbox" id="tech" name="interests" value="Technology" class="hidden peer">
                                        <label for="tech" class="flex items-center justify-center px-3 py-2 border border-gray-300 rounded-lg cursor-pointer peer-checked:border-indigo-500 peer-checked:bg-indigo-50 peer-checked:text-indigo-700 transition duration-200 text-sm">
                                            <i class="fas fa-laptop-code mr-2"></i> Technology
                                        </label>
                                    </div>
                                    <div>
                                        <input type="checkbox" id="sports" name="interests" value="Sports" class="hidden peer">
                                        <label for="sports" class="flex items-center justify-center px-3 py-2 border border-gray-300 rounded-lg cursor-pointer peer-checked:border-indigo-500 peer-checked:bg-indigo-50 peer-checked:text-indigo-700 transition duration-200 text-sm">
                                            <i class="fas fa-running mr-2"></i> Sports
                                        </label>
                                    </div>
                                    <div>
                                        <input type="checkbox" id="music" name="interests" value="Music" class="hidden peer">
                                        <label for="music" class="flex items-center justify-center px-3 py-2 border border-gray-300 rounded-lg cursor-pointer peer-checked:border-indigo-500 peer-checked:bg-indigo-50 peer-checked:text-indigo-700 transition duration-200 text-sm">
                                            <i class="fas fa-music mr-2"></i> Music
                                        </label>
                                    </div>
                                    <div>
                                        <input type="checkbox" id="travel" name="interests" value="Travel" class="hidden peer">
                                        <label for="travel" class="flex items-center justify-center px-3 py-2 border border-gray-300 rounded-lg cursor-pointer peer-checked:border-indigo-500 peer-checked:bg-indigo-50 peer-checked:text-indigo-700 transition duration-200 text-sm">
                                            <i class="fas fa-plane mr-2"></i> Travel
                                        </label>
                                    </div>
                                    <div>
                                        <input type="checkbox" id="food" name="interests" value="Food" class="hidden peer">
                                        <label for="food" class="flex items-center justify-center px-3 py-2 border border-gray-300 rounded-lg cursor-pointer peer-checked:border-indigo-500 peer-checked:bg-indigo-50 peer-checked:text-indigo-700 transition duration-200 text-sm">
                                            <i class="fas fa-utensils mr-2"></i> Food
                                        </label>
                                    </div>
                                    <div>
                                        <input type="checkbox" id="art" name="interests" value="Art" class="hidden peer">
                                        <label for="art" class="flex items-center justify-center px-3 py-2 border border-gray-300 rounded-lg cursor-pointer peer-checked:border-indigo-500 peer-checked:bg-indigo-50 peer-checked:text-indigo-700 transition duration-200 text-sm">
                                            <i class="fas fa-paint-brush mr-2"></i> Art
                                        </label>
                                    </div>
                                </div>
                            </div>

                            <!-- Terms and Conditions -->
                            <div class="flex items-start">
                                <div class="flex items-center h-5">
                                    <input id="terms" name="terms" type="checkbox" required
                                        class="focus:ring-indigo-500 h-4 w-4 text-indigo-600 border-gray-300 rounded">
                                </div>
                                <div class="ml-3 text-sm">
                                    <label for="terms" class="font-medium text-gray-700">I agree to the <a href="#" class="text-indigo-600 hover:text-indigo-500">Terms and Conditions</a> and <a href="#" class="text-indigo-600 hover:text-indigo-500">Privacy Policy</a></label>
                                </div>
                            </div>

                            <!-- Submit Button -->
                            <div>
                                <button type="submit" id="submitBtn"
                                    class="w-full flex justify-center items-center py-3 px-4 border border-transparent rounded-lg shadow-sm text-lg font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 transition duration-200">
                                    <span id="buttonText">Complete Registration</span>
                                    <i id="spinner" class="fas fa-spinner fa-spin ml-2 hidden"></i>
                                </button>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>

        <!-- Success Modal (hidden by default) -->
        <div id="successModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
            <div class="bg-white rounded-2xl p-8 max-w-md w-full mx-4 transform transition-all duration-300 scale-95 opacity-0" id="modalContent">
                <div class="text-center">
                    <div class="mx-auto flex items-center justify-center h-16 w-16 rounded-full bg-green-100 mb-4">
                        <i class="fas fa-check text-green-600 text-2xl"></i>
                    </div>
                    <h3 class="text-2xl font-bold text-gray-900 mb-2">Registration Successful!</h3>
                    <p class="text-gray-600 mb-6">Thank you for registering. We've sent a confirmation email to your address.</p>
                    <button id="closeModal" class="px-6 py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700 transition duration-200">
                        Close
                    </button>
                </div>
            </div>
        </div>
    </div>

    <script>
        // Google Apps Script Deployment URL
        const scriptURL = "Your url";

        document.addEventListener('DOMContentLoaded', function() {
            const form = document.getElementById('registrationForm');
            const submitBtn = document.getElementById('submitBtn');
            const buttonText = document.getElementById('buttonText');
            const spinner = document.getElementById('spinner');
            const successModal = document.getElementById('successModal');
            const modalContent = document.getElementById('modalContent');
            const closeModal = document.getElementById('closeModal');

            // Limit interests selection to 3
            const interestCheckboxes = document.querySelectorAll('input[name="interests"]');
            interestCheckboxes.forEach(checkbox => {
                checkbox.addEventListener('change', function() {
                    const checkedCount = document.querySelectorAll('input[name="interests"]:checked').length;
                    if (checkedCount > 3) {
                        this.checked = false;
                        alert('You can select up to 3 interests only.');
                    }
                });
            });

            // Form submission
            form.addEventListener('submit', async (e) => {
                e.preventDefault();
                
                // Show loading state
                submitBtn.disabled = true;
                buttonText.textContent = 'Processing...';
                spinner.classList.remove('hidden');
                
                try {
                    // Get form data
                    const formData = new FormData(form);
                    const data = {
                        name: formData.get('name'),
                        email: formData.get('email'),
                        phone: formData.get('phone'),
                        age: formData.get('age'),
                        gender: form.querySelector('input[name="gender"]:checked')?.value || '',
                        interests: Array.from(document.querySelectorAll('input[name="interests"]:checked')).map(el => el.value).join(', '),
                        timestamp: new Date().toISOString()
                    };

                    // Send data to Google Sheets via Apps Script
                    const response = await fetch(scriptURL, {
                        method: 'POST',
                        headers: {
                            'Content-Type': 'application/json',
                        },
                        body: JSON.stringify(data)
                    });

                    if (response.ok) {
                        // Show success modal
                        successModal.classList.remove('hidden');
                        setTimeout(() => {
                            modalContent.classList.add('scale-100', 'opacity-100');
                            modalContent.classList.remove('scale-95', 'opacity-0');
                        }, 50);
                        
                        // Reset form
                        form.reset();
                    } else {
                        throw new Error('Network response was not ok');
                    }
                } catch (error) {
                    console.error('Error:', error);
                    alert('There was an error submitting the form. Please try again.');
                } finally {
                    // Reset button state
                    submitBtn.disabled = false;
                    buttonText.textContent = 'Complete Registration';
                    spinner.classList.add('hidden');
                }
            });

            // Close modal
            closeModal.addEventListener('click', function() {
                modalContent.classList.remove('scale-100', 'opacity-100');
                modalContent.classList.add('scale-95', 'opacity-0');
                setTimeout(() => {
                    successModal.classList.add('hidden');
                }, 300);
            });
        });
    </script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=G3Player/site" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>