Spaces:
Sleeping
Sleeping
Update templates/index.html
Browse files- templates/index.html +16 -0
templates/index.html
CHANGED
@@ -390,6 +390,8 @@
|
|
390 |
</div>
|
391 |
|
392 |
<script>
|
|
|
|
|
393 |
let conversation = [
|
394 |
{ role: 'bot', message: "Hi there! I'm Chef Bot! May I know your name?" }
|
395 |
];
|
@@ -466,9 +468,21 @@
|
|
466 |
// Submit the dish without customization
|
467 |
submitCustomizationIngredients();
|
468 |
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
469 |
}
|
470 |
|
471 |
|
|
|
472 |
addMessage('bot', botResponse);
|
473 |
if (options.length > 0) {
|
474 |
displayOptions(options);
|
@@ -628,6 +642,7 @@
|
|
628 |
|
629 |
const textarea = document.querySelector('.selected-customization-ingredients textarea');
|
630 |
const instructions = textarea ? textarea.value.trim() : '';
|
|
|
631 |
|
632 |
fetch('/submit_customization_ingredients', {
|
633 |
method: 'POST',
|
@@ -642,6 +657,7 @@
|
|
642 |
.then(data => {
|
643 |
if (data.success) {
|
644 |
addToCart({ ...selectedMenuItem, instructions, ingredients: selectedIngredients });
|
|
|
645 |
addMessage('bot', 'Customization submitted successfully! Item added to cart. Would you like to order more?');
|
646 |
const options = [
|
647 |
{ text: 'Yes', class: 'green' },
|
|
|
390 |
</div>
|
391 |
|
392 |
<script>
|
393 |
+
let currentStep = 'greeting'; // other possible values: 'food_type', 'select_ingredients', 'menu_display', 'customization', 'post_cart'
|
394 |
+
|
395 |
let conversation = [
|
396 |
{ role: 'bot', message: "Hi there! I'm Chef Bot! May I know your name?" }
|
397 |
];
|
|
|
468 |
// Submit the dish without customization
|
469 |
submitCustomizationIngredients();
|
470 |
return;
|
471 |
+
} else if (lastMessage.includes('yes') && currentStep === 'post_cart') {
|
472 |
+
addMessage('bot', 'Great! Let’s add more delicious dishes. 🍽️ Please select your preference again or pick more ingredients.');
|
473 |
+
currentStep = 'select_ingredients'; // or 'menu_display' if you want to show menu again directly
|
474 |
+
fetchIngredients('both'); // You could use a stored dietary preference instead of 'both'
|
475 |
+
return;
|
476 |
+
} else if (lastMessage.includes('no') && currentStep === 'post_cart') {
|
477 |
+
addMessage('bot', 'Awesome! 🧾 Here’s your final cart:');
|
478 |
+
displayCart(); // Optional: show final cart again
|
479 |
+
addMessage('bot', 'Thank you for your order! 👨🍳🍲');
|
480 |
+
currentStep = 'end';
|
481 |
+
return;
|
482 |
}
|
483 |
|
484 |
|
485 |
+
|
486 |
addMessage('bot', botResponse);
|
487 |
if (options.length > 0) {
|
488 |
displayOptions(options);
|
|
|
642 |
|
643 |
const textarea = document.querySelector('.selected-customization-ingredients textarea');
|
644 |
const instructions = textarea ? textarea.value.trim() : '';
|
645 |
+
|
646 |
|
647 |
fetch('/submit_customization_ingredients', {
|
648 |
method: 'POST',
|
|
|
657 |
.then(data => {
|
658 |
if (data.success) {
|
659 |
addToCart({ ...selectedMenuItem, instructions, ingredients: selectedIngredients });
|
660 |
+
currentStep = 'post_cart';
|
661 |
addMessage('bot', 'Customization submitted successfully! Item added to cart. Would you like to order more?');
|
662 |
const options = [
|
663 |
{ text: 'Yes', class: 'green' },
|