AnnasBlackHat commited on
Commit
b410d5b
·
1 Parent(s): fa9147a

add hour, fix submit

Browse files
Files changed (1) hide show
  1. app.py +12 -3
app.py CHANGED
@@ -19,11 +19,15 @@ st.set_page_config(layout="wide")
19
  later_time = (datetime.now() + timedelta(hours=7))
20
  # Init variable
21
  if "cache" not in st.session_state:
 
22
  st.session_state.cache = {}
23
 
24
  if "last_data" not in st.session_state:
25
  st.session_state.last_data = {}
26
 
 
 
 
27
  # Set the page to full width
28
  print('>>>> start over <<<<<')
29
  # Streamlit app
@@ -114,7 +118,7 @@ def format_df(data):
114
 
115
  detail_data = df[df["stock_price_id"] == row["stock_price_id"]]
116
  detail_table = detail_data[["stock out", "stock_out", "date_out"]]
117
- detail_table['stock_out_origin'] = detail_data['stock_out'].astype(float)
118
  tables.append({'main': main_table,
119
  'detail': detail_table})
120
 
@@ -122,7 +126,7 @@ def format_df(data):
122
 
123
  def show_table():
124
  st.write("### Fifo Table")
125
- st.write(f'Product: **{product_name}**, Outlet: **{outlet_name}**, Start Date: **{start_date}**')
126
  # Make the API request
127
  api_data = make_api_request()
128
 
@@ -158,7 +162,12 @@ with st.sidebar.form("filter"):
158
  start_time = st.time_input("Start Time (stock in)", value = datetime.min )
159
  show_detail = st.checkbox("Show Detail Table", value=True)# Checkbox to show/hide detail table
160
 
161
- submitted = st.form_submit_button("Apply", on_click=show_table)
 
 
 
 
 
162
 
163
  with st.sidebar.form("edit_form"):
164
  st.write("## Edit the data")
 
19
  later_time = (datetime.now() + timedelta(hours=7))
20
  # Init variable
21
  if "cache" not in st.session_state:
22
+ print('cache not in session...')
23
  st.session_state.cache = {}
24
 
25
  if "last_data" not in st.session_state:
26
  st.session_state.last_data = {}
27
 
28
+ if "param" not in st.session_state:
29
+ st.session_state.param = {}
30
+
31
  # Set the page to full width
32
  print('>>>> start over <<<<<')
33
  # Streamlit app
 
118
 
119
  detail_data = df[df["stock_price_id"] == row["stock_price_id"]]
120
  detail_table = detail_data[["stock out", "stock_out", "date_out"]]
121
+ # detail_table['stock_out_origin'] = detail_data['stock_out'].astype(float)
122
  tables.append({'main': main_table,
123
  'detail': detail_table})
124
 
 
126
 
127
  def show_table():
128
  st.write("### Fifo Table")
129
+ st.write(f'Product: **{product_name}**, Outlet: **{outlet_name}**, Start Date: **{start_date}** **{start_time}**')
130
  # Make the API request
131
  api_data = make_api_request()
132
 
 
162
  start_time = st.time_input("Start Time (stock in)", value = datetime.min )
163
  show_detail = st.checkbox("Show Detail Table", value=True)# Checkbox to show/hide detail table
164
 
165
+ print('product-name: ', product_name)
166
+ submitted = st.form_submit_button("Apply")# on_click=show_table
167
+
168
+ if submitted:
169
+ print('submit....', product_name)
170
+ show_table()
171
 
172
  with st.sidebar.form("edit_form"):
173
  st.write("## Edit the data")