Srinivasulu kethanaboina commited on
Commit
2c05e02
·
verified ·
1 Parent(s): c2ac816

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +393 -14
index.html CHANGED
@@ -3,24 +3,403 @@
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>Public IP Address</title>
 
7
  </head>
8
  <body>
9
- <h1>Your Public IP Address</h1>
10
- <p id="ip-address">Loading...</p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
 
12
  <script>
13
- async function fetchPublicIP() {
14
- try {
15
- const response = await fetch('https://api.ipify.org?format=json');
16
- const data = await response.json();
17
- document.getElementById('ip-address').textContent = data.ip;
18
- } catch (error) {
19
- document.getElementById('ip-address').textContent = 'Unable to retrieve IP address';
20
- }
21
- }
22
-
23
- fetchPublicIP();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  </script>
 
25
  </body>
26
  </html>
 
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>RedFerns Tech Chatbot</title>
7
+ <link rel="stylesheet" href="styles.css">
8
  </head>
9
  <body>
10
+
11
+ <!-- Form Container -->
12
+ <div id="form-container">
13
+
14
+ <form id="user-form">
15
+ <h2>We need basic information to guide you</h2>
16
+ <input type="text" id="name" placeholder="Your Name" required>
17
+ <input type="text" id="company" placeholder="Company Name" required>
18
+ <input type="email" id="email" placeholder="Your Email" required>
19
+
20
+ <div>
21
+ <!-- Country Code Dropdown -->
22
+ <select id="country-code" required>
23
+ <option value="">Select a country</option>
24
+ <option value="AF">Afghanistan (+93)</option>
25
+ <option value="AL">Albania (+355)</option>
26
+
27
+ </select>
28
+ <input type="tel" id="phone" placeholder="Your Phone Number" required>
29
+ </div>
30
+
31
+ <button type="submit">Start Chat</button>
32
+ </form>
33
+
34
+
35
+ </div>
36
+
37
+ <!-- Chatbox -->
38
+ <div id="chat-box">
39
+ <div id="chat-header">
40
+ <span>FernAI</span>
41
+ <span id="close-chat">&times;</span>
42
+ </div>
43
+ <div id="chat-body"></div>
44
+ </div>
45
+
46
+ <!-- Gradio Iframe -->
47
+ <div id="gradio-iframe">
48
+ <div id="gradio-header">
49
+ <span>Chat With Expert</span>
50
+ <span id="back-button">&larr;</span>
51
+ </div>
52
+ <iframe src="" id="gradio-frame" frameborder="0" style="width: 100%; height: 100%;"></iframe>
53
+ </div>
54
+
55
+ <!-- Chat Icon -->
56
+ <div id="chat-icon">
57
+ <img src="https://raw.githubusercontent.com/SRINIVASULU-2003/srinu/main/static/bot.png" alt="Chat Icon">
58
+ </div>
59
 
60
  <script>
61
+ // Elements
62
+ // Elements
63
+ // Elements
64
+ const chatIcon = document.getElementById('chat-icon');
65
+ const formContainer = document.getElementById('form-container');
66
+ const chatBox = document.getElementById('chat-box');
67
+ const gradioIframe = document.getElementById('gradio-iframe');
68
+ const gradioFrame = document.getElementById('gradio-frame');
69
+ const closeChat = document.getElementById('close-chat');
70
+ const backButton = document.getElementById('back-button');
71
+ const userForm = document.getElementById('user-form');
72
+ const chatBody = document.getElementById('chat-body');
73
+
74
+ // Function to handle user input and display chat responses
75
+ function handleUserInput(input) {
76
+ // Display user message
77
+ const userMessage = document.createElement('div');
78
+ userMessage.className = 'message user-message';
79
+ userMessage.textContent = input;
80
+ chatBody.appendChild(userMessage);
81
+
82
+ // Create bot response
83
+ const botMessage = document.createElement('div');
84
+ botMessage.className = 'message bot-message';
85
+
86
+ // Define bot responses based on user input
87
+ switch (input) {
88
+ case 'Know more about RedFerns Tech':
89
+ botMessage.innerHTML = `
90
+ RedFerns Tech is a leading technology solutions provider specializing in Salesforce consultancy, Zoho services, ServiceNow implementation, and Data Science solutions.
91
+ <button onclick="handleUserInput('Menu')">Menu</button>
92
+ `;
93
+ break;
94
+ case 'Our services':
95
+ botMessage.innerHTML = `
96
+ We offer a range of services tailored to your needs. Please choose one:
97
+ <button onclick="handleUserInput('Salesforce')">Salesforce</button>
98
+ <button onclick="handleUserInput('Zoho')">Zoho</button>
99
+ <button onclick="handleUserInput('Machine Learning')">Machine Learning</button>
100
+ <button onclick="handleUserInput('Data Science')">Data Science</button>
101
+ <button onclick="handleUserInput('Menu')">Menu</button>
102
+ `;
103
+ break;
104
+ case 'Salesforce':
105
+ botMessage.innerHTML = `
106
+ We offer a range of services tailored to your needs. Please choose one:
107
+ <button onclick="handleUserInput('Lightning Service')">Lightning Service</button>
108
+ <button onclick="handleUserInput('Admin Support')">Admin Support</button>
109
+ <button onclick="handleUserInput('App Development')">App Development</button>
110
+ <button onclick="handleUserInput('Sites and Communities')">Sites and Communities</button>
111
+ <button onclick="handleUserInput('Menu')">Menu</button>
112
+ `;
113
+ break;
114
+ case 'Our products':
115
+ botMessage.innerHTML = `
116
+ We offer a range of services tailored to your needs. Please choose one:
117
+ <button onclick="handleUserInput('currency conversion app')">Currency Conversion App</button>
118
+ <button onclick="handleUserInput('mass approvals app')">Mass Approvals App</button>
119
+ <button onclick="handleUserInput('thumbnail viewer app')">Thumbnail Viewer App</button>
120
+ <button onclick="handleUserInput('product filter app')">Product Filter App</button>
121
+ <button onclick="handleUserInput('Menu')">Menu</button>
122
+ `;
123
+ break;
124
+ case 'Menu':
125
+ botMessage.innerHTML = `
126
+ <p>Hi! Welcome to RedFerns Tech! I'm FernAI, here to help you explore our innovative solutions and services. Please select from below:</p>
127
+ <button onclick="handleUserInput('Know more about RedFerns Tech')">Know more about RedFerns Tech</button>
128
+ <button onclick="handleUserInput('Our services')">Our services</button>
129
+ <button onclick="handleUserInput('Our products')">Our products</button>
130
+ <button onclick="handleUserInput('career opportunities')">Career Opportunities</button>
131
+ <button onclick="handleUserInput('chat with expert')">Chat With Expert</button>
132
+ <button onclick="handleUserInput('Appointment Booking')">Appointment Booking</button>
133
+ `;
134
+ break;
135
+
136
+ case 'Appointment Booking':
137
+ botMessage.innerHTML = `
138
+ Please provide the following details to book an appointment:
139
+ <br><br>
140
+ <label for="phoneNumber">Phone Number:</label>
141
+ <input type="text" id="phoneNumber" placeholder="Enter your phone number" />
142
+ <br>
143
+ <label for="appointmentDate">Preferred Date:</label>
144
+ <input type="date" id="appointmentDate" />
145
+ <br>
146
+ <label for="appointmentTime">Preferred Time:</label>
147
+ <input type="time" id="appointmentTime" />
148
+ <br><br>
149
+ <button onclick="submitAppointment()">Submit Appointment</button>
150
+ `;
151
+ break;
152
+
153
+ case 'Zoho':
154
+ botMessage.textContent = 'Link is Opening';
155
+ window.open('https://redfernstech.com/services-list/zoho-crm/', '_blank');
156
+ break;
157
+ case 'Machine Learning':
158
+ botMessage.textContent = 'Link is Opening';
159
+ window.open('https://redfernstech.com/services-list/machine-learning/', '_blank');
160
+ break;
161
+ case 'Data Science':
162
+ botMessage.textContent = 'Link is Opening';
163
+ window.open('https://redfernstech.com/services-list/data-science/', '_blank');
164
+ break;
165
+ case 'Lightning Service':
166
+ botMessage.textContent = 'Link is Opening';
167
+ window.open('https://redfernstech.com/services-list/salesforce-lightning-services/', '_blank');
168
+ break;
169
+ case 'App Development':
170
+ botMessage.textContent = 'Link is Opening';
171
+ window.open('https://redfernstech.com/services-list/salesforce-app-development/', '_blank');
172
+ break;
173
+ case 'Sites and Communities':
174
+ botMessage.textContent = 'Link is Opening';
175
+ window.open('https://redfernstech.com/services-list/salesforce-sites-communities/', '_blank');
176
+ break;
177
+ case 'Admin Support':
178
+ botMessage.textContent = 'Link is Opening';
179
+ window.open('https://redfernstech.com/services-list/salesforce-admin-and-support/', '_blank');
180
+ break;
181
+ case 'career opportunities':
182
+ botMessage.textContent = 'Link is Opening';
183
+ window.open('https://redfernstech.com/careers/', '_blank');
184
+ break;
185
+ case 'product filter app':
186
+ botMessage.textContent = 'Link is Opening';
187
+ window.open('https://appexchange.salesforce.com/appxListingDetail?listingId=a0N4V00000K23xNUAR', '_blank');
188
+ break;
189
+ case 'thumbnail viewer app':
190
+ botMessage.textContent = 'Link is Opening';
191
+ window.open('https://appexchange.salesforce.com/appxListingDetail?listingId=a0N4V00000K8u1dUAB', '_blank');
192
+ break;
193
+ case 'mass approvals app':
194
+ botMessage.textContent = 'Link is Opening';
195
+ window.open('https://appexchange.salesforce.com/appxListingDetail?listingId=a0N4V00000K24EdUAJ', '_blank');
196
+ break;
197
+ case 'currency conversion app':
198
+ botMessage.textContent = 'Link is Opening';
199
+ window.open('https://appexchange.salesforce.com/appxListingDetail?listingId=a0N4V00000Is77CUAR', '_blank');
200
+ break;
201
+ case 'chat with expert':
202
+ // Show the iframe with the Gradio chatbot URL
203
+ gradioIframe.style.display = 'flex';
204
+ chatBox.style.display = 'none';
205
+ formContainer.style.display = 'none';
206
+ chatIcon.style.display = 'none'; // Hide chat icon
207
+ gradioFrame.src = 'https://srinuksv-srunu.hf.space/'; // Replace with your Gradio chatbot URL
208
+ botMessage.textContent = 'Loading Salesforce chatbot...'; // Optional: Notify the user
209
+ break;
210
+ default:
211
+ botMessage.textContent = 'Sorry, I didn’t understand that. Can you please choose another option?';
212
+ break;
213
+ }
214
+ chatBody.appendChild(botMessage);
215
+ chatBody.scrollTop = chatBody.scrollHeight;
216
+ }
217
+
218
+ // Show form container
219
+ function showForm() {
220
+ formContainer.style.display = 'flex';
221
+ chatBox.style.display = 'none';
222
+ gradioIframe.style.display = 'none'; // Hide Gradio iframe if visible
223
+ chatIcon.style.display = 'flex'; // Hide chat icon
224
+ }
225
+
226
+ // Show chat box
227
+ function showChat() {
228
+ formContainer.style.display = 'none';
229
+ chatBox.style.display = 'flex';
230
+ gradioIframe.style.display = 'none'; // Hide Gradio iframe if visible
231
+ chatIcon.style.display = 'flex';
232
+ initializeChat();
233
+ }
234
+
235
+ // Show Gradio iframe
236
+ function openGradioChat() {
237
+ const chatbots = ["Lily", "Clara"];
238
+ const selectedChatbot = chatbots[Math.floor(Math.random() * chatbots.length)];
239
+
240
+ // Hide form and chat box, display Gradio iframe
241
+ formContainer.style.display = 'none';
242
+ chatBox.style.display = 'none';
243
+ gradioIframe.style.display = 'flex';
244
+
245
+ // Set the iframe source based on the selected chatbot
246
+ if (selectedChatbot === "Clara") {
247
+ gradioIframe.src = "https://srinuksv-srunu.hf.space";
248
+ } else {
249
+ gradioIframe.src = "https://srinukethanaboina-srunu.hf.space";
250
+ }
251
+
252
+ // Display the chat icon
253
+ chatIcon.style.display = 'flex';
254
+ }
255
+
256
+
257
+ // Hide Gradio iframe and show chat box
258
+ function goBackToChat() {
259
+ formContainer.style.display = 'none';
260
+ chatBox.style.display = 'flex';
261
+ gradioIframe.style.display = 'none';
262
+ chatIcon.style.display = 'flex';
263
+ initializeChat();
264
+ }
265
+
266
+ function submitAppointment() {
267
+ const phoneNumber = document.getElementById('phoneNumber').value;
268
+ const appointmentDate = document.getElementById('appointmentDate').value;
269
+ const appointmentTime = document.getElementById('appointmentTime').value;
270
+
271
+ // Split the date into year, month, and day
272
+ const dateParts = appointmentDate.split('-'); // Assuming the format is YYYY-MM-DD
273
+ const year = dateParts[0];
274
+ const month = dateParts[1]; // Google Forms uses 1-indexed months (January is 1, not 0)
275
+ const day = dateParts[2];
276
+
277
+ // Split the time into hour and minute
278
+ const timeParts = appointmentTime.split(':'); // Assuming the format is HH:MM
279
+ const hour = timeParts[0];
280
+ const minute = timeParts[1];
281
+
282
+ if (phoneNumber && appointmentDate && appointmentTime) {
283
+ // Google Form submission URL and entry IDs
284
+ const googleFormURL = 'https://docs.google.com/forms/u/0/d/e/1FAIpQLSdLLMPObehQAPIJe26ALLP-uGiR_rTbFomaQ6jrYSDKDpC53Q/formResponse';
285
+ const formData = new FormData();
286
+ formData.append('entry.399768569', phoneNumber); // Phone number
287
+ formData.append('entry.524576831_hour', hour); // Appointment hour
288
+ formData.append('entry.524576831_minute', minute); // Appointment minute
289
+ formData.append('entry.277009627_year', year); // Appointment year
290
+ formData.append('entry.277009627_month', month); // Appointment month
291
+ formData.append('entry.277009627_day', day); // Appointment day
292
+
293
+ // Send data to Google Form
294
+ fetch(googleFormURL, {
295
+ method: 'POST',
296
+ body: formData,
297
+ mode: 'no-cors' // To avoid CORS issues
298
+ }).then(() => {
299
+ const botMessage = document.createElement('div');
300
+ botMessage.className = 'message bot-message';
301
+ botMessage.innerHTML = `
302
+ Appointment booked for ${appointmentDate} at ${appointmentTime}. We will contact you at ${phoneNumber}.
303
+ <br><br>What would you like to do next?
304
+ <button onclick="handleUserInput('Menu')">Return to Menu</button>
305
+ `;
306
+ chatBody.appendChild(botMessage);
307
+ }).catch(() => {
308
+ const botMessage = document.createElement('div');
309
+ botMessage.className = 'message bot-message';
310
+ botMessage.innerHTML = `
311
+ There was an error booking your appointment. Please try again.
312
+ <br><br>What would you like to do next?
313
+ <button onclick="handleUserInput('Menu')">Return to Menu</button>
314
+ `;
315
+ chatBody.appendChild(botMessage);
316
+ });
317
+ } else {
318
+ const botMessage = document.createElement('div');
319
+ botMessage.className = 'message bot-message';
320
+ botMessage.innerHTML = `
321
+ Please fill in all the details.
322
+ <br><br>What would you like to do next?
323
+ <button onclick="handleUserInput('Menu')">Return to Menu</button>
324
+ `;
325
+ chatBody.appendChild(botMessage);
326
+ }
327
+
328
+ chatBody.scrollTop = chatBody.scrollHeight;
329
+ }
330
+
331
+
332
+
333
+ // Initialize chat
334
+ // Initialize chat
335
+ function initializeChat() {
336
+ chatBody.innerHTML = '';
337
+ const welcomeMessage = document.createElement('div');
338
+ welcomeMessage.className = 'message bot-message';
339
+ welcomeMessage.innerHTML = `
340
+ <p>Hi! Welcome to RedFerns Tech! I'm FernAI, here to help you explore our innovative solutions and services. Please select from below:</p>
341
+ <button onclick="handleUserInput('Know more about RedFerns Tech')">Know more about RedFerns Tech</button>
342
+ <button onclick="handleUserInput('Our services')">Our services</button>
343
+ <button onclick="handleUserInput('Our products')">Our products</button>
344
+ <button onclick="handleUserInput('career opportunities')">Career Opportunities</button>
345
+ <button onclick="handleUserInput('chat with expert')">Chat With Expert</button>
346
+ <button onclick="handleUserInput('Appointment Booking')">Appointment Booking</button>
347
+ `;
348
+ chatBody.appendChild(welcomeMessage);
349
+ chatBody.scrollTop = chatBody.scrollHeight;
350
+ }
351
+
352
+
353
+ // Event Listeners
354
+
355
+ chatIcon.addEventListener('click', function() {
356
+ if (localStorage.getItem('formShown') === 'true') {
357
+ showChat(); // Show the chat box if form has been shown
358
+ } else {
359
+ showForm(); // Show the form if it hasn't been shown
360
+ }
361
+ });
362
+
363
+
364
+
365
+
366
+
367
+
368
+
369
+ userForm.addEventListener('submit', function(event) {
370
+ event.preventDefault();
371
+ localStorage.setItem('formShown', 'true');
372
+ showChat();
373
+ });
374
+
375
+ closeChat.addEventListener('click', function() {
376
+ formContainer.style.display = 'none';
377
+ chatBox.style.display = 'none';
378
+ gradioIframe.style.display = 'none';
379
+ chatIcon.style.display = 'flex';
380
+ });
381
+
382
+
383
+
384
+
385
+ backButton.addEventListener('click', goBackToChat);
386
+
387
+ // Initialize on load
388
+ if (localStorage.getItem('formShown') === 'true') {
389
+ showChat();
390
+ } else {
391
+ chatIcon.style.display = 'flex'; // Ensure the chat icon is visible initially
392
+ }
393
+ // Select the div with class 'component-2 block svelte-12'
394
+ // Select the div with class 'component-2 block svelte-12'
395
+ // Select the element with the specific class
396
+ // Select the element with the specific class
397
+ // Select the element with the specific class
398
+
399
+
400
+
401
+
402
  </script>
403
+
404
  </body>
405
  </html>