Spaces:
				
			
			
	
			
			
		Sleeping
		
	
	
	
			
			
	
	
	
	
		
		
		Sleeping
		
	Update templates/index.html
Browse files- templates/index.html +36 -26
    	
        templates/index.html
    CHANGED
    
    | @@ -846,33 +846,43 @@ | |
| 846 | 
             
                        // Log to verify the dishes being fetched
         | 
| 847 | 
             
                        console.log('Fetched menu items:', menuItems);
         | 
| 848 |  | 
| 849 | 
            -
                        menuItems | 
| 850 | 
            -
             | 
| 851 | 
            -
                             | 
| 852 | 
            -
                             | 
| 853 | 
            -
                             | 
| 854 | 
            -
             | 
| 855 | 
            -
                             | 
| 856 | 
            -
             | 
| 857 | 
            -
             | 
| 858 | 
            -
             | 
| 859 | 
            -
             | 
| 860 | 
            -
                                 | 
| 861 | 
            -
                                 | 
| 862 | 
            -
                                 | 
| 863 | 
            -
             | 
| 864 | 
            -
             | 
| 865 | 
            -
                                 | 
| 866 | 
            -
             | 
| 867 | 
            -
             | 
| 868 | 
            -
             | 
| 869 | 
            -
             | 
| 870 | 
            -
             | 
| 871 | 
            -
             | 
| 872 | 
            -
             | 
| 873 | 
            -
             | 
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
| 874 |  | 
| 875 | 
            -
                        //  | 
| 876 | 
             
                        console.log('Menu items displayed');
         | 
| 877 | 
             
                    }
         | 
| 878 |  | 
|  | |
| 846 | 
             
                        // Log to verify the dishes being fetched
         | 
| 847 | 
             
                        console.log('Fetched menu items:', menuItems);
         | 
| 848 |  | 
| 849 | 
            +
                        // If menuItems is an empty array, add a message indicating no items found
         | 
| 850 | 
            +
                        if (menuItems.length === 0) {
         | 
| 851 | 
            +
                            const noItemsMessage = document.createElement('div');
         | 
| 852 | 
            +
                            noItemsMessage.textContent = 'No dishes available at the moment.';
         | 
| 853 | 
            +
                            menuItemsList.appendChild(noItemsMessage);
         | 
| 854 | 
            +
                        } else {
         | 
| 855 | 
            +
                            menuItems.forEach(item => {
         | 
| 856 | 
            +
                                const menuItem = document.createElement('div');
         | 
| 857 | 
            +
                                menuItem.className = 'menu-item';
         | 
| 858 | 
            +
                                const img = document.createElement('img');
         | 
| 859 | 
            +
                                img.src = item.image_url || 'https://via.placeholder.com/120';
         | 
| 860 | 
            +
                                img.alt = item.name;
         | 
| 861 | 
            +
                                const name = document.createElement('div');
         | 
| 862 | 
            +
                                name.textContent = item.name;
         | 
| 863 | 
            +
                                const button = document.createElement('button');
         | 
| 864 | 
            +
                                button.textContent = 'Add to Cart';
         | 
| 865 | 
            +
                                button.onclick = () => {
         | 
| 866 | 
            +
                                    selectedMenuItem = item;
         | 
| 867 | 
            +
                                    addMessage('bot', `World-class selection! Would you like to customize your dish further?`);
         | 
| 868 | 
            +
                                    const options = [
         | 
| 869 | 
            +
                                        { text: 'Yes', class: 'green' },
         | 
| 870 | 
            +
                                        { text: 'No', class: 'red' }
         | 
| 871 | 
            +
                                    ];
         | 
| 872 | 
            +
                                    currentStep = 'customization';
         | 
| 873 | 
            +
                                    displayOptions(options);
         | 
| 874 | 
            +
                                };
         | 
| 875 | 
            +
                                menuItem.appendChild(img);
         | 
| 876 | 
            +
                                menuItem.appendChild(name);
         | 
| 877 | 
            +
                                menuItem.appendChild(button);
         | 
| 878 | 
            +
                                menuItemsList.appendChild(menuItem);
         | 
| 879 | 
            +
                            });
         | 
| 880 | 
            +
                        }
         | 
| 881 | 
            +
                    
         | 
| 882 | 
            +
                        // Ensure the display is scrolled to the latest message
         | 
| 883 | 
            +
                        chatMessages.scrollTop = chatMessages.scrollHeight;
         | 
| 884 |  | 
| 885 | 
            +
                        // Log that menu items were displayed
         | 
| 886 | 
             
                        console.log('Menu items displayed');
         | 
| 887 | 
             
                    }
         | 
| 888 |  |