File size: 1,636 Bytes
e3b7e79
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import gradio as gr
from components.cart import add_to_cart

def show_popup(dish_name, menu_data):
    """Displays the popup for the selected menu item."""
    dish = menu_data[menu_data['Dish Name'] == dish_name].iloc[0]
    popup = gr.Column([
        gr.Markdown(f"### {dish_name} - ${dish['Price']}"),
        gr.Image(f"static/images/{dish['Image']}"),
        gr.Markdown(f"{dish['Description']}"),
        
        # Spice Level
        gr.Radio(
            label="Choose a spice level (Required)",
            choices=["American Mild", "American Medium", "American Spicy", 
                     "Indian Mild", "Indian Medium", "Indian Very Spicy"],
            value="Indian Medium"
        ),
        
        # Extras
        gr.CheckboxGroup(
            label="Biryani Extras (Optional)",
            choices=["Extra Raita 4oz + $1.00", "Extra Raita 8oz + $2.00", 
                     "Extra Salan 8oz + $2.00", "Extra Onion + $1.00",
                     "Extra Onion & Lemon + $2.00", "Extra Fried Onion 4oz + $2.00"]
        ),
        
        # Special Instructions
        gr.Textbox(
            label="Special Instructions",
            placeholder="Add any requests here."
        ),
        
        # Quantity
        gr.Slider(
            label="Quantity",
            minimum=1,
            maximum=10,
            step=1,
            value=1
        ),
        
        # Add to Cart Button
        gr.Button("Add to Bag").click(
            add_to_cart,
            inputs=[dish_name, gr.Radio, gr.CheckboxGroup, gr.Textbox, gr.Slider],
            outputs="cart_display"
        )
    ])
    return popup