Ninad077 commited on
Commit
17b74bd
·
verified ·
1 Parent(s): 7fb4341

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -27
app.py CHANGED
@@ -211,7 +211,7 @@ set_bg_hack_image(demo_image_path, width='100%', height='100vh')
211
  st.sidebar.image('Fynd_logo2.png', width=300)
212
  st.sidebar.title(":blue[Plan maker]")
213
  user_name = st.sidebar.text_input("Enter your name:")
214
- st.sidebar.title("Section 1: Plan Info")
215
  v1 = ["Commerce India", "Reliance", "Commerce Global", "Government Projects", "Individual BH"]
216
  business_head = st.sidebar.selectbox("Business Head", [""] + v1, help="Enter the name of Business head")
217
  company_id = st.sidebar.text_input("Company ID", help="Enter the company ID")
@@ -227,7 +227,7 @@ if bundle_by == "Feature specific":
227
 
228
 
229
  # Section 2: Company Info
230
- st.sidebar.title("Section 2: Rule Info")
231
  a1 = ["GoFynd", "Uniket", "B2B", "Marketplaces", "StoreOS", "Storefronts", "ONDC", "Fynd OMS", "Fynd TMS", "Fynd WMS",
232
  "GMC", "Catalog Cloud", "Fynd Commerce Platform", "Logistics", "PixelBin", "Boltic", "CoPilot"]
233
  ordering_channels = st.sidebar.selectbox("Product lines", [""] + a1, help="Select the ordering channels")
@@ -317,25 +317,25 @@ if bundle_by == "Feature specific":
317
  st.write("")
318
 
319
  fee_type_mapping = fee_config['fee_type_mapping']
320
- selected_fee_type = st.selectbox("Fee Type", [""] + fee_type_mapping.get(ordering_channels, []),
321
  help="Select the type of fee")
322
 
323
 
324
  # 3rd layer mapping: Mapping of Fee type with variables
325
  variable_type_mapping = var_config["variable_type_mapping"]
326
- selected_variable_type = st.selectbox("Variable Type", [""] + variable_type_mapping.get(selected_fee_type, []),
327
  help="Select the type of variable")
328
 
329
  # 4th layer mapping: Mapping of Fee type with variables
330
  chargeable_on_mapping = char_config["chargeable_on_mapping"]
331
- selected_chargeable_on = st.selectbox("Chargeable on", [""] + chargeable_on_mapping.get(selected_variable_type, []),
332
  help="Select the type of Chargeable")
333
 
334
  # Create an empty DataFrame with the desired column names
335
  slabs_df = pd.DataFrame(columns=["Slab", "Max_value", "Commercial_value", "Usage", "Capping/Min_Guarantee_value", "Threshold"])
336
 
337
  ttt = ["Fixed %", "Flat currency", "Slab based"]
338
- selected_fee_nature = st.selectbox("Fee Nature:", [""] + ttt, key="fee_nature_select")
339
 
340
  if selected_fee_nature == "Slab based":
341
  st.write("Enter values for Slab based fee structure:")
@@ -379,12 +379,12 @@ if bundle_by == "Feature specific":
379
  col1, col2 = st.columns([2, 2])
380
  with col1:
381
  slab = st.selectbox("Slab:", [1, 2, 3], key="slab_select")
382
- user_input = st.text_input("Commercial Value:", key="user_input")
383
- Capping_or_Minimum_Guarantee = st.text_input("Capping/Min_Guarantee:", key="Capping_or_Minimum_Guarantee_input")
384
  with col2:
385
- max_value = st.text_input("Max value:", key="max_value_input")
386
- Usage = st.text_input("Usage:", key="Usage_input")
387
- threshold = st.text_input("Threshold:", key="threshold_input")
388
 
389
  # Button to add data
390
  if st.button("Add Data", key="add_data_button"):
@@ -401,19 +401,19 @@ if bundle_by == "Feature specific":
401
 
402
 
403
  elif selected_fee_nature in ["Fixed %", "Flat currency"]:
404
- user_input = st.number_input("Commercial value:", min_value=0.0, help="Enter a valid number")
405
 
406
  # 6th layer: Expected Billing
407
  fee_reversal_options = ["RTO", "DTO", "Cancel"]
408
- fee_reversal = st.multiselect("Fee Reversal", fee_reversal_options) if selected_fee_type == "Transaction" and selected_variable_type == "Bag" else None
409
- reversal_per = st.number_input("Reversal %", min_value= 0.0, help = "Enter the reversal percentage") if selected_fee_type == "Transaction" and selected_variable_type == "Bag" else None
410
- Usage = st.number_input(f"Usage limit for {selected_variable_type}", min_value=0.0, help="Enter the usage limit")
411
- Capping_or_Minimum_Guarantee = st.number_input(f"Capping/Minimum Guarantee for {selected_variable_type}", min_value=0.0,
412
  help="Enter the Capping/Minimum Gauarntee value")
413
  Product = Usage * user_input if selected_fee_nature in ["Fixed %", "Flat currency"] else 0
414
 
415
  abc = ['Capping value', 'Minimum Guarantee']
416
- threshold = st.selectbox("Threshold option:", [""] + abc)
417
 
418
  initial_expected_billing = Product
419
 
@@ -424,10 +424,10 @@ if bundle_by == "Feature specific":
424
  else:
425
  expected_billing = initial_expected_billing # Default to initial Product value if no threshold selected
426
 
427
- st.write(f"Expected Billing (excluding GST): {expected_billing}")
428
 
429
- selected_plan_validity = st.selectbox("Plan Validity", [""] + plan_validity_options, help="Select the plan validity", key="plan_vd_2")
430
- selected_payment_method = st.selectbox("Payment Method", [""] + payment_method_options, help="Select the payment method", key="py_vd_2")
431
 
432
  # Submit button
433
  if st.button("Submit"):
@@ -476,7 +476,7 @@ if bundle_by == "Feature specific":
476
 
477
 
478
  elif bundle_by == "Single value":
479
- user_input_1 = st.sidebar.text_input("Enter Single values:")
480
 
481
  plan_name = st.sidebar.text_input("Plan Name", help="Enter the name of the plan")
482
  plan_description = st.sidebar.text_area("Plan Description", max_chars=250, help="Describe the plan")
@@ -578,22 +578,22 @@ elif bundle_by == "Single value":
578
 
579
 
580
  fee_type_mapping = fee_config['fee_type_mapping']
581
- selected_fee_type = st.selectbox("Fee Type", [""] + fee_type_mapping.get(ordering_channels, []),
582
  help="Select the type of fee")
583
 
584
  # 3rd layer mapping: Mapping of Fee type with variables
585
  variable_type_mapping = var_config["variable_type_mapping"]
586
- selected_variable_type = st.selectbox("Variable Type", [""] + variable_type_mapping.get(selected_fee_type, []),
587
  help="Select the type of variable")
588
 
589
  # 4th layer mapping: Mapping of Fee type with variables
590
  chargeable_on_mapping = char_config["chargeable_on_mapping"]
591
- selected_chargeable_on = st.selectbox("Chargeable on", [""] + chargeable_on_mapping.get(selected_variable_type, []),
592
  help="Select the type of Chargeable")
593
 
594
- Usage = st.number_input(f"Usage limit for {selected_variable_type}", min_value=0.0, help="Enter the usage limit")
595
- selected_plan_validity = st.selectbox("Plan Validity", [""] + plan_validity_options, help="Select the plan validity", key="plan_vd_2")
596
- selected_payment_method = st.selectbox("Payment Method", [""] + payment_method_options, help="Select the payment method", key="py_vd_2")
597
 
598
  # Submit button
599
  if st.button("Submit"):
 
211
  st.sidebar.image('Fynd_logo2.png', width=300)
212
  st.sidebar.title(":blue[Plan maker]")
213
  user_name = st.sidebar.text_input("Enter your name:")
214
+ st.sidebar.title(":blue[Section 1: Plan Info]")
215
  v1 = ["Commerce India", "Reliance", "Commerce Global", "Government Projects", "Individual BH"]
216
  business_head = st.sidebar.selectbox("Business Head", [""] + v1, help="Enter the name of Business head")
217
  company_id = st.sidebar.text_input("Company ID", help="Enter the company ID")
 
227
 
228
 
229
  # Section 2: Company Info
230
+ st.sidebar.title(":blue[Section 2: Rule Info]")
231
  a1 = ["GoFynd", "Uniket", "B2B", "Marketplaces", "StoreOS", "Storefronts", "ONDC", "Fynd OMS", "Fynd TMS", "Fynd WMS",
232
  "GMC", "Catalog Cloud", "Fynd Commerce Platform", "Logistics", "PixelBin", "Boltic", "CoPilot"]
233
  ordering_channels = st.sidebar.selectbox("Product lines", [""] + a1, help="Select the ordering channels")
 
317
  st.write("")
318
 
319
  fee_type_mapping = fee_config['fee_type_mapping']
320
+ selected_fee_type = st.selectbox("**Fee Type**", [""] + fee_type_mapping.get(ordering_channels, []),
321
  help="Select the type of fee")
322
 
323
 
324
  # 3rd layer mapping: Mapping of Fee type with variables
325
  variable_type_mapping = var_config["variable_type_mapping"]
326
+ selected_variable_type = st.selectbox("**Variable Type**", [""] + variable_type_mapping.get(selected_fee_type, []),
327
  help="Select the type of variable")
328
 
329
  # 4th layer mapping: Mapping of Fee type with variables
330
  chargeable_on_mapping = char_config["chargeable_on_mapping"]
331
+ selected_chargeable_on = st.selectbox("**Chargeable on**", [""] + chargeable_on_mapping.get(selected_variable_type, []),
332
  help="Select the type of Chargeable")
333
 
334
  # Create an empty DataFrame with the desired column names
335
  slabs_df = pd.DataFrame(columns=["Slab", "Max_value", "Commercial_value", "Usage", "Capping/Min_Guarantee_value", "Threshold"])
336
 
337
  ttt = ["Fixed %", "Flat currency", "Slab based"]
338
+ selected_fee_nature = st.selectbox("**Fee Nature:**", [""] + ttt, key="fee_nature_select")
339
 
340
  if selected_fee_nature == "Slab based":
341
  st.write("Enter values for Slab based fee structure:")
 
379
  col1, col2 = st.columns([2, 2])
380
  with col1:
381
  slab = st.selectbox("Slab:", [1, 2, 3], key="slab_select")
382
+ user_input = st.text_input("**Commercial Value:**", key="user_input")
383
+ Capping_or_Minimum_Guarantee = st.text_input("**Capping/Min_Guarantee:**", key="Capping_or_Minimum_Guarantee_input")
384
  with col2:
385
+ max_value = st.text_input("**Max value:**", key="max_value_input")
386
+ Usage = st.text_input("**Usage:**", key="Usage_input")
387
+ threshold = st.text_input("**Threshold:**", key="threshold_input")
388
 
389
  # Button to add data
390
  if st.button("Add Data", key="add_data_button"):
 
401
 
402
 
403
  elif selected_fee_nature in ["Fixed %", "Flat currency"]:
404
+ user_input = st.number_input("**Commercial value:**", min_value=0.0, help="Enter a valid number")
405
 
406
  # 6th layer: Expected Billing
407
  fee_reversal_options = ["RTO", "DTO", "Cancel"]
408
+ fee_reversal = st.multiselect("**Fee Reversal**", fee_reversal_options) if selected_fee_type == "Transaction" and selected_variable_type == "Bag" else None
409
+ reversal_per = st.number_input("**Reversal %**", min_value= 0.0, help = "Enter the reversal percentage") if selected_fee_type == "Transaction" and selected_variable_type == "Bag" else None
410
+ Usage = st.number_input(f"**Usage limit for {selected_variable_type}**", min_value=0.0, help="Enter the usage limit")
411
+ Capping_or_Minimum_Guarantee = st.number_input(f"**Capping/Minimum Guarantee for {selected_variable_type}**", min_value=0.0,
412
  help="Enter the Capping/Minimum Gauarntee value")
413
  Product = Usage * user_input if selected_fee_nature in ["Fixed %", "Flat currency"] else 0
414
 
415
  abc = ['Capping value', 'Minimum Guarantee']
416
+ threshold = st.selectbox("**Threshold option:**", [""] + abc)
417
 
418
  initial_expected_billing = Product
419
 
 
424
  else:
425
  expected_billing = initial_expected_billing # Default to initial Product value if no threshold selected
426
 
427
+ st.write(f"**Expected Billing (excluding GST): {expected_billing}**")
428
 
429
+ selected_plan_validity = st.selectbox("**Plan Validity**", [""] + plan_validity_options, help="Select the plan validity", key="plan_vd_2")
430
+ selected_payment_method = st.selectbox("**Payment Method**", [""] + payment_method_options, help="Select the payment method", key="py_vd_2")
431
 
432
  # Submit button
433
  if st.button("Submit"):
 
476
 
477
 
478
  elif bundle_by == "Single value":
479
+ user_input_1 = st.sidebar.text_input("Enter Commercial value:")
480
 
481
  plan_name = st.sidebar.text_input("Plan Name", help="Enter the name of the plan")
482
  plan_description = st.sidebar.text_area("Plan Description", max_chars=250, help="Describe the plan")
 
578
 
579
 
580
  fee_type_mapping = fee_config['fee_type_mapping']
581
+ selected_fee_type = st.selectbox("**Fee Type**", [""] + fee_type_mapping.get(ordering_channels, []),
582
  help="Select the type of fee")
583
 
584
  # 3rd layer mapping: Mapping of Fee type with variables
585
  variable_type_mapping = var_config["variable_type_mapping"]
586
+ selected_variable_type = st.selectbox("**Variable Type**", [""] + variable_type_mapping.get(selected_fee_type, []),
587
  help="Select the type of variable")
588
 
589
  # 4th layer mapping: Mapping of Fee type with variables
590
  chargeable_on_mapping = char_config["chargeable_on_mapping"]
591
+ selected_chargeable_on = st.selectbox("**Chargeable on**", [""] + chargeable_on_mapping.get(selected_variable_type, []),
592
  help="Select the type of Chargeable")
593
 
594
+ Usage = st.number_input(f"**Usage limit for {selected_variable_type}**", min_value=0.0, help="Enter the usage limit")
595
+ selected_plan_validity = st.selectbox("**Plan Validity**", [""] + plan_validity_options, help="Select the plan validity", key="plan_vd_2")
596
+ selected_payment_method = st.selectbox("**Payment Method**", [""] + payment_method_options, help="Select the payment method", key="py_vd_2")
597
 
598
  # Submit button
599
  if st.button("Submit"):