Spaces:
Sleeping
Sleeping
Update templates/index.html
Browse files- templates/index.html +23 -204
templates/index.html
CHANGED
@@ -4,215 +4,27 @@
|
|
4 |
<head>
|
5 |
<meta charset="UTF-8">
|
6 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
7 |
-
<title>Biryani Hub -
|
8 |
-
<link
|
9 |
-
<style>
|
10 |
-
body {
|
11 |
-
font-family: 'Roboto', sans-serif;
|
12 |
-
background: linear-gradient(135deg, #f4c542, #ff8f6a);
|
13 |
-
margin: 0;
|
14 |
-
display: flex;
|
15 |
-
flex-direction: column;
|
16 |
-
justify-content: center;
|
17 |
-
align-items: center;
|
18 |
-
height: 100vh;
|
19 |
-
text-align: center;
|
20 |
-
}
|
21 |
-
.header-title {
|
22 |
-
font-size: 40px;
|
23 |
-
font-weight: bold;
|
24 |
-
color: white;
|
25 |
-
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
|
26 |
-
margin-bottom: 20px;
|
27 |
-
}
|
28 |
-
.container {
|
29 |
-
background-color: #fff;
|
30 |
-
padding: 40px 50px;
|
31 |
-
border-radius: 10px;
|
32 |
-
width: 500px;
|
33 |
-
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
|
34 |
-
display: none;
|
35 |
-
}
|
36 |
-
.form-container {
|
37 |
-
width: 100%;
|
38 |
-
}
|
39 |
-
h2 {
|
40 |
-
font-size: 24px;
|
41 |
-
font-weight: bold;
|
42 |
-
color: #ff6a00;
|
43 |
-
margin-bottom: 20px;
|
44 |
-
}
|
45 |
-
label {
|
46 |
-
font-size: 16px;
|
47 |
-
display: block;
|
48 |
-
text-align: left;
|
49 |
-
font-weight: bold;
|
50 |
-
color: #333;
|
51 |
-
margin-top: 10px;
|
52 |
-
}
|
53 |
-
input {
|
54 |
-
width: 100%;
|
55 |
-
padding: 12px;
|
56 |
-
font-size: 16px;
|
57 |
-
border: 2px solid #ccc;
|
58 |
-
border-radius: 8px;
|
59 |
-
margin-top: 8px;
|
60 |
-
box-sizing: border-box;
|
61 |
-
background-color: #f9f9f9;
|
62 |
-
}
|
63 |
-
input:focus {
|
64 |
-
border-color: #ff6a00;
|
65 |
-
outline: none;
|
66 |
-
}
|
67 |
-
.info {
|
68 |
-
margin-top: 20px;
|
69 |
-
font-size: 16px;
|
70 |
-
color: #ff6a00;
|
71 |
-
font-weight: bold;
|
72 |
-
}
|
73 |
-
.status {
|
74 |
-
font-size: 14px;
|
75 |
-
color: gray;
|
76 |
-
margin-top: 10px;
|
77 |
-
}
|
78 |
-
.confirmation {
|
79 |
-
display: none;
|
80 |
-
margin-top: 20px;
|
81 |
-
padding: 20px;
|
82 |
-
background: #fff;
|
83 |
-
border-radius: 10px;
|
84 |
-
text-align: center;
|
85 |
-
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
|
86 |
-
}
|
87 |
-
.confirm-button {
|
88 |
-
margin-top: 15px;
|
89 |
-
padding: 10px 20px;
|
90 |
-
background-color: #ff6a00;
|
91 |
-
color: white;
|
92 |
-
border: none;
|
93 |
-
border-radius: 5px;
|
94 |
-
cursor: pointer;
|
95 |
-
}
|
96 |
-
.confirm-button:hover {
|
97 |
-
background-color: #e65e00;
|
98 |
-
}
|
99 |
-
</style>
|
100 |
</head>
|
101 |
<body>
|
102 |
-
<
|
103 |
-
|
104 |
-
|
105 |
-
<
|
106 |
-
<h2>Register</h2>
|
107 |
-
<label for="name">Your Name</label>
|
108 |
-
<input type="text" id="name" placeholder="Your name will appear here..." readonly>
|
109 |
-
|
110 |
-
<label for="email">Your Email</label>
|
111 |
-
<input type="text" id="email" placeholder="Your email will appear here..." readonly>
|
112 |
|
113 |
-
|
114 |
-
|
115 |
|
116 |
-
|
117 |
-
|
118 |
-
</div>
|
119 |
-
|
120 |
-
<div class="container" id="loginForm">
|
121 |
-
<div class="form-container">
|
122 |
-
<h2>Login</h2>
|
123 |
-
<label for="loginEmail">Your Email</label>
|
124 |
-
<input type="text" id="loginEmail" placeholder="Your email will appear here..." readonly>
|
125 |
-
|
126 |
-
<label for="loginMobile">Your Mobile Number</label>
|
127 |
-
<input type="text" id="loginMobile" placeholder="Your mobile number will appear here..." readonly>
|
128 |
-
|
129 |
-
<p class="info" id="infoMessageLogin">Listening 🗣🎙️...</p>
|
130 |
-
</div>
|
131 |
-
</div>
|
132 |
|
133 |
-
|
134 |
-
|
135 |
-
<h2>Confirm Your Details:</h2>
|
136 |
-
<p><strong>Name:</strong> <span id="confirmName"></span></p>
|
137 |
-
<p><strong>Email:</strong> <span id="confirmEmail"></span></p>
|
138 |
-
<p><strong>Phone:</strong> <span id="confirmPhone"></span></p>
|
139 |
-
<button class="confirm-button" onclick="submitToSalesforce()">Confirm & Submit</button>
|
140 |
</div>
|
141 |
|
142 |
<script>
|
143 |
-
|
144 |
-
if ('webkitSpeechRecognition' in window) {
|
145 |
-
recognition = new webkitSpeechRecognition();
|
146 |
-
recognition.continuous = false;
|
147 |
-
recognition.interimResults = false;
|
148 |
-
recognition.lang = 'en-US';
|
149 |
-
}
|
150 |
-
|
151 |
-
function speak(text, callback) {
|
152 |
-
const speech = new SpeechSynthesisUtterance(text);
|
153 |
-
speech.onend = callback;
|
154 |
-
window.speechSynthesis.speak(speech);
|
155 |
-
}
|
156 |
-
|
157 |
-
function askLoginOrRegister() {
|
158 |
-
speak("Welcome to Biryani Hub. Say 'Register' to create an account or 'Login' to sign in.", function() {
|
159 |
-
recognition.start();
|
160 |
-
recognition.onresult = function(event) {
|
161 |
-
let response = event.results[0][0].transcript.trim().toLowerCase();
|
162 |
-
recognition.stop();
|
163 |
-
if (response.includes("register")) {
|
164 |
-
showRegistrationForm();
|
165 |
-
} else if (response.includes("login")) {
|
166 |
-
showLoginForm();
|
167 |
-
} else {
|
168 |
-
speak("I didn't understand. Please say 'Register' to sign up or 'Login' to sign in.", askLoginOrRegister);
|
169 |
-
}
|
170 |
-
};
|
171 |
-
});
|
172 |
-
}
|
173 |
-
|
174 |
-
function showRegistrationForm() {
|
175 |
-
document.getElementById('registrationForm').style.display = 'block';
|
176 |
-
document.getElementById('loginForm').style.display = 'none';
|
177 |
-
speak("Please say your name to begin registration.", startListeningForName);
|
178 |
-
}
|
179 |
-
|
180 |
-
function startListeningForName() {
|
181 |
-
recognition.start();
|
182 |
-
recognition.onresult = function(event) {
|
183 |
-
document.getElementById('name').value = event.results[0][0].transcript.trim();
|
184 |
-
recognition.stop();
|
185 |
-
speak("Now, say your email.", startListeningForEmail);
|
186 |
-
};
|
187 |
-
}
|
188 |
-
|
189 |
-
function startListeningForEmail() {
|
190 |
-
recognition.start();
|
191 |
-
recognition.onresult = function(event) {
|
192 |
-
document.getElementById('email').value = event.results[0][0].transcript.trim().replace(/\bat\b/g, '@').replace(/\s+/g, '');
|
193 |
-
recognition.stop();
|
194 |
-
speak("Now, say your mobile number.", startListeningForMobile);
|
195 |
-
};
|
196 |
-
}
|
197 |
-
|
198 |
-
function startListeningForMobile() {
|
199 |
-
recognition.start();
|
200 |
-
recognition.onresult = function(event) {
|
201 |
-
document.getElementById('mobile').value = event.results[0][0].transcript.trim().replace(/\s+/g, '');
|
202 |
-
recognition.stop();
|
203 |
-
confirmDetails();
|
204 |
-
};
|
205 |
-
}
|
206 |
-
|
207 |
-
function confirmDetails() {
|
208 |
-
document.getElementById('confirmName').textContent = document.getElementById('name').value;
|
209 |
-
document.getElementById('confirmEmail').textContent = document.getElementById('email').value;
|
210 |
-
document.getElementById('confirmPhone').textContent = document.getElementById('mobile').value;
|
211 |
-
document.getElementById('confirmationBox').style.display = 'block';
|
212 |
-
speak("Please confirm your details and submit.");
|
213 |
-
}
|
214 |
-
|
215 |
-
function submitToSalesforce() {
|
216 |
fetch('/register', {
|
217 |
method: 'POST',
|
218 |
headers: { 'Content-Type': 'application/json' },
|
@@ -221,10 +33,17 @@
|
|
221 |
email: document.getElementById('email').value,
|
222 |
phone: document.getElementById('mobile').value
|
223 |
})
|
224 |
-
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
225 |
}
|
226 |
-
|
227 |
-
window.onload = askLoginOrRegister;
|
228 |
</script>
|
229 |
</body>
|
230 |
</html>
|
|
|
4 |
<head>
|
5 |
<meta charset="UTF-8">
|
6 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
7 |
+
<title>Biryani Hub - Registration</title>
|
8 |
+
<link rel="stylesheet" href="{{ url_for('static', filename='styles.css') }}">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
</head>
|
10 |
<body>
|
11 |
+
<div class="container">
|
12 |
+
<h1>Welcome to Biryani Hub 🍽</h1>
|
13 |
+
<label for="name">Your Name</label>
|
14 |
+
<input type="text" id="name" placeholder="Your name..." readonly>
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
|
16 |
+
<label for="email">Your Email</label>
|
17 |
+
<input type="text" id="email" placeholder="Your email..." readonly>
|
18 |
|
19 |
+
<label for="mobile">Your Mobile Number</label>
|
20 |
+
<input type="text" id="mobile" placeholder="Your mobile number..." readonly>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
+
<p class="info" id="infoMessage">Listening 🗣🎙️...</p>
|
23 |
+
<button onclick="startRegistration()">Start Registration</button>
|
|
|
|
|
|
|
|
|
|
|
24 |
</div>
|
25 |
|
26 |
<script>
|
27 |
+
function startRegistration() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
fetch('/register', {
|
29 |
method: 'POST',
|
30 |
headers: { 'Content-Type': 'application/json' },
|
|
|
33 |
email: document.getElementById('email').value,
|
34 |
phone: document.getElementById('mobile').value
|
35 |
})
|
36 |
+
})
|
37 |
+
.then(response => response.json())
|
38 |
+
.then(data => {
|
39 |
+
if (data.success) {
|
40 |
+
alert("Registration successful! Redirecting to login...");
|
41 |
+
window.location.href = "/login";
|
42 |
+
} else {
|
43 |
+
alert("Error: " + data.error);
|
44 |
+
}
|
45 |
+
});
|
46 |
}
|
|
|
|
|
47 |
</script>
|
48 |
</body>
|
49 |
</html>
|