Spaces:
Running
Running
MarcosRodrigo
commited on
Commit
•
954094e
1
Parent(s):
6970efa
Update app.py
Browse files
app.py
CHANGED
@@ -201,7 +201,7 @@ elif menu == "Current":
|
|
201 |
if st.button("Reload Selections"):
|
202 |
download_temp_file_from_repo()
|
203 |
|
204 |
-
#
|
205 |
current_df = load_current_selections()
|
206 |
st.table(current_df)
|
207 |
|
@@ -219,8 +219,9 @@ elif menu == "Current":
|
|
219 |
"desayuno + café (tomate)": 2.50
|
220 |
}
|
221 |
|
222 |
-
#
|
223 |
-
ticket_generated
|
|
|
224 |
|
225 |
# Generate Ticket Button and Logic
|
226 |
if st.button("Generate Ticket"):
|
@@ -275,11 +276,11 @@ elif menu == "Current":
|
|
275 |
total_price = sum([float(price) for price in ticket_df["Price"]])
|
276 |
st.write(f"**Total Price:** {total_price:.2f} €")
|
277 |
|
278 |
-
# Set ticket_generated to True
|
279 |
-
ticket_generated = True
|
280 |
|
281 |
-
# Only show the "Submit Summary to History" button
|
282 |
-
if ticket_generated:
|
283 |
if st.button("Submit Summary to History"):
|
284 |
timestamp = save_summary_to_history()
|
285 |
st.success(f"Summary saved to history at {timestamp}")
|
@@ -294,9 +295,10 @@ elif menu == "Current":
|
|
294 |
pd.DataFrame(columns=["Name", "Drinks", "Food"]).to_csv(TEMP_FILE, index=False)
|
295 |
upload_temp_file_to_repo()
|
296 |
|
297 |
-
# Reset session state for current selections
|
298 |
st.session_state.current_selections = []
|
299 |
-
|
|
|
300 |
# Reload the current selections to show an empty table
|
301 |
current_df = pd.DataFrame(columns=["Name", "Drinks", "Food"])
|
302 |
st.table(current_df)
|
|
|
201 |
if st.button("Reload Selections"):
|
202 |
download_temp_file_from_repo()
|
203 |
|
204 |
+
# Load the current selections from the session state or from the file
|
205 |
current_df = load_current_selections()
|
206 |
st.table(current_df)
|
207 |
|
|
|
219 |
"desayuno + café (tomate)": 2.50
|
220 |
}
|
221 |
|
222 |
+
# Use session state to persist ticket generation status
|
223 |
+
if "ticket_generated" not in st.session_state:
|
224 |
+
st.session_state.ticket_generated = False
|
225 |
|
226 |
# Generate Ticket Button and Logic
|
227 |
if st.button("Generate Ticket"):
|
|
|
276 |
total_price = sum([float(price) for price in ticket_df["Price"]])
|
277 |
st.write(f"**Total Price:** {total_price:.2f} €")
|
278 |
|
279 |
+
# Set ticket_generated to True in session state
|
280 |
+
st.session_state.ticket_generated = True
|
281 |
|
282 |
+
# Only show the "Submit Summary to History" button if a ticket is generated
|
283 |
+
if st.session_state.ticket_generated:
|
284 |
if st.button("Submit Summary to History"):
|
285 |
timestamp = save_summary_to_history()
|
286 |
st.success(f"Summary saved to history at {timestamp}")
|
|
|
295 |
pd.DataFrame(columns=["Name", "Drinks", "Food"]).to_csv(TEMP_FILE, index=False)
|
296 |
upload_temp_file_to_repo()
|
297 |
|
298 |
+
# Reset session state for current selections and ticket generation status
|
299 |
st.session_state.current_selections = []
|
300 |
+
st.session_state.ticket_generated = False
|
301 |
+
|
302 |
# Reload the current selections to show an empty table
|
303 |
current_df = pd.DataFrame(columns=["Name", "Drinks", "Food"])
|
304 |
st.table(current_df)
|