Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -112,40 +112,6 @@ def filter_menu(preference):
|
|
112 |
|
113 |
return html_content
|
114 |
|
115 |
-
# Create Modal Window HTML
|
116 |
-
def create_modal_window():
|
117 |
-
add_ons = load_add_ons_from_salesforce()
|
118 |
-
add_ons_html = ""
|
119 |
-
for add_on in add_ons:
|
120 |
-
add_ons_html += f"""
|
121 |
-
<label>
|
122 |
-
<input type="checkbox" name="biryani-extra" value="{add_on['Name']}" data-price="{add_on['Price__c']}" />
|
123 |
-
{add_on['Name']} + ${add_on['Price__c']}
|
124 |
-
</label>
|
125 |
-
<br>
|
126 |
-
"""
|
127 |
-
|
128 |
-
modal_html = f"""
|
129 |
-
<div id="modal" style="display: none; position: fixed; background: white; border-radius: 8px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); padding: 20px; z-index: 1000;">
|
130 |
-
<div style="text-align: right;">
|
131 |
-
<button onclick="closeModal()" style="background: none; border: none; font-size: 18px; cursor: pointer;">×</button>
|
132 |
-
</div>
|
133 |
-
<img id="modal-image" style="width: 100%; height: 300px; border-radius: 8px; margin-bottom: 20px;" />
|
134 |
-
<h2 id="modal-name"></h2>
|
135 |
-
<p id="modal-description"></p>
|
136 |
-
<p id="modal-price"></p>
|
137 |
-
<label for="biryani-extras"><strong>Add-ons :</strong></label>
|
138 |
-
<div id="biryani-extras-options" style="display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0;">
|
139 |
-
{add_ons_html}
|
140 |
-
</div>
|
141 |
-
<label for="quantity">Quantity:</label>
|
142 |
-
<input type="number" id="quantity" value="1" min="1" style="width: 50px;" />
|
143 |
-
<textarea id="special-instructions" placeholder="Add your special instructions here..." style="width: 100%; height: 60px;"></textarea>
|
144 |
-
<button style="background-color: #28a745; color: white; border: none; padding: 10px 20px; font-size: 14px; border-radius: 5px; cursor: pointer;" onclick="addToCart()">Add to Cart</button>
|
145 |
-
</div>
|
146 |
-
"""
|
147 |
-
return modal_html
|
148 |
-
|
149 |
# JavaScript for Modal and Cart
|
150 |
def modal_js():
|
151 |
modal_script = """
|
@@ -325,7 +291,7 @@ with gr.Blocks() as app:
|
|
325 |
gr.HTML("<h1>Your Final Order</h1>")
|
326 |
final_order_items = gr.HTML()
|
327 |
final_order_total = gr.HTML()
|
328 |
-
gr.Button("Go Back to Menu", elem_id="back-to-menu-button",
|
329 |
|
330 |
login_button.click(
|
331 |
lambda email, password: (gr.update(visible=False), gr.update(visible=True), gr.update(value=filter_menu("All")), "Login successful!")
|
|
|
112 |
|
113 |
return html_content
|
114 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
# JavaScript for Modal and Cart
|
116 |
def modal_js():
|
117 |
modal_script = """
|
|
|
291 |
gr.HTML("<h1>Your Final Order</h1>")
|
292 |
final_order_items = gr.HTML()
|
293 |
final_order_total = gr.HTML()
|
294 |
+
gr.Button("Go Back to Menu", elem_id="back-to-menu-button", click=goBackToMenu)
|
295 |
|
296 |
login_button.click(
|
297 |
lambda email, password: (gr.update(visible=False), gr.update(visible=True), gr.update(value=filter_menu("All")), "Login successful!")
|