Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -75,60 +75,58 @@ def app():
|
|
| 75 |
# Modal window
|
| 76 |
modal_window = gr.HTML("""
|
| 77 |
<div id="modal" style="
|
| 78 |
-
display: none;
|
| 79 |
-
position: fixed;
|
| 80 |
-
top: 50%;
|
| 81 |
-
left: 50%;
|
| 82 |
-
transform: translate(-50%, -50%);
|
| 83 |
-
width: 90%;
|
| 84 |
-
max-width:
|
| 85 |
-
max-height: 90%;
|
| 86 |
-
background: white;
|
| 87 |
-
border-radius:
|
| 88 |
-
box-shadow: 0
|
| 89 |
-
padding: 20px;
|
| 90 |
-
z-index: 1000;
|
| 91 |
overflow-y: auto;
|
|
|
|
| 92 |
">
|
| 93 |
<div style="text-align: right;">
|
| 94 |
-
<button onclick="closeModal()" style="
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
</div>
|
| 96 |
-
<img id="modal-image" style="
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
<
|
| 103 |
-
<
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
<label
|
| 107 |
-
<
|
| 108 |
-
|
| 109 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 110 |
</div>
|
| 111 |
-
|
| 112 |
-
<!-- Biryani Extras -->
|
| 113 |
-
<label for="biryani-extras" style="font-weight: bold;">Biryani Extras (Optional - Choose as many as you like):</label>
|
| 114 |
-
<div id="biryani-extras-options" style="display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0;">
|
| 115 |
-
<label><input type="checkbox" name="biryani-extra" value="Extra Raitha 4oz" /> Extra Raitha 4oz + $1.00</label>
|
| 116 |
-
<label><input type="checkbox" name="biryani-extra" value="Extra Raitha 8oz" /> Extra Raitha 8oz + $2.00</label>
|
| 117 |
-
<label><input type="checkbox" name="biryani-extra" value="Extra Salan 4oz" /> Extra Salan 4oz + $1.00</label>
|
| 118 |
-
<label><input type="checkbox" name="biryani-extra" value="Extra Salan 8oz" /> Extra Salan 8oz + $2.00</label>
|
| 119 |
-
<label><input type="checkbox" name="biryani-extra" value="Extra Onion" /> Extra Onion + $1.00</label>
|
| 120 |
-
<label><input type="checkbox" name="biryani-extra" value="Extra Onion & Lemon" /> Extra Onion & Lemon + $2.00</label>
|
| 121 |
-
<label><input type="checkbox" name="biryani-extra" value="Extra Fried Onion" /> Extra Fried Onion 4oz + $2.00</label>
|
| 122 |
-
</div>
|
| 123 |
-
|
| 124 |
-
<!-- Quantity and Special Instructions -->
|
| 125 |
-
<label for="quantity" style="font-weight: bold;">Quantity:</label>
|
| 126 |
-
<input type="number" id="quantity" value="1" min="1" style="width: 50px; margin-bottom: 10px;" />
|
| 127 |
-
<br>
|
| 128 |
-
<textarea id="special-instructions" placeholder="Add special instructions here..." style="width: 100%; height: 60px; margin-bottom: 20px;"></textarea>
|
| 129 |
-
|
| 130 |
-
<!-- Add to Cart Button -->
|
| 131 |
-
<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>
|
| 132 |
</div>
|
| 133 |
|
| 134 |
<script>
|
|
@@ -150,11 +148,8 @@ def app():
|
|
| 150 |
function addToCart() {
|
| 151 |
const name = document.getElementById('modal-name').innerText;
|
| 152 |
const price = document.getElementById('modal-price').innerText;
|
| 153 |
-
const spiceLevel = document.querySelector('input[name="spice-level"]:checked')?.value || "Not Selected";
|
| 154 |
const quantity = parseInt(document.getElementById('quantity').value) || 1;
|
| 155 |
-
const
|
| 156 |
-
const extras = Array.from(document.querySelectorAll('input[name="biryani-extra"]:checked')).map(extra => extra.value);
|
| 157 |
-
const cartItem = { name, price, spiceLevel, quantity, instructions, extras };
|
| 158 |
cart.push(cartItem);
|
| 159 |
fetch("/update_cart", {
|
| 160 |
method: "POST",
|
|
|
|
| 75 |
# Modal window
|
| 76 |
modal_window = gr.HTML("""
|
| 77 |
<div id="modal" style="
|
| 78 |
+
display: none;
|
| 79 |
+
position: fixed;
|
| 80 |
+
top: 50%;
|
| 81 |
+
left: 50%;
|
| 82 |
+
transform: translate(-50%, -50%);
|
| 83 |
+
width: 90%;
|
| 84 |
+
max-width: 500px;
|
| 85 |
+
max-height: 90%;
|
| 86 |
+
background: white;
|
| 87 |
+
border-radius: 15px;
|
| 88 |
+
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
|
| 89 |
+
padding: 20px;
|
| 90 |
+
z-index: 1000;
|
| 91 |
overflow-y: auto;
|
| 92 |
+
font-family: Arial, sans-serif;
|
| 93 |
">
|
| 94 |
<div style="text-align: right;">
|
| 95 |
+
<button onclick="closeModal()" style="
|
| 96 |
+
background: none;
|
| 97 |
+
border: none;
|
| 98 |
+
font-size: 24px;
|
| 99 |
+
cursor: pointer;
|
| 100 |
+
color: #333;
|
| 101 |
+
">×</button>
|
| 102 |
</div>
|
| 103 |
+
<img id="modal-image" style="
|
| 104 |
+
width: 100%;
|
| 105 |
+
height: auto;
|
| 106 |
+
border-radius: 12px;
|
| 107 |
+
margin-bottom: 15px;
|
| 108 |
+
" />
|
| 109 |
+
<h2 id="modal-name" style="margin-bottom: 10px; font-size: 22px; color: #333;"></h2>
|
| 110 |
+
<p id="modal-description" style="margin-bottom: 10px; color: #555; font-size: 16px;"></p>
|
| 111 |
+
<p id="modal-price" style="margin-bottom: 20px; font-size: 18px; font-weight: bold; color: #222;"></p>
|
| 112 |
+
<div style="display: flex; justify-content: space-between; align-items: center;">
|
| 113 |
+
<label for="quantity" style="font-weight: bold;">Quantity:</label>
|
| 114 |
+
<input type="number" id="quantity" value="1" min="1" style="
|
| 115 |
+
width: 60px;
|
| 116 |
+
padding: 5px;
|
| 117 |
+
border: 1px solid #ccc;
|
| 118 |
+
border-radius: 5px;
|
| 119 |
+
" />
|
| 120 |
+
<button style="
|
| 121 |
+
background-color: #28a745;
|
| 122 |
+
color: white;
|
| 123 |
+
border: none;
|
| 124 |
+
padding: 10px 20px;
|
| 125 |
+
font-size: 16px;
|
| 126 |
+
border-radius: 8px;
|
| 127 |
+
cursor: pointer;
|
| 128 |
+
" onclick="addToCart()">Add</button>
|
| 129 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 130 |
</div>
|
| 131 |
|
| 132 |
<script>
|
|
|
|
| 148 |
function addToCart() {
|
| 149 |
const name = document.getElementById('modal-name').innerText;
|
| 150 |
const price = document.getElementById('modal-price').innerText;
|
|
|
|
| 151 |
const quantity = parseInt(document.getElementById('quantity').value) || 1;
|
| 152 |
+
const cartItem = { name, price, quantity };
|
|
|
|
|
|
|
| 153 |
cart.push(cartItem);
|
| 154 |
fetch("/update_cart", {
|
| 155 |
method: "POST",
|