Spaces:
Running
Running
When a support ticket is logged it must be able to send an email to yitsupport@y-it.co.za with a prompt that says your ticket has been logged. An Engineer will be reach out as soon as they are available. Please also integrate a chat section with an AI Bot that can answer all questions relating to IT support
Browse files- index.html +117 -14
index.html
CHANGED
|
@@ -144,10 +144,30 @@
|
|
| 144 |
</div>
|
| 145 |
</div>
|
| 146 |
</section>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 147 |
|
| 148 |
<!-- Ticket Section -->
|
| 149 |
-
<section id="ticket" class="py-20 bg-gunmetal">
|
| 150 |
-
|
| 151 |
<div class="max-w-4xl mx-auto">
|
| 152 |
<div class="text-center mb-12">
|
| 153 |
<h2 class="text-3xl md:text-4xl font-bold text-white mb-4">Log a <span class="text-silver">Support Ticket</span></h2>
|
|
@@ -254,12 +274,10 @@
|
|
| 254 |
points: 12.00,
|
| 255 |
maxDistance: 25.00
|
| 256 |
});
|
| 257 |
-
|
| 258 |
-
// Handle form submission
|
| 259 |
document.getElementById('ticketForm').addEventListener('submit', function(e) {
|
| 260 |
e.preventDefault();
|
| 261 |
|
| 262 |
-
// Collect form data
|
| 263 |
const formData = {
|
| 264 |
name: document.getElementById('name').value,
|
| 265 |
email: document.getElementById('email').value,
|
|
@@ -267,19 +285,104 @@
|
|
| 267 |
priority: document.getElementById('priority').value,
|
| 268 |
issue: document.getElementById('issue').value
|
| 269 |
};
|
| 270 |
-
|
| 271 |
-
//
|
| 272 |
-
|
| 273 |
-
|
| 274 |
-
|
| 275 |
-
|
| 276 |
-
|
| 277 |
-
|
| 278 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 279 |
});
|
| 280 |
|
| 281 |
// Initialize feather icons
|
| 282 |
feather.replace();
|
|
|
|
|
|
|
| 283 |
</script>
|
| 284 |
</body>
|
| 285 |
</html>
|
|
|
|
| 144 |
</div>
|
| 145 |
</div>
|
| 146 |
</section>
|
| 147 |
+
<!-- Chat Bot Section -->
|
| 148 |
+
<div id="chatBotContainer" class="fixed bottom-8 right-8 z-50 hidden">
|
| 149 |
+
<div class="bg-gunmetal rounded-t-lg shadow-xl w-80 h-96 flex flex-col">
|
| 150 |
+
<div class="bg-onyx p-4 rounded-t-lg flex justify-between items-center">
|
| 151 |
+
<h3 class="text-white font-semibold">IT Support Assistant</h3>
|
| 152 |
+
<button id="closeChat" class="text-silver hover:text-white">
|
| 153 |
+
<i data-feather="x"></i>
|
| 154 |
+
</button>
|
| 155 |
+
</div>
|
| 156 |
+
<div id="chatMessages" class="flex-1 p-4 overflow-y-auto"></div>
|
| 157 |
+
<div class="p-4 border-t border-silver">
|
| 158 |
+
<input type="text" id="userMessage" placeholder="Type your IT question..."
|
| 159 |
+
class="w-full px-4 py-2 rounded form-input text-white">
|
| 160 |
+
</div>
|
| 161 |
+
</div>
|
| 162 |
+
</div>
|
| 163 |
+
|
| 164 |
+
<button id="openChat" class="fixed bottom-8 right-8 bg-silver text-black p-4 rounded-full shadow-lg z-40">
|
| 165 |
+
<i data-feather="message-square"></i>
|
| 166 |
+
</button>
|
| 167 |
|
| 168 |
<!-- Ticket Section -->
|
| 169 |
+
<section id="ticket" class="py-20 bg-gunmetal hovered-element">
|
| 170 |
+
<div class="container mx-auto px-4">
|
| 171 |
<div class="max-w-4xl mx-auto">
|
| 172 |
<div class="text-center mb-12">
|
| 173 |
<h2 class="text-3xl md:text-4xl font-bold text-white mb-4">Log a <span class="text-silver">Support Ticket</span></h2>
|
|
|
|
| 274 |
points: 12.00,
|
| 275 |
maxDistance: 25.00
|
| 276 |
});
|
| 277 |
+
// Handle form submission with email
|
|
|
|
| 278 |
document.getElementById('ticketForm').addEventListener('submit', function(e) {
|
| 279 |
e.preventDefault();
|
| 280 |
|
|
|
|
| 281 |
const formData = {
|
| 282 |
name: document.getElementById('name').value,
|
| 283 |
email: document.getElementById('email').value,
|
|
|
|
| 285 |
priority: document.getElementById('priority').value,
|
| 286 |
issue: document.getElementById('issue').value
|
| 287 |
};
|
| 288 |
+
|
| 289 |
+
// Send email via Formspree or similar service
|
| 290 |
+
fetch('https://formspree.io/f/yitsupport@y-it.co.za', {
|
| 291 |
+
method: 'POST',
|
| 292 |
+
headers: {
|
| 293 |
+
'Content-Type': 'application/json',
|
| 294 |
+
},
|
| 295 |
+
body: JSON.stringify({
|
| 296 |
+
name: formData.name,
|
| 297 |
+
email: formData.email,
|
| 298 |
+
phone: formData.phone,
|
| 299 |
+
priority: formData.priority,
|
| 300 |
+
issue: formData.issue,
|
| 301 |
+
_subject: `Support Ticket (${formData.priority} priority)`
|
| 302 |
+
})
|
| 303 |
+
})
|
| 304 |
+
.then(response => {
|
| 305 |
+
if (response.ok) {
|
| 306 |
+
alert('Your support ticket has been logged successfully! An engineer will reach out as soon as they are available.');
|
| 307 |
+
this.reset();
|
| 308 |
+
} else {
|
| 309 |
+
throw new Error('Failed to submit ticket');
|
| 310 |
+
}
|
| 311 |
+
})
|
| 312 |
+
.catch(error => {
|
| 313 |
+
console.error('Error:', error);
|
| 314 |
+
alert('There was an error submitting your ticket. Please try again or contact us directly.');
|
| 315 |
+
});
|
| 316 |
+
});
|
| 317 |
+
|
| 318 |
+
// Chat Bot functionality
|
| 319 |
+
const chatBot = {
|
| 320 |
+
responses: {
|
| 321 |
+
"hello": "Hello! How can I assist you with your IT support needs today?",
|
| 322 |
+
"password": "For password resets, please visit our support portal or contact your system administrator.",
|
| 323 |
+
"email": "Email issues can often be resolved by checking your internet connection or email settings. Would you like more specific troubleshooting?",
|
| 324 |
+
"slow": "Slow performance can be caused by many factors. Try restarting your device or checking for background processes using resources.",
|
| 325 |
+
"default": "I'm sorry, I didn't understand that. Could you rephrase your IT support question?"
|
| 326 |
+
},
|
| 327 |
+
getResponse: function(question) {
|
| 328 |
+
question = question.toLowerCase();
|
| 329 |
+
for (const [key, value] of Object.entries(this.responses)) {
|
| 330 |
+
if (question.includes(key)) {
|
| 331 |
+
return value;
|
| 332 |
+
}
|
| 333 |
+
}
|
| 334 |
+
return this.responses.default;
|
| 335 |
+
}
|
| 336 |
+
};
|
| 337 |
+
|
| 338 |
+
document.getElementById('openChat').addEventListener('click', function() {
|
| 339 |
+
document.getElementById('chatBotContainer').classList.remove('hidden');
|
| 340 |
+
this.classList.add('hidden');
|
| 341 |
+
feather.replace();
|
| 342 |
+
});
|
| 343 |
+
|
| 344 |
+
document.getElementById('closeChat').addEventListener('click', function() {
|
| 345 |
+
document.getElementById('chatBotContainer').classList.add('hidden');
|
| 346 |
+
document.getElementById('openChat').classList.remove('hidden');
|
| 347 |
+
feather.replace();
|
| 348 |
+
});
|
| 349 |
+
|
| 350 |
+
document.getElementById('userMessage').addEventListener('keypress', function(e) {
|
| 351 |
+
if (e.key === 'Enter' && this.value.trim() !== '') {
|
| 352 |
+
const userMessage = this.value;
|
| 353 |
+
const chatMessages = document.getElementById('chatMessages');
|
| 354 |
+
|
| 355 |
+
// Add user message
|
| 356 |
+
chatMessages.innerHTML += `
|
| 357 |
+
<div class="flex justify-end mb-2">
|
| 358 |
+
<div class="bg-silver text-black rounded-lg p-2 max-w-xs">
|
| 359 |
+
${userMessage}
|
| 360 |
+
</div>
|
| 361 |
+
</div>
|
| 362 |
+
`;
|
| 363 |
+
|
| 364 |
+
// Get and add bot response
|
| 365 |
+
const botResponse = chatBot.getResponse(userMessage);
|
| 366 |
+
setTimeout(() => {
|
| 367 |
+
chatMessages.innerHTML += `
|
| 368 |
+
<div class="flex justify-start mb-2">
|
| 369 |
+
<div class="bg-onyx text-silver rounded-lg p-2 max-w-xs">
|
| 370 |
+
${botResponse}
|
| 371 |
+
</div>
|
| 372 |
+
</div>
|
| 373 |
+
`;
|
| 374 |
+
chatMessages.scrollTop = chatMessages.scrollHeight;
|
| 375 |
+
}, 500);
|
| 376 |
+
|
| 377 |
+
this.value = '';
|
| 378 |
+
chatMessages.scrollTop = chatMessages.scrollHeight;
|
| 379 |
+
}
|
| 380 |
});
|
| 381 |
|
| 382 |
// Initialize feather icons
|
| 383 |
feather.replace();
|
| 384 |
+
// Add this to your head section or before the closing body tag
|
| 385 |
+
<link href="https://cdn.jsdelivr.net/npm/feather-icons@4.28.0/dist/feather.min.css" rel="stylesheet">
|
| 386 |
</script>
|
| 387 |
</body>
|
| 388 |
</html>
|