Ninad077 commited on
Commit
89f8a67
·
verified ·
1 Parent(s): 50e775d

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +50 -24
app.py CHANGED
@@ -371,25 +371,25 @@ if bundle_by == "Feature specific":
371
  st.write("")
372
 
373
  fee_type_mapping = fee_config['fee_type_mapping']
374
- selected_fee_type = st.selectbox("**Fee Type**", [""] + fee_type_mapping.get(ordering_channels, []),
375
  help="Select the type of fee")
376
 
377
 
378
  # 3rd layer mapping: Mapping of Fee type with variables
379
  variable_type_mapping = var_config["variable_type_mapping"]
380
- selected_variable_type = st.selectbox("**Variable Type**", [""] + variable_type_mapping.get(selected_fee_type, []),
381
  help="Select the type of variable")
382
 
383
  # 4th layer mapping: Mapping of Fee type with variables
384
  chargeable_on_mapping = char_config["chargeable_on_mapping"]
385
- selected_chargeable_on = st.selectbox("**Chargeable on**", [""] + chargeable_on_mapping.get(selected_variable_type, []),
386
  help="Select the type of Chargeable")
387
 
388
  # Create an empty DataFrame with the desired column names
389
  slabs_df = pd.DataFrame(columns=["Slab", "Max_value", "Commercial_value", "Usage", "Capping/Min_Guarantee_value", "Threshold"])
390
 
391
  ttt = ["Fixed %", "Flat currency", "Slab based"]
392
- selected_fee_nature = st.selectbox("**Fee Nature:**", [""] + ttt, key="fee_nature_select")
393
 
394
  if selected_fee_nature == "Slab based":
395
  st.write("Enter values for Slab based fee structure:")
@@ -434,12 +434,12 @@ if bundle_by == "Feature specific":
434
  col1, col2 = st.columns([2, 2])
435
  with col1:
436
  slab = st.selectbox("Slab:", [1, 2, 3], key="slab_select") # Selectbox for slab numbers
437
- user_input = st.text_input("**Commercial Value:**", key="user_input")
438
- Capping_or_Minimum_Guarantee = st.text_input("**Capping/Min_Guarantee:**", key="Capping_or_Minimum_Guarantee_input")
439
  with col2:
440
- max_value = st.text_input("**Max value:**", key="max_value_input")
441
- Usage = st.text_input("**Usage:**", key="Usage_input")
442
- threshold = st.text_input("**Threshold:**", key="threshold_input")
443
 
444
  # Button to add data
445
  if st.button("Add Data", key="add_data_button"):
@@ -475,14 +475,14 @@ if bundle_by == "Feature specific":
475
 
476
  # 6th layer: Expected Billing
477
  fee_reversal_options = ["RTO", "DTO", "Cancel"]
478
- fee_reversal = st.multiselect("**Fee Reversal**", fee_reversal_options) if selected_fee_type == "Transaction" and selected_variable_type == "Bag" else None
479
- 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
480
 
481
- usage_1 = st.number_input(f"**Usage limit for****{selected_variable_type}**", min_value=0.0, help="Enter the usage limit")
482
  usage_2 = float(usage_1)
483
  usage_3 = "{:.2f}".format(usage_2)
484
 
485
- Capping_or_Minimum_Guarantee_1 = st.number_input(f"**Threshold value for {selected_variable_type}**", min_value=0.0,
486
  help="Enter the Capping/Minimum Gauarntee value")
487
  Capping_or_Minimum_Guarantee_2 = float(Capping_or_Minimum_Guarantee_1)
488
  Capping_or_Minimum_Guarantee_3 = "{:.2f}".format(Capping_or_Minimum_Guarantee_2)
@@ -494,7 +494,7 @@ if bundle_by == "Feature specific":
494
 
495
 
496
  abc = ['Capping value', 'Minimum Guarantee']
497
- threshold = st.selectbox("**Threshold option:**", [""] + abc)
498
 
499
  initial_expected_billing = Product_3
500
 
@@ -505,10 +505,23 @@ if bundle_by == "Feature specific":
505
  else:
506
  expected_billing = initial_expected_billing # Default to initial Product value if no threshold selected
507
 
508
- st.write(f"**Expected Billing (excluding GST): {expected_billing}**")
 
 
 
 
 
 
 
 
 
 
 
 
 
509
 
510
- selected_plan_validity = st.selectbox("**Plan Validity**", [""] + plan_validity_options, help="Select the plan validity", key="plan_vd_2")
511
- selected_payment_method = st.selectbox("**Payment Method**", [""] + payment_method_options, help="Select the payment method", key="py_vd_2")
512
 
513
  # Submit button
514
  # Define CSS styles for the button
@@ -704,29 +717,42 @@ elif bundle_by == "Single value":
704
 
705
 
706
  fee_type_mapping = fee_config['fee_type_mapping']
707
- selected_fee_type = st.selectbox("**Fee Type**", [""] + fee_type_mapping.get(ordering_channels, []),
708
  help="Select the type of fee")
709
 
710
  # 3rd layer mapping: Mapping of Fee type with variables
711
  variable_type_mapping = var_config["variable_type_mapping"]
712
- selected_variable_type = st.selectbox("**Variable Type**", [""] + variable_type_mapping.get(selected_fee_type, []),
713
  help="Select the type of variable")
714
 
715
  # 4th layer mapping: Mapping of Fee type with variables
716
  chargeable_on_mapping = char_config["chargeable_on_mapping"]
717
- selected_chargeable_on = st.selectbox("**Chargeable on**", [""] + chargeable_on_mapping.get(selected_variable_type, []),
718
  help="Select the type of Chargeable")
719
 
720
- usage_1 = st.number_input(f"**Usage limit for {selected_variable_type}**", min_value=0.0, help="Enter the usage limit")
721
  usage_2 = float(usage_1)
722
  usage_3 = "{:.2f}".format(usage_2)
723
 
724
  expected_billing = user_input_3
725
 
726
- st.write(f"**Expected Billing (excluding GST): {expected_billing}**")
 
 
 
 
 
 
 
 
 
 
 
 
 
727
 
728
- selected_plan_validity = st.selectbox("**Plan Validity**", [""] + plan_validity_options, help="Select the plan validity", key="plan_vd_2")
729
- selected_payment_method = st.selectbox("**Payment Method**", [""] + payment_method_options, help="Select the payment method", key="py_vd_2")
730
 
731
 
732
  button_styles = """
 
371
  st.write("")
372
 
373
  fee_type_mapping = fee_config['fee_type_mapping']
374
+ selected_fee_type = st.selectbox("Fee Type", [""] + fee_type_mapping.get(ordering_channels, []),
375
  help="Select the type of fee")
376
 
377
 
378
  # 3rd layer mapping: Mapping of Fee type with variables
379
  variable_type_mapping = var_config["variable_type_mapping"]
380
+ selected_variable_type = st.selectbox("Variable Type", [""] + variable_type_mapping.get(selected_fee_type, []),
381
  help="Select the type of variable")
382
 
383
  # 4th layer mapping: Mapping of Fee type with variables
384
  chargeable_on_mapping = char_config["chargeable_on_mapping"]
385
+ selected_chargeable_on = st.selectbox("Chargeable on", [""] + chargeable_on_mapping.get(selected_variable_type, []),
386
  help="Select the type of Chargeable")
387
 
388
  # Create an empty DataFrame with the desired column names
389
  slabs_df = pd.DataFrame(columns=["Slab", "Max_value", "Commercial_value", "Usage", "Capping/Min_Guarantee_value", "Threshold"])
390
 
391
  ttt = ["Fixed %", "Flat currency", "Slab based"]
392
+ selected_fee_nature = st.selectbox("Fee Nature:", [""] + ttt, key="fee_nature_select")
393
 
394
  if selected_fee_nature == "Slab based":
395
  st.write("Enter values for Slab based fee structure:")
 
434
  col1, col2 = st.columns([2, 2])
435
  with col1:
436
  slab = st.selectbox("Slab:", [1, 2, 3], key="slab_select") # Selectbox for slab numbers
437
+ user_input = st.text_input("Commercial Value:", key="user_input")
438
+ Capping_or_Minimum_Guarantee = st.text_input("Capping/Min_Guarantee:", key="Capping_or_Minimum_Guarantee_input")
439
  with col2:
440
+ max_value = st.text_input("Max value:", key="max_value_input")
441
+ Usage = st.text_input("Usage:", key="Usage_input")
442
+ threshold = st.text_input("Threshold:", key="threshold_input")
443
 
444
  # Button to add data
445
  if st.button("Add Data", key="add_data_button"):
 
475
 
476
  # 6th layer: Expected Billing
477
  fee_reversal_options = ["RTO", "DTO", "Cancel"]
478
+ fee_reversal = st.multiselect("Fee Reversal", fee_reversal_options) if selected_fee_type == "Transaction" and selected_variable_type == "Bag" else None
479
+ 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
480
 
481
+ usage_1 = st.number_input(f"Usage limit for {selected_variable_type}", min_value=0.0, help="Enter the usage limit")
482
  usage_2 = float(usage_1)
483
  usage_3 = "{:.2f}".format(usage_2)
484
 
485
+ Capping_or_Minimum_Guarantee_1 = st.number_input(f"Threshold value for {selected_variable_type}", min_value=0.0,
486
  help="Enter the Capping/Minimum Gauarntee value")
487
  Capping_or_Minimum_Guarantee_2 = float(Capping_or_Minimum_Guarantee_1)
488
  Capping_or_Minimum_Guarantee_3 = "{:.2f}".format(Capping_or_Minimum_Guarantee_2)
 
494
 
495
 
496
  abc = ['Capping value', 'Minimum Guarantee']
497
+ threshold = st.selectbox("Threshold option:", [""] + abc)
498
 
499
  initial_expected_billing = Product_3
500
 
 
505
  else:
506
  expected_billing = initial_expected_billing # Default to initial Product value if no threshold selected
507
 
508
+ html_content_7 = f"""
509
+ <h1 style='
510
+ color: #a689f6;
511
+ font-size: 20px;
512
+ background-image: -webkit-linear-gradient(0deg, #a689f6 3%, #272191 33%, #413bb9 61%);
513
+ background-clip: text;
514
+ -webkit-background-clip: text;
515
+ text-fill-color: transparent;
516
+ -webkit-text-fill-color: transparent;
517
+ '>Expected Billing (excluding GST): {expected_billing}</h1>
518
+ """
519
+
520
+ # Using Streamlit to display the HTML content
521
+ st.markdown(html_content_7, unsafe_allow_html=True)
522
 
523
+ selected_plan_validity = st.selectbox("Plan Validity", [""] + plan_validity_options, help="Select the plan validity", key="plan_vd_2")
524
+ selected_payment_method = st.selectbox("Payment Method", [""] + payment_method_options, help="Select the payment method", key="py_vd_2")
525
 
526
  # Submit button
527
  # Define CSS styles for the button
 
717
 
718
 
719
  fee_type_mapping = fee_config['fee_type_mapping']
720
+ selected_fee_type = st.selectbox("Fee Type", [""] + fee_type_mapping.get(ordering_channels, []),
721
  help="Select the type of fee")
722
 
723
  # 3rd layer mapping: Mapping of Fee type with variables
724
  variable_type_mapping = var_config["variable_type_mapping"]
725
+ selected_variable_type = st.selectbox("Variable Type", [""] + variable_type_mapping.get(selected_fee_type, []),
726
  help="Select the type of variable")
727
 
728
  # 4th layer mapping: Mapping of Fee type with variables
729
  chargeable_on_mapping = char_config["chargeable_on_mapping"]
730
+ selected_chargeable_on = st.selectbox("Chargeable on", [""] + chargeable_on_mapping.get(selected_variable_type, []),
731
  help="Select the type of Chargeable")
732
 
733
+ usage_1 = st.number_input(f"Usage limit for {selected_variable_type}", min_value=0.0, help="Enter the usage limit")
734
  usage_2 = float(usage_1)
735
  usage_3 = "{:.2f}".format(usage_2)
736
 
737
  expected_billing = user_input_3
738
 
739
+ html_content_8 = f"""
740
+ <h1 style='
741
+ color: #a689f6;
742
+ font-size: 20px;
743
+ background-image: -webkit-linear-gradient(0deg, #a689f6 3%, #272191 33%, #413bb9 61%);
744
+ background-clip: text;
745
+ -webkit-background-clip: text;
746
+ text-fill-color: transparent;
747
+ -webkit-text-fill-color: transparent;
748
+ '>Expected Billing (excluding GST): {expected_billing}</h1>
749
+ """
750
+
751
+ # Using Streamlit to display the HTML content
752
+ st.markdown(html_content_8, unsafe_allow_html=True)
753
 
754
+ selected_plan_validity = st.selectbox("Plan Validity", [""] + plan_validity_options, help="Select the plan validity", key="plan_vd_2")
755
+ selected_payment_method = st.selectbox("Payment Method", [""] + payment_method_options, help="Select the payment method", key="py_vd_2")
756
 
757
 
758
  button_styles = """