Ninad077 commited on
Commit
5a251e4
·
verified ·
1 Parent(s): c8f5f95

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -12
app.py CHANGED
@@ -29,9 +29,11 @@ def generate_pm_id(user_data):
29
  selected_fee_nature = user_data.get('Fee Nature', '')
30
  threshold = user_data.get('Threshold option', '')
31
 
 
 
32
  # Extract first 2 characters from each field
33
  pm_id_parts = [
34
- company_id[:2],
35
  ordering_channels[:2],
36
  fulfilling_location[:2],
37
  application_id[:2],
@@ -107,7 +109,7 @@ plan_name = st.sidebar.text_input("Plan Name", help="Enter the name of the plan"
107
  plan_description = st.sidebar.text_area("Plan Description", max_chars=250, help="Describe the plan")
108
  plan_start_date = st.sidebar.date_input("Plan Start Date", value=datetime.now(), help="Select the start date of the plan")
109
  a1 = ["GoFynd", "Uniket", "B2B", "Marketplaces", "StoreOS", "Website", "ONDC", "OMS", "TMS", "WMS", "GMC", "Catalog Cloud", "FCP"]
110
- ordering_channels = st.sidebar.selectbox("Product lines", ["--please select--"]+a1, help="Select the ordering channels")
111
 
112
  # Section 2: Company Info
113
  st.sidebar.title("Section 2: Company Info")
@@ -120,7 +122,7 @@ if "TMS" in ordering_channels or "GMC" in ordering_channels or "Catalog Cloud" i
120
  application_id = None
121
  else:
122
  abc = ["Store", "Warehouse"]
123
- fulfilling_location = st.sidebar.selectbox("Fulfilling Location",["--please select--"] + abc, help="Select the fulfilling location")
124
  application_id = st.sidebar.text_input("Application ID", key="application_id_input", help="Enter the application ID")
125
 
126
  # Section 3: Defining products for each dropdown
@@ -186,21 +188,21 @@ char_config = {
186
 
187
  # 2nd layer: Mapping of Ordering channels with fee types
188
  fee_type_mapping = fee_config['fee_type_mapping']
189
- selected_fee_type = st.selectbox("Fee Type", ["--please select--"] + fee_type_mapping.get(ordering_channels, []), help="Select the type of fee")
190
 
191
  # 3rd layer mapping: Mapping of Fee type with variables
192
  variable_type_mapping = var_config["variable_type_mapping"]
193
- selected_variable_type = st.selectbox("Variable Type", ["--please select--"] + variable_type_mapping.get(selected_fee_type, []), help="Select the type of variable")
194
 
195
  # 4th layer mapping: Mapping of Fee type with variables
196
  chargeable_on_mapping = char_config["chargeable_on_mapping"]
197
- selected_chargeable_on = st.selectbox("Chargeable on", ["--please select--"] + chargeable_on_mapping.get(selected_variable_type, []), help="Select the type of Chargeable")
198
 
199
  # Create an empty DataFrame with the desired column names
200
  slabs_df = pd.DataFrame(columns=["Slab", "Max_value", "Commercial_value", "Usage","Capping/Min_Guarantee_value", "Threshold"])
201
 
202
  ttt = ["Fixed %", "Flat currency", "Slab based"]
203
- selected_fee_nature = st.selectbox("Fee Nature:",["--please select--"]+ ttt, key="fee_nature_select")
204
 
205
  if selected_fee_nature == "Slab based":
206
  st.write("Enter values for Slab based fee structure:")
@@ -273,7 +275,7 @@ elif selected_fee_nature in ["Fixed %", "Flat currency"]:
273
  Product = Usage * user_input if selected_fee_nature in ["Fixed %", "Flat currency"] else 0
274
 
275
  abc = ['Capping value', 'Minimum Guarantee']
276
- threshold = st.selectbox("Choose a threshold option:", ["--please select--"] + abc)
277
 
278
  initial_expected_billing = Product
279
 
@@ -286,8 +288,8 @@ elif selected_fee_nature in ["Fixed %", "Flat currency"]:
286
 
287
  st.write(f"Expected Billing: {expected_billing}")
288
 
289
- selected_plan_validity = st.selectbox("Plan Validity", ["--please select--"] + plan_validity_options, help="Select the plan validity", key = "plan_vd_2")
290
- selected_payment_method = st.selectbox("Payment Method", ["--please select--"] + payment_method_options, help="Select the payment method", key = "py_vd_2")
291
 
292
  # Submit button
293
  if st.button("Submit"):
@@ -316,8 +318,6 @@ if st.button("Submit"):
316
 
317
  global_user_data.append(user_data)
318
 
319
-
320
-
321
 
322
  # Generate PM_id and add it to user_data
323
  pm_id = generate_pm_id(user_data)
 
29
  selected_fee_nature = user_data.get('Fee Nature', '')
30
  threshold = user_data.get('Threshold option', '')
31
 
32
+ company_id = company_id.zfill(5)[:5]
33
+
34
  # Extract first 2 characters from each field
35
  pm_id_parts = [
36
+ company_id[:5],
37
  ordering_channels[:2],
38
  fulfilling_location[:2],
39
  application_id[:2],
 
109
  plan_description = st.sidebar.text_area("Plan Description", max_chars=250, help="Describe the plan")
110
  plan_start_date = st.sidebar.date_input("Plan Start Date", value=datetime.now(), help="Select the start date of the plan")
111
  a1 = ["GoFynd", "Uniket", "B2B", "Marketplaces", "StoreOS", "Website", "ONDC", "OMS", "TMS", "WMS", "GMC", "Catalog Cloud", "FCP"]
112
+ ordering_channels = st.sidebar.selectbox("Product lines", [""]+a1, help="Select the ordering channels")
113
 
114
  # Section 2: Company Info
115
  st.sidebar.title("Section 2: Company Info")
 
122
  application_id = None
123
  else:
124
  abc = ["Store", "Warehouse"]
125
+ fulfilling_location = st.sidebar.selectbox("Fulfilling Location",[""] + abc, help="Select the fulfilling location")
126
  application_id = st.sidebar.text_input("Application ID", key="application_id_input", help="Enter the application ID")
127
 
128
  # Section 3: Defining products for each dropdown
 
188
 
189
  # 2nd layer: Mapping of Ordering channels with fee types
190
  fee_type_mapping = fee_config['fee_type_mapping']
191
+ selected_fee_type = st.selectbox("Fee Type", [""] + fee_type_mapping.get(ordering_channels, []), help="Select the type of fee")
192
 
193
  # 3rd layer mapping: Mapping of Fee type with variables
194
  variable_type_mapping = var_config["variable_type_mapping"]
195
+ selected_variable_type = st.selectbox("Variable Type", [""] + variable_type_mapping.get(selected_fee_type, []), help="Select the type of variable")
196
 
197
  # 4th layer mapping: Mapping of Fee type with variables
198
  chargeable_on_mapping = char_config["chargeable_on_mapping"]
199
+ selected_chargeable_on = st.selectbox("Chargeable on", [""] + chargeable_on_mapping.get(selected_variable_type, []), help="Select the type of Chargeable")
200
 
201
  # Create an empty DataFrame with the desired column names
202
  slabs_df = pd.DataFrame(columns=["Slab", "Max_value", "Commercial_value", "Usage","Capping/Min_Guarantee_value", "Threshold"])
203
 
204
  ttt = ["Fixed %", "Flat currency", "Slab based"]
205
+ selected_fee_nature = st.selectbox("Fee Nature:",[""]+ ttt, key="fee_nature_select")
206
 
207
  if selected_fee_nature == "Slab based":
208
  st.write("Enter values for Slab based fee structure:")
 
275
  Product = Usage * user_input if selected_fee_nature in ["Fixed %", "Flat currency"] else 0
276
 
277
  abc = ['Capping value', 'Minimum Guarantee']
278
+ threshold = st.selectbox("Choose a threshold option:", [""]+ abc)
279
 
280
  initial_expected_billing = Product
281
 
 
288
 
289
  st.write(f"Expected Billing: {expected_billing}")
290
 
291
+ selected_plan_validity = st.selectbox("Plan Validity", [""]+ plan_validity_options, help="Select the plan validity", key = "plan_vd_2")
292
+ selected_payment_method = st.selectbox("Payment Method", [""]+ payment_method_options, help="Select the payment method", key = "py_vd_2")
293
 
294
  # Submit button
295
  if st.button("Submit"):
 
318
 
319
  global_user_data.append(user_data)
320
 
 
 
321
 
322
  # Generate PM_id and add it to user_data
323
  pm_id = generate_pm_id(user_data)