MarcosRodrigo commited on
Commit
e467446
·
verified ·
1 Parent(s): 9b5c7b9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -1
app.py CHANGED
@@ -221,11 +221,29 @@ elif menu == "History":
221
  # "Current" view to display the current summary of all users' selections and generate ticket
222
  elif menu == "Current":
223
  st.title("Current Selections of All Users")
 
224
  if st.button("Reload Selections"):
225
  download_temp_file_from_repo()
 
 
226
  current_df = load_current_selections()
227
  st.table(current_df)
228
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
229
  # Define item prices
230
  item_prices = {
231
  "Café con leche": 1.20, "Colacao": 1.00, "Descafeinado con leche": 1.20, "Cortado": 1.20,
@@ -240,7 +258,7 @@ elif menu == "Current":
240
  "desayuno + café (tomate)": 2.50
241
  }
242
 
243
- # Generate Ticket
244
  if st.button("Generate Ticket"):
245
  # Create a list to hold the ticket items
246
  ticket = []
 
221
  # "Current" view to display the current summary of all users' selections and generate ticket
222
  elif menu == "Current":
223
  st.title("Current Selections of All Users")
224
+
225
  if st.button("Reload Selections"):
226
  download_temp_file_from_repo()
227
+
228
+ # Display current selections
229
  current_df = load_current_selections()
230
  st.table(current_df)
231
 
232
+ # Button to submit the summary to history
233
+ if st.button("Submit Summary to History"):
234
+ timestamp = save_summary_to_history()
235
+ st.success(f"Summary saved to history at {timestamp}")
236
+ st.session_state.history = load_history()
237
+
238
+ # Clear local and remote current selections
239
+ if os.path.exists(TEMP_FILE):
240
+ os.remove(TEMP_FILE)
241
+ delete_file_from_repo(TEMP_FILE) # Delete the file from the remote repo
242
+
243
+ # Create an empty CSV to replace the deleted one
244
+ pd.DataFrame(columns=["Name", "Drinks", "Food"]).to_csv(TEMP_FILE, index=False)
245
+ upload_temp_file_to_repo()
246
+
247
  # Define item prices
248
  item_prices = {
249
  "Café con leche": 1.20, "Colacao": 1.00, "Descafeinado con leche": 1.20, "Cortado": 1.20,
 
258
  "desayuno + café (tomate)": 2.50
259
  }
260
 
261
+ # Generate Ticket Button and Logic
262
  if st.button("Generate Ticket"):
263
  # Create a list to hold the ticket items
264
  ticket = []