Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -207,16 +207,61 @@ elif menu == "Current":
|
|
207 |
|
208 |
# Define item prices
|
209 |
item_prices = {
|
210 |
-
"
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
215 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
216 |
# Define combined prices for special combinations
|
217 |
combo_prices = {
|
218 |
"desayuno + café (aceite)": 1.85,
|
219 |
-
"desayuno + café (tomate)": 2.50
|
|
|
220 |
}
|
221 |
|
222 |
# Use session state to persist ticket generation status
|
@@ -228,40 +273,54 @@ elif menu == "Current":
|
|
228 |
ticket = []
|
229 |
|
230 |
# Iterate over each user's selections
|
|
|
|
|
231 |
for _, row in current_df.iterrows():
|
232 |
-
drinks
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
#
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
#
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
265 |
|
266 |
# Create a DataFrame to display the ticket
|
267 |
ticket_df = pd.DataFrame(ticket)
|
|
|
207 |
|
208 |
# Define item prices
|
209 |
item_prices = {
|
210 |
+
"Cafés": {
|
211 |
+
"Café con leche": 1.20,
|
212 |
+
"Descafeinado con leche": 1.20,
|
213 |
+
"Cortado": 1.20,
|
214 |
+
"Aguasusia": 1.20,
|
215 |
+
"Aguasusia susia": 1.20,
|
216 |
+
"Descafeinado con leche desnatada": 1.20,
|
217 |
+
"Italiano": 1.20,
|
218 |
+
"Café con soja": 1.20,
|
219 |
+
"Café sin lactosa": 1.20,
|
220 |
+
},
|
221 |
+
"Infusiones": {
|
222 |
+
"Té": 0.90,
|
223 |
+
"Manzanilla": 0.90,
|
224 |
+
},
|
225 |
+
"Colacaos": {
|
226 |
+
"Colacao": 1.50,
|
227 |
+
},
|
228 |
+
"Comidas": {
|
229 |
+
"Barrita con aceite": 0.65,
|
230 |
+
"Barrita con tomate": 1.30,
|
231 |
+
"Palmera de chocolate": 1.50,
|
232 |
+
"Palmera de chocolate blanco": 1.50,
|
233 |
+
"Yogurt": 1.00,
|
234 |
+
"Pincho de tortilla": 1.50
|
235 |
+
}
|
236 |
+
"Nada": 0.00,
|
237 |
}
|
238 |
+
|
239 |
+
# # Define item prices
|
240 |
+
# item_prices = {
|
241 |
+
# "Café con leche": 1.20,
|
242 |
+
# "Colacao": 1.50,
|
243 |
+
# "Café Descafeinado con leche": 1.20,
|
244 |
+
# "Cortado": 1.20,
|
245 |
+
# "Café Aguasusia": 1.20,
|
246 |
+
# "Café Aguasusia susia": 1.20,
|
247 |
+
# "Café descafeinado con leche desnatada": 1.20,
|
248 |
+
# "Café Italiano": 1.20,
|
249 |
+
# "Café con soja": 1.20,
|
250 |
+
# "Té": 0.90,
|
251 |
+
# "Manzanilla": 0.90,
|
252 |
+
# "Nada": 0.00,
|
253 |
+
# "Barrita con aceite": 0.65,
|
254 |
+
# "Barrita con tomate": 1.30,
|
255 |
+
# "Palmera de chocolate": 1.50,
|
256 |
+
# "Palmera de chocolate blanco": 1.50,
|
257 |
+
# "Yogurt": 1.00,
|
258 |
+
# "Pincho de tortilla": 1.50
|
259 |
+
# }
|
260 |
# Define combined prices for special combinations
|
261 |
combo_prices = {
|
262 |
"desayuno + café (aceite)": 1.85,
|
263 |
+
"desayuno + café (tomate)": 2.50,
|
264 |
+
"desayuno + café (napolitana)": 1.85,
|
265 |
}
|
266 |
|
267 |
# Use session state to persist ticket generation status
|
|
|
273 |
ticket = []
|
274 |
|
275 |
# Iterate over each user's selections
|
276 |
+
drinks = []
|
277 |
+
foods = []
|
278 |
for _, row in current_df.iterrows():
|
279 |
+
drinks.append(row['Drinks'])
|
280 |
+
foods.append(row['Food'])
|
281 |
+
|
282 |
+
# Convert every type of "café" to just "café"
|
283 |
+
drinks = ["Café" for x in drinks if x in item_prices["Cafés"].keys() else x]
|
284 |
+
|
285 |
+
# Display selections
|
286 |
+
st.write(f"Drinks: {drinks}")
|
287 |
+
st.write(f"Foods: {foods}")
|
288 |
+
|
289 |
+
|
290 |
+
|
291 |
+
# drinks = row['Drinks'].split(", ") if isinstance(row['Drinks'], str) else []
|
292 |
+
# food = row['Food'].split(", ") if isinstance(row['Food'], str) else []
|
293 |
+
|
294 |
+
# used_drinks = set()
|
295 |
+
# used_food = set()
|
296 |
+
|
297 |
+
# # Handle combinations of café + barrita con aceite
|
298 |
+
# for drink in drinks:
|
299 |
+
# if "café" in drink.lower() and "Barrita con aceite" in food:
|
300 |
+
# ticket.append({"Item": "desayuno + café (aceite)", "Price": combo_prices["desayuno + café (aceite)"]})
|
301 |
+
# used_drinks.add(drink)
|
302 |
+
# used_food.add("Barrita con aceite")
|
303 |
+
# break
|
304 |
+
|
305 |
+
# # Handle combinations of café + barrita con tomate
|
306 |
+
# for drink in drinks:
|
307 |
+
# if "café" in drink.lower() and "Barrita con tomate" in food and drink not in used_drinks:
|
308 |
+
# ticket.append({"Item": "desayuno + café (tomate)", "Price": combo_prices["desayuno + café (tomate)"]})
|
309 |
+
# used_drinks.add(drink)
|
310 |
+
# used_food.add("Barrita con tomate")
|
311 |
+
# break
|
312 |
+
|
313 |
+
# # Add remaining individual drinks not used in combinations
|
314 |
+
# for drink in drinks:
|
315 |
+
# if drink not in used_drinks and drink in item_prices:
|
316 |
+
# ticket.append({"Item": drink, "Price": item_prices[drink]})
|
317 |
+
# used_drinks.add(drink)
|
318 |
+
|
319 |
+
# # Add remaining individual food not used in combinations
|
320 |
+
# for f in food:
|
321 |
+
# if f not in used_food and f in item_prices:
|
322 |
+
# ticket.append({"Item": f, "Price": item_prices[f]})
|
323 |
+
# used_food.add(f)
|
324 |
|
325 |
# Create a DataFrame to display the ticket
|
326 |
ticket_df = pd.DataFrame(ticket)
|