Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
|
@@ -8,6 +8,7 @@ import io
|
|
| 8 |
import base64
|
| 9 |
|
| 10 |
global_user_data = [] # For appending user_data
|
|
|
|
| 11 |
|
| 12 |
|
| 13 |
# Function to initialize session state
|
|
@@ -20,6 +21,11 @@ def initialize_session_state():
|
|
| 20 |
st.session_state.serial_counter = -1
|
| 21 |
|
| 22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
# Function to save user data
|
| 24 |
def save_user_data(user_data):
|
| 25 |
st.session_state.data.append(user_data)
|
|
@@ -158,65 +164,48 @@ st.set_page_config(
|
|
| 158 |
)
|
| 159 |
|
| 160 |
|
| 161 |
-
# Background image
|
| 162 |
-
|
| 163 |
-
def set_bg_hack_image(image_path, width='100%', height='100vh'):
|
| 164 |
-
'''
|
| 165 |
-
A function to set a background image from a local file with custom dimensions and shift it to the right.
|
| 166 |
-
Parameters
|
| 167 |
-
----------
|
| 168 |
-
image_path : str
|
| 169 |
-
The path to the image file.
|
| 170 |
-
width : str, optional
|
| 171 |
-
Width of the background image. Defaults to '100%'.
|
| 172 |
-
height : str, optional
|
| 173 |
-
Height of the background image. Defaults to '100vh' (100% of viewport height).
|
| 174 |
-
'''
|
| 175 |
-
with open(image_path, 'rb') as f:
|
| 176 |
-
image_data = f.read()
|
| 177 |
-
base64_image = base64.b64encode(image_data).decode('utf-8')
|
| 178 |
-
|
| 179 |
-
st.markdown(
|
| 180 |
-
f"""
|
| 181 |
-
<style>
|
| 182 |
-
:root {{
|
| 183 |
-
--bg-width: {width};
|
| 184 |
-
--bg-height: {height};
|
| 185 |
-
--bg-image: url('data:image/png;base64,{base64_image}');
|
| 186 |
-
}}
|
| 187 |
-
.stApp {{
|
| 188 |
-
background: var(--bg-image);
|
| 189 |
-
background-size: cover;
|
| 190 |
-
background-position: center; /* Shifts the image to the right */
|
| 191 |
-
width: var(--bg-width);
|
| 192 |
-
height: var(--bg-height);
|
| 193 |
-
position: fixed;
|
| 194 |
-
top: 0;
|
| 195 |
-
left: 0;
|
| 196 |
-
z-index: -1;
|
| 197 |
-
}}
|
| 198 |
-
</style>
|
| 199 |
-
""",
|
| 200 |
-
unsafe_allow_html=True
|
| 201 |
-
)
|
| 202 |
-
|
| 203 |
-
# Example usage with a demo image file and custom dimensions
|
| 204 |
-
demo_image_path = "fynd_cover.jpeg"
|
| 205 |
-
set_bg_hack_image(demo_image_path, width='100%', height='100vh')
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
# Display the image in the sidebar
|
| 210 |
st.sidebar.image('Fynd_logo2.png', width=300)
|
| 211 |
|
| 212 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 213 |
user_name = st.sidebar.text_input("Enter your name:")
|
| 214 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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")
|
| 218 |
company_name = st.sidebar.text_input("Company Name", help="Enter the company name")
|
| 219 |
-
currency = st.sidebar.radio("
|
| 220 |
bundle_by = st.sidebar.radio(options=["Single value", "Feature specific"], label="Bundle by", help = "Select the bundle", index=None)
|
| 221 |
|
| 222 |
if bundle_by == "Feature specific":
|
|
@@ -227,7 +216,21 @@ if bundle_by == "Feature specific":
|
|
| 227 |
|
| 228 |
|
| 229 |
# Section 2: Company Info
|
| 230 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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")
|
|
@@ -246,11 +249,11 @@ if bundle_by == "Feature specific":
|
|
| 246 |
"Catalog Cloud", "Fynd Commerce Platform", "Logistics", "Logistics", "PixelBin", "Boltic",
|
| 247 |
"CoPilot"]
|
| 248 |
fee_type_options = ["Development", "Subscription", "Maintenance", "Transaction", "Minimum Guarantee", "Logistics",
|
| 249 |
-
"Packaging", "SLA", "Licensing"]
|
| 250 |
fee_nature_options = ["Fixed %", "Flat currency", "Slab based", "As per rate card"]
|
| 251 |
-
variable_options = ["Bag", "Shipment", "Application", "Extension", "Integration", "Store", "User"]
|
| 252 |
chargeable_on_options = ["Developed", "Installed", "Placed", "Invoiced", "Delivered", "Return window", "All", "Picked",
|
| 253 |
-
"RTO", "DTO", "Packed"]
|
| 254 |
plan_validity_options = ["One time", "Monthly", "Quarterly", "Bi-Annually", "Annually"]
|
| 255 |
payment_method_options = ["Prepaid", "Postpaid"]
|
| 256 |
|
|
@@ -273,7 +276,7 @@ if bundle_by == "Feature specific":
|
|
| 273 |
"Catalog Cloud": ["Development", "Subscription", "Maintenance"],
|
| 274 |
"Uniket": ["Transaction", "Logistics", "Marketing", "Packaging", "SLA"],
|
| 275 |
"Fynd OMS": ["Development", "Subscription", "Maintenance", "Transaction", "Minimum Guarantee"],
|
| 276 |
-
"Fynd Commerce Platform": ["Subscription"],
|
| 277 |
"Logistics": ["Logistics"],
|
| 278 |
"PixelBin": ["Subscription"],
|
| 279 |
"Boltic": ["Subscription"],
|
|
@@ -293,21 +296,23 @@ if bundle_by == "Feature specific":
|
|
| 293 |
"SLA": ["Bag", "Shipment"],
|
| 294 |
"Logistics": ["Shipment"],
|
| 295 |
"Marketing": ["Bag"],
|
| 296 |
-
"Packaging": ["Shipment"]
|
|
|
|
| 297 |
}
|
| 298 |
}
|
| 299 |
|
| 300 |
char_config = {
|
| 301 |
'chargeable_on_mapping': {
|
| 302 |
-
"Application": ["Developed", "Installed"],
|
| 303 |
-
"Extension": ["Developed", "Installed", "Subscribed"],
|
| 304 |
-
"Integration": ["Developed", "Installed"],
|
| 305 |
"Store": ["Added", "Active"],
|
| 306 |
"User": ["Added", "Active"],
|
| 307 |
"Bag": ["Placed", "Invoiced", "Delivered", "Return window", "Cancel", "RTO", "DTO"],
|
| 308 |
"Shipment": ["Placed", "Invoiced", "Delivered", "Return window", "All", "Picked", "RTO", "DTO", "Packed",
|
| 309 |
"Cancel"],
|
| 310 |
"Platform": ["Subscribed"],
|
|
|
|
| 311 |
}
|
| 312 |
}
|
| 313 |
|
|
@@ -340,11 +345,6 @@ if bundle_by == "Feature specific":
|
|
| 340 |
if selected_fee_nature == "Slab based":
|
| 341 |
st.write("Enter values for Slab based fee structure:")
|
| 342 |
|
| 343 |
-
import streamlit as st
|
| 344 |
-
|
| 345 |
-
# Initialize an empty list to store data rows
|
| 346 |
-
global_data_rows = []
|
| 347 |
-
|
| 348 |
def add_data(slab, max_value, user_input, Usage, Capping_or_Minimum_Guarantee, threshold):
|
| 349 |
# Convert values to int if not None
|
| 350 |
max_value = int(max_value.strip()) if max_value else None
|
|
@@ -362,15 +362,18 @@ if bundle_by == "Feature specific":
|
|
| 362 |
"Threshold": threshold
|
| 363 |
}
|
| 364 |
|
| 365 |
-
|
| 366 |
-
global_data_rows.append(new_row)
|
| 367 |
|
| 368 |
-
|
| 369 |
-
|
| 370 |
|
| 371 |
def main():
|
| 372 |
st.title("Slab Data Management")
|
| 373 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 374 |
# Inputs for adding data
|
| 375 |
col1, col2 = st.columns([2, 2])
|
| 376 |
with col1:
|
|
@@ -402,27 +405,42 @@ if bundle_by == "Feature specific":
|
|
| 402 |
|
| 403 |
|
| 404 |
|
|
|
|
|
|
|
| 405 |
elif selected_fee_nature in ["Fixed %", "Flat currency"]:
|
| 406 |
-
|
|
|
|
|
|
|
| 407 |
|
| 408 |
# 6th layer: Expected Billing
|
| 409 |
fee_reversal_options = ["RTO", "DTO", "Cancel"]
|
| 410 |
fee_reversal = st.multiselect("**Fee Reversal**", fee_reversal_options) if selected_fee_type == "Transaction" and selected_variable_type == "Bag" else None
|
| 411 |
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
|
| 412 |
-
|
| 413 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 414 |
help="Enter the Capping/Minimum Gauarntee value")
|
| 415 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 416 |
|
| 417 |
abc = ['Capping value', 'Minimum Guarantee']
|
| 418 |
threshold = st.selectbox("**Threshold option:**", [""] + abc)
|
| 419 |
|
| 420 |
-
initial_expected_billing =
|
| 421 |
|
| 422 |
if threshold == 'Capping value':
|
| 423 |
-
expected_billing =
|
| 424 |
elif threshold == 'Minimum Guarantee':
|
| 425 |
-
expected_billing =
|
| 426 |
else:
|
| 427 |
expected_billing = initial_expected_billing # Default to initial Product value if no threshold selected
|
| 428 |
|
|
@@ -432,28 +450,55 @@ if bundle_by == "Feature specific":
|
|
| 432 |
selected_payment_method = st.selectbox("**Payment Method**", [""] + payment_method_options, help="Select the payment method", key="py_vd_2")
|
| 433 |
|
| 434 |
# Submit button
|
| 435 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 436 |
# Save user data
|
| 437 |
user_data = {
|
| 438 |
-
"
|
| 439 |
-
"Plan Description": plan_description,
|
| 440 |
-
"Plan Start Date": plan_start_date,
|
| 441 |
-
"Ordering Channels": ordering_channels,
|
| 442 |
"Company ID": company_id,
|
| 443 |
"Company Name": company_name,
|
| 444 |
-
"Currency
|
| 445 |
"Bundle by": bundle_by,
|
|
|
|
|
|
|
|
|
|
| 446 |
"Fulfilling Location": fulfilling_location,
|
| 447 |
"Application ID": application_id,
|
| 448 |
"Fee Type": selected_fee_type,
|
| 449 |
-
"Variable": selected_variable_type,
|
| 450 |
"Chargeable on": selected_chargeable_on,
|
| 451 |
"Fee Nature": selected_fee_nature,
|
| 452 |
-
"Commercial value":
|
| 453 |
-
"Fee reversal":
|
| 454 |
-
"Reversal %":
|
| 455 |
-
"Usage limit":
|
| 456 |
-
"
|
| 457 |
"Threshold option": threshold,
|
| 458 |
"Expected Billing": expected_billing,
|
| 459 |
"Plan Validity": selected_plan_validity,
|
|
@@ -478,7 +523,9 @@ if bundle_by == "Feature specific":
|
|
| 478 |
|
| 479 |
|
| 480 |
elif bundle_by == "Single value":
|
| 481 |
-
user_input_1 = st.sidebar.
|
|
|
|
|
|
|
| 482 |
|
| 483 |
plan_name = st.sidebar.text_input("Plan Name", help="Enter the name of the plan")
|
| 484 |
plan_description = st.sidebar.text_area("Plan Description", max_chars=250, help="Describe the plan")
|
|
@@ -486,10 +533,27 @@ elif bundle_by == "Single value":
|
|
| 486 |
|
| 487 |
|
| 488 |
# Section 2: Company Info
|
| 489 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 490 |
a1 = ["GoFynd", "Uniket", "B2B", "Marketplaces", "StoreOS", "Storefronts", "ONDC", "Fynd OMS", "Fynd TMS", "Fynd WMS",
|
| 491 |
"GMC", "Catalog Cloud", "Fynd Commerce Platform", "Logistics", "PixelBin", "Boltic", "CoPilot"]
|
| 492 |
ordering_channels = st.sidebar.selectbox("Product lines", [""] + a1, help="Select the ordering channels")
|
|
|
|
|
|
|
|
|
|
| 493 |
|
| 494 |
# Layer 1: Mapping of Ordering channels with Fulfilling location
|
| 495 |
if "Fynd TMS" in ordering_channels or "GMC" in ordering_channels or "Catalog Cloud" in ordering_channels:
|
|
@@ -505,11 +569,11 @@ elif bundle_by == "Single value":
|
|
| 505 |
"Catalog Cloud", "Fynd Commerce Platform", "Logistics", "Logistics", "PixelBin", "Boltic",
|
| 506 |
"CoPilot"]
|
| 507 |
fee_type_options = ["Development", "Subscription", "Maintenance", "Transaction", "Minimum Guarantee", "Logistics",
|
| 508 |
-
"Packaging", "SLA", "Licensing"]
|
| 509 |
fee_nature_options = ["Fixed %", "Flat currency", "Slab based", "As per rate card"]
|
| 510 |
-
variable_options = ["Bag", "Shipment", "Application", "Extension", "Integration", "Store", "User"]
|
| 511 |
chargeable_on_options = ["Developed", "Installed", "Placed", "Invoiced", "Delivered", "Return window", "All", "Picked",
|
| 512 |
-
"RTO", "DTO", "Packed"]
|
| 513 |
plan_validity_options = ["One time", "Monthly", "Quarterly", "Bi-Annually", "Annually"]
|
| 514 |
payment_method_options = ["Prepaid", "Postpaid"]
|
| 515 |
|
|
@@ -532,7 +596,7 @@ elif bundle_by == "Single value":
|
|
| 532 |
"Catalog Cloud": ["Development", "Subscription", "Maintenance"],
|
| 533 |
"Uniket": ["Transaction", "Logistics", "Marketing", "Packaging", "SLA"],
|
| 534 |
"Fynd OMS": ["Development", "Subscription", "Maintenance", "Transaction", "Minimum Guarantee"],
|
| 535 |
-
"Fynd Commerce Platform": ["Subscription"],
|
| 536 |
"Logistics": ["Logistics"],
|
| 537 |
"PixelBin": ["Subscription"],
|
| 538 |
"Boltic": ["Subscription"],
|
|
@@ -552,21 +616,23 @@ elif bundle_by == "Single value":
|
|
| 552 |
"SLA": ["Bag", "Shipment"],
|
| 553 |
"Logistics": ["Shipment"],
|
| 554 |
"Marketing": ["Bag"],
|
| 555 |
-
"Packaging": ["Shipment"]
|
|
|
|
| 556 |
}
|
| 557 |
}
|
| 558 |
|
| 559 |
char_config = {
|
| 560 |
'chargeable_on_mapping': {
|
| 561 |
-
"Application": ["Developed", "Installed"],
|
| 562 |
-
"Extension": ["Developed", "Installed", "Subscribed"],
|
| 563 |
-
"Integration": ["Developed", "Installed"],
|
| 564 |
"Store": ["Added", "Active"],
|
| 565 |
"User": ["Added", "Active"],
|
| 566 |
"Bag": ["Placed", "Invoiced", "Delivered", "Return window", "Cancel", "RTO", "DTO"],
|
| 567 |
"Shipment": ["Placed", "Invoiced", "Delivered", "Return window", "All", "Picked", "RTO", "DTO", "Packed",
|
| 568 |
"Cancel"],
|
| 569 |
"Platform": ["Subscribed"],
|
|
|
|
| 570 |
}
|
| 571 |
}
|
| 572 |
|
|
@@ -593,26 +659,43 @@ elif bundle_by == "Single value":
|
|
| 593 |
selected_chargeable_on = st.selectbox("**Chargeable on**", [""] + chargeable_on_mapping.get(selected_variable_type, []),
|
| 594 |
help="Select the type of Chargeable")
|
| 595 |
|
| 596 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 597 |
selected_plan_validity = st.selectbox("**Plan Validity**", [""] + plan_validity_options, help="Select the plan validity", key="plan_vd_2")
|
| 598 |
selected_payment_method = st.selectbox("**Payment Method**", [""] + payment_method_options, help="Select the payment method", key="py_vd_2")
|
| 599 |
|
|
|
|
| 600 |
# Submit button
|
| 601 |
if st.button("Submit"):
|
| 602 |
# Save user data
|
| 603 |
user_data = {
|
| 604 |
-
"
|
| 605 |
-
"Plan Description": plan_description,
|
| 606 |
-
"Plan Start Date": plan_start_date,
|
| 607 |
-
"Ordering Channels": ordering_channels,
|
| 608 |
"Company ID": company_id,
|
| 609 |
"Company Name": company_name,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 610 |
"Fulfilling Location": fulfilling_location,
|
| 611 |
"Application ID": application_id,
|
| 612 |
"Fee Type": selected_fee_type,
|
| 613 |
-
"Variable": selected_variable_type,
|
| 614 |
"Chargeable on": selected_chargeable_on,
|
| 615 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 616 |
"Plan Validity": selected_plan_validity,
|
| 617 |
"Payment Method": selected_payment_method,
|
| 618 |
}
|
|
|
|
| 8 |
import base64
|
| 9 |
|
| 10 |
global_user_data = [] # For appending user_data
|
| 11 |
+
global_data_rows = [] # For appending data rows
|
| 12 |
|
| 13 |
|
| 14 |
# Function to initialize session state
|
|
|
|
| 21 |
st.session_state.serial_counter = -1
|
| 22 |
|
| 23 |
|
| 24 |
+
# Initialize global_data_rows if not already initialized
|
| 25 |
+
if 'global_data_rows' not in st.session_state:
|
| 26 |
+
st.session_state.global_data_rows = []
|
| 27 |
+
|
| 28 |
+
|
| 29 |
# Function to save user data
|
| 30 |
def save_user_data(user_data):
|
| 31 |
st.session_state.data.append(user_data)
|
|
|
|
| 164 |
)
|
| 165 |
|
| 166 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 167 |
# Display the image in the sidebar
|
| 168 |
st.sidebar.image('Fynd_logo2.png', width=300)
|
| 169 |
|
| 170 |
+
|
| 171 |
+
html_content = """
|
| 172 |
+
<h1 style='
|
| 173 |
+
color: #a689f6;
|
| 174 |
+
font-size: 50px;
|
| 175 |
+
background-image: -webkit-linear-gradient(0deg, #a689f6 3%, #272191 33%, #413bb9 61%);
|
| 176 |
+
background-clip: text;
|
| 177 |
+
-webkit-background-clip: text;
|
| 178 |
+
text-fill-color: transparent;
|
| 179 |
+
-webkit-text-fill-color: transparent;
|
| 180 |
+
'>Plan maker</h1>
|
| 181 |
+
"""
|
| 182 |
+
|
| 183 |
+
st.markdown(html_content, unsafe_allow_html=True)
|
| 184 |
+
|
| 185 |
user_name = st.sidebar.text_input("Enter your name:")
|
| 186 |
+
|
| 187 |
+
|
| 188 |
+
html_content_1 = """
|
| 189 |
+
<h1 style='
|
| 190 |
+
color: #a689f6;
|
| 191 |
+
font-size: 28px;
|
| 192 |
+
background-image: -webkit-linear-gradient(0deg, #a689f6 3%, #272191 33%, #413bb9 61%);
|
| 193 |
+
background-clip: text;
|
| 194 |
+
-webkit-background-clip: text;
|
| 195 |
+
text-fill-color: transparent;
|
| 196 |
+
-webkit-text-fill-color: transparent;
|
| 197 |
+
'>Section 1: Plan Info</h1>
|
| 198 |
+
"""
|
| 199 |
+
|
| 200 |
+
st.sidebar.markdown(html_content_1, unsafe_allow_html=True)
|
| 201 |
+
|
| 202 |
+
|
| 203 |
+
|
| 204 |
v1 = ["Commerce India", "Reliance", "Commerce Global", "Government Projects", "Individual BH"]
|
| 205 |
business_head = st.sidebar.selectbox("Business Head", [""] + v1, help="Enter the name of Business head")
|
| 206 |
company_id = st.sidebar.text_input("Company ID", help="Enter the company ID")
|
| 207 |
company_name = st.sidebar.text_input("Company Name", help="Enter the company name")
|
| 208 |
+
currency = st.sidebar.radio("Currency", options= ["INR", "USD"], help= "Select the type of currency", index =None)
|
| 209 |
bundle_by = st.sidebar.radio(options=["Single value", "Feature specific"], label="Bundle by", help = "Select the bundle", index=None)
|
| 210 |
|
| 211 |
if bundle_by == "Feature specific":
|
|
|
|
| 216 |
|
| 217 |
|
| 218 |
# Section 2: Company Info
|
| 219 |
+
|
| 220 |
+
|
| 221 |
+
html_content_2 = """
|
| 222 |
+
<h1 style='
|
| 223 |
+
color: #a689f6;
|
| 224 |
+
font-size: 28px;
|
| 225 |
+
background-image: -webkit-linear-gradient(0deg, #a689f6 3%, #272191 33%, #413bb9 61%);
|
| 226 |
+
background-clip: text;
|
| 227 |
+
-webkit-background-clip: text;
|
| 228 |
+
text-fill-color: transparent;
|
| 229 |
+
-webkit-text-fill-color: transparent;
|
| 230 |
+
'>Section 2: Rule Info</h1>
|
| 231 |
+
"""
|
| 232 |
+
|
| 233 |
+
st.sidebar.markdown(html_content_2, unsafe_allow_html=True)
|
| 234 |
a1 = ["GoFynd", "Uniket", "B2B", "Marketplaces", "StoreOS", "Storefronts", "ONDC", "Fynd OMS", "Fynd TMS", "Fynd WMS",
|
| 235 |
"GMC", "Catalog Cloud", "Fynd Commerce Platform", "Logistics", "PixelBin", "Boltic", "CoPilot"]
|
| 236 |
ordering_channels = st.sidebar.selectbox("Product lines", [""] + a1, help="Select the ordering channels")
|
|
|
|
| 249 |
"Catalog Cloud", "Fynd Commerce Platform", "Logistics", "Logistics", "PixelBin", "Boltic",
|
| 250 |
"CoPilot"]
|
| 251 |
fee_type_options = ["Development", "Subscription", "Maintenance", "Transaction", "Minimum Guarantee", "Logistics",
|
| 252 |
+
"Packaging", "SLA", "Licensing", "Resource cost", "Development"]
|
| 253 |
fee_nature_options = ["Fixed %", "Flat currency", "Slab based", "As per rate card"]
|
| 254 |
+
variable_options = ["Bag", "Shipment", "Application", "Extension", "Integration", "Store", "User", "Resource"]
|
| 255 |
chargeable_on_options = ["Developed", "Installed", "Placed", "Invoiced", "Delivered", "Return window", "All", "Picked",
|
| 256 |
+
"RTO", "DTO", "Packed", "Hired", "Setup"]
|
| 257 |
plan_validity_options = ["One time", "Monthly", "Quarterly", "Bi-Annually", "Annually"]
|
| 258 |
payment_method_options = ["Prepaid", "Postpaid"]
|
| 259 |
|
|
|
|
| 276 |
"Catalog Cloud": ["Development", "Subscription", "Maintenance"],
|
| 277 |
"Uniket": ["Transaction", "Logistics", "Marketing", "Packaging", "SLA"],
|
| 278 |
"Fynd OMS": ["Development", "Subscription", "Maintenance", "Transaction", "Minimum Guarantee"],
|
| 279 |
+
"Fynd Commerce Platform": ["Subscription", "Transaction", "Resource cost"],
|
| 280 |
"Logistics": ["Logistics"],
|
| 281 |
"PixelBin": ["Subscription"],
|
| 282 |
"Boltic": ["Subscription"],
|
|
|
|
| 296 |
"SLA": ["Bag", "Shipment"],
|
| 297 |
"Logistics": ["Shipment"],
|
| 298 |
"Marketing": ["Bag"],
|
| 299 |
+
"Packaging": ["Shipment"],
|
| 300 |
+
"Resource cost":['Resource'],
|
| 301 |
}
|
| 302 |
}
|
| 303 |
|
| 304 |
char_config = {
|
| 305 |
'chargeable_on_mapping': {
|
| 306 |
+
"Application": ["Developed", "Installed", "Setup"],
|
| 307 |
+
"Extension": ["Developed", "Installed", "Subscribed", "Setup"],
|
| 308 |
+
"Integration": ["Developed", "Installed", "Setup"],
|
| 309 |
"Store": ["Added", "Active"],
|
| 310 |
"User": ["Added", "Active"],
|
| 311 |
"Bag": ["Placed", "Invoiced", "Delivered", "Return window", "Cancel", "RTO", "DTO"],
|
| 312 |
"Shipment": ["Placed", "Invoiced", "Delivered", "Return window", "All", "Picked", "RTO", "DTO", "Packed",
|
| 313 |
"Cancel"],
|
| 314 |
"Platform": ["Subscribed"],
|
| 315 |
+
'Resource':["Hired"],
|
| 316 |
}
|
| 317 |
}
|
| 318 |
|
|
|
|
| 345 |
if selected_fee_nature == "Slab based":
|
| 346 |
st.write("Enter values for Slab based fee structure:")
|
| 347 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 348 |
def add_data(slab, max_value, user_input, Usage, Capping_or_Minimum_Guarantee, threshold):
|
| 349 |
# Convert values to int if not None
|
| 350 |
max_value = int(max_value.strip()) if max_value else None
|
|
|
|
| 362 |
"Threshold": threshold
|
| 363 |
}
|
| 364 |
|
| 365 |
+
# Append new_row to global list of rows in session state
|
|
|
|
| 366 |
|
| 367 |
+
st.session_state.global_data_rows.append(new_row)
|
| 368 |
+
|
| 369 |
|
| 370 |
def main():
|
| 371 |
st.title("Slab Data Management")
|
| 372 |
|
| 373 |
+
# Initialize session state if not already initialized
|
| 374 |
+
if 'global_data_rows' not in st.session_state:
|
| 375 |
+
st.session_state.global_data_rows = []
|
| 376 |
+
|
| 377 |
# Inputs for adding data
|
| 378 |
col1, col2 = st.columns([2, 2])
|
| 379 |
with col1:
|
|
|
|
| 405 |
|
| 406 |
|
| 407 |
|
| 408 |
+
|
| 409 |
+
|
| 410 |
elif selected_fee_nature in ["Fixed %", "Flat currency"]:
|
| 411 |
+
user_input_1 = st.sidebar.number_input("Enter Commercial value:",min_value=0.0, help = "Enter the Commercial value")
|
| 412 |
+
user_input_2 = float(user_input_1)
|
| 413 |
+
user_input_3 = "{:.2f}".format(user_input_2)
|
| 414 |
|
| 415 |
# 6th layer: Expected Billing
|
| 416 |
fee_reversal_options = ["RTO", "DTO", "Cancel"]
|
| 417 |
fee_reversal = st.multiselect("**Fee Reversal**", fee_reversal_options) if selected_fee_type == "Transaction" and selected_variable_type == "Bag" else None
|
| 418 |
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
|
| 419 |
+
|
| 420 |
+
usage_1 = st.number_input(f"**Usage limit for {selected_variable_type}**", min_value=0.0, help="Enter the usage limit")
|
| 421 |
+
usage_2 = float(usage_1)
|
| 422 |
+
usage_3 = "{:.2f}".format(usage_2)
|
| 423 |
+
|
| 424 |
+
Capping_or_Minimum_Guarantee_1 = st.number_input(f"**Threshold value for {selected_variable_type}**", min_value=0.0,
|
| 425 |
help="Enter the Capping/Minimum Gauarntee value")
|
| 426 |
+
Capping_or_Minimum_Guarantee_2 = float(Capping_or_Minimum_Guarantee_1)
|
| 427 |
+
Capping_or_Minimum_Guarantee_3 = "{:.2f}".format(Capping_or_Minimum_Guarantee_2)
|
| 428 |
+
|
| 429 |
+
|
| 430 |
+
Product_1 = usage_1 * user_input_1 if selected_fee_nature in ["Fixed %", "Flat currency"] else 0
|
| 431 |
+
Product_2 = float(Product_1)
|
| 432 |
+
Product_3 = "{:.2f}".format(Product_2)
|
| 433 |
+
|
| 434 |
|
| 435 |
abc = ['Capping value', 'Minimum Guarantee']
|
| 436 |
threshold = st.selectbox("**Threshold option:**", [""] + abc)
|
| 437 |
|
| 438 |
+
initial_expected_billing = Product_3
|
| 439 |
|
| 440 |
if threshold == 'Capping value':
|
| 441 |
+
expected_billing = Product_3 if Capping_or_Minimum_Guarantee_3 > Product_3 else Capping_or_Minimum_Guarantee_3
|
| 442 |
elif threshold == 'Minimum Guarantee':
|
| 443 |
+
expected_billing = Product_3 if Capping_or_Minimum_Guarantee_3 < Product_3 else Capping_or_Minimum_Guarantee_3
|
| 444 |
else:
|
| 445 |
expected_billing = initial_expected_billing # Default to initial Product value if no threshold selected
|
| 446 |
|
|
|
|
| 450 |
selected_payment_method = st.selectbox("**Payment Method**", [""] + payment_method_options, help="Select the payment method", key="py_vd_2")
|
| 451 |
|
| 452 |
# Submit button
|
| 453 |
+
# Define CSS styles for the button
|
| 454 |
+
button_styles = """
|
| 455 |
+
<style>
|
| 456 |
+
div.stButton > button {
|
| 457 |
+
color: #ffffff; /* Text color */
|
| 458 |
+
font-size: 50px;
|
| 459 |
+
background-image: linear-gradient(0deg, #a689f6 3%, #52c5cf 10%, #413bb9 61%);
|
| 460 |
+
border: none;
|
| 461 |
+
padding: 10px 20px;
|
| 462 |
+
cursor: pointer;
|
| 463 |
+
border-radius: 15px;
|
| 464 |
+
display: inline-block;
|
| 465 |
+
}
|
| 466 |
+
|
| 467 |
+
div.stButton > button:hover {
|
| 468 |
+
background-color: #00ff00; /* Hover background color */
|
| 469 |
+
color: #ff0000; /* Hover text color */
|
| 470 |
+
}
|
| 471 |
+
</style>
|
| 472 |
+
"""
|
| 473 |
+
|
| 474 |
+
# Render the button with the specified styles
|
| 475 |
+
st.markdown(button_styles, unsafe_allow_html=True)
|
| 476 |
+
|
| 477 |
+
|
| 478 |
+
|
| 479 |
+
|
| 480 |
+
if st.button("Submit", key ='submit_button'):
|
| 481 |
# Save user data
|
| 482 |
user_data = {
|
| 483 |
+
"Business Head": business_head,
|
|
|
|
|
|
|
|
|
|
| 484 |
"Company ID": company_id,
|
| 485 |
"Company Name": company_name,
|
| 486 |
+
"Currency": currency,
|
| 487 |
"Bundle by": bundle_by,
|
| 488 |
+
"Plan Name": plan_name,
|
| 489 |
+
"Plan Description": plan_description,
|
| 490 |
+
"Product lines": ordering_channels,
|
| 491 |
"Fulfilling Location": fulfilling_location,
|
| 492 |
"Application ID": application_id,
|
| 493 |
"Fee Type": selected_fee_type,
|
| 494 |
+
"Variable Type": selected_variable_type,
|
| 495 |
"Chargeable on": selected_chargeable_on,
|
| 496 |
"Fee Nature": selected_fee_nature,
|
| 497 |
+
"Commercial value": user_input_3,
|
| 498 |
+
"Fee reversal": 0,
|
| 499 |
+
"Reversal %": 0,
|
| 500 |
+
"Usage limit": usage_3,
|
| 501 |
+
"Threshold value": Capping_or_Minimum_Guarantee_3,
|
| 502 |
"Threshold option": threshold,
|
| 503 |
"Expected Billing": expected_billing,
|
| 504 |
"Plan Validity": selected_plan_validity,
|
|
|
|
| 523 |
|
| 524 |
|
| 525 |
elif bundle_by == "Single value":
|
| 526 |
+
user_input_1 = st.sidebar.number_input("Enter Commercial value:")
|
| 527 |
+
user_input_2 = float(user_input_1)
|
| 528 |
+
user_input_3 = "{:.2f}".format(user_input_2)
|
| 529 |
|
| 530 |
plan_name = st.sidebar.text_input("Plan Name", help="Enter the name of the plan")
|
| 531 |
plan_description = st.sidebar.text_area("Plan Description", max_chars=250, help="Describe the plan")
|
|
|
|
| 533 |
|
| 534 |
|
| 535 |
# Section 2: Company Info
|
| 536 |
+
|
| 537 |
+
html_content_3 = """
|
| 538 |
+
<h1 style='
|
| 539 |
+
color: #a689f6;
|
| 540 |
+
font-size: 28px;
|
| 541 |
+
background-image: -webkit-linear-gradient(0deg, #a689f6 3%, #272191 33%, #413bb9 61%);
|
| 542 |
+
background-clip: text;
|
| 543 |
+
-webkit-background-clip: text;
|
| 544 |
+
text-fill-color: transparent;
|
| 545 |
+
-webkit-text-fill-color: transparent;
|
| 546 |
+
'>Section 2: Rule Info</h1>
|
| 547 |
+
"""
|
| 548 |
+
|
| 549 |
+
st.sidebar.markdown(html_content_3, unsafe_allow_html=True)
|
| 550 |
+
|
| 551 |
a1 = ["GoFynd", "Uniket", "B2B", "Marketplaces", "StoreOS", "Storefronts", "ONDC", "Fynd OMS", "Fynd TMS", "Fynd WMS",
|
| 552 |
"GMC", "Catalog Cloud", "Fynd Commerce Platform", "Logistics", "PixelBin", "Boltic", "CoPilot"]
|
| 553 |
ordering_channels = st.sidebar.selectbox("Product lines", [""] + a1, help="Select the ordering channels")
|
| 554 |
+
a1 = ["GoFynd", "Uniket", "B2B", "Marketplaces", "StoreOS", "Storefronts", "ONDC", "Fynd OMS", "Fynd TMS", "Fynd WMS",
|
| 555 |
+
"GMC", "Catalog Cloud", "Fynd Commerce Platform", "Logistics", "PixelBin", "Boltic", "CoPilot"]
|
| 556 |
+
ordering_channels = st.sidebar.selectbox("Product lines", [""] + a1, help="Select the ordering channels", key = "ordering_channels")
|
| 557 |
|
| 558 |
# Layer 1: Mapping of Ordering channels with Fulfilling location
|
| 559 |
if "Fynd TMS" in ordering_channels or "GMC" in ordering_channels or "Catalog Cloud" in ordering_channels:
|
|
|
|
| 569 |
"Catalog Cloud", "Fynd Commerce Platform", "Logistics", "Logistics", "PixelBin", "Boltic",
|
| 570 |
"CoPilot"]
|
| 571 |
fee_type_options = ["Development", "Subscription", "Maintenance", "Transaction", "Minimum Guarantee", "Logistics",
|
| 572 |
+
"Packaging", "SLA", "Licensing","Resource cost", "Development"]
|
| 573 |
fee_nature_options = ["Fixed %", "Flat currency", "Slab based", "As per rate card"]
|
| 574 |
+
variable_options = ["Bag", "Shipment", "Application", "Extension", "Integration", "Store", "User", "Resource"]
|
| 575 |
chargeable_on_options = ["Developed", "Installed", "Placed", "Invoiced", "Delivered", "Return window", "All", "Picked",
|
| 576 |
+
"RTO", "DTO", "Packed","Hired", "Setup"]
|
| 577 |
plan_validity_options = ["One time", "Monthly", "Quarterly", "Bi-Annually", "Annually"]
|
| 578 |
payment_method_options = ["Prepaid", "Postpaid"]
|
| 579 |
|
|
|
|
| 596 |
"Catalog Cloud": ["Development", "Subscription", "Maintenance"],
|
| 597 |
"Uniket": ["Transaction", "Logistics", "Marketing", "Packaging", "SLA"],
|
| 598 |
"Fynd OMS": ["Development", "Subscription", "Maintenance", "Transaction", "Minimum Guarantee"],
|
| 599 |
+
"Fynd Commerce Platform": ["Subscription", "Transaction", "Resource cost"],
|
| 600 |
"Logistics": ["Logistics"],
|
| 601 |
"PixelBin": ["Subscription"],
|
| 602 |
"Boltic": ["Subscription"],
|
|
|
|
| 616 |
"SLA": ["Bag", "Shipment"],
|
| 617 |
"Logistics": ["Shipment"],
|
| 618 |
"Marketing": ["Bag"],
|
| 619 |
+
"Packaging": ["Shipment"],
|
| 620 |
+
"Resource cost":['Resource'],
|
| 621 |
}
|
| 622 |
}
|
| 623 |
|
| 624 |
char_config = {
|
| 625 |
'chargeable_on_mapping': {
|
| 626 |
+
"Application": ["Developed", "Installed", "Setup"],
|
| 627 |
+
"Extension": ["Developed", "Installed", "Subscribed", "Setup"],
|
| 628 |
+
"Integration": ["Developed", "Installed", "Setup"],
|
| 629 |
"Store": ["Added", "Active"],
|
| 630 |
"User": ["Added", "Active"],
|
| 631 |
"Bag": ["Placed", "Invoiced", "Delivered", "Return window", "Cancel", "RTO", "DTO"],
|
| 632 |
"Shipment": ["Placed", "Invoiced", "Delivered", "Return window", "All", "Picked", "RTO", "DTO", "Packed",
|
| 633 |
"Cancel"],
|
| 634 |
"Platform": ["Subscribed"],
|
| 635 |
+
'Resource':["Hired"],
|
| 636 |
}
|
| 637 |
}
|
| 638 |
|
|
|
|
| 659 |
selected_chargeable_on = st.selectbox("**Chargeable on**", [""] + chargeable_on_mapping.get(selected_variable_type, []),
|
| 660 |
help="Select the type of Chargeable")
|
| 661 |
|
| 662 |
+
usage_1 = st.number_input(f"**Usage limit for {selected_variable_type}**", min_value=0.0, help="Enter the usage limit")
|
| 663 |
+
usage_2 = float(usage_1)
|
| 664 |
+
usage_3 = "{:.2f}".format(usage_2)
|
| 665 |
+
|
| 666 |
+
expected_billing = user_input_3
|
| 667 |
+
|
| 668 |
+
st.write(f"**Expected Billing (excluding GST): {expected_billing}**")
|
| 669 |
+
|
| 670 |
selected_plan_validity = st.selectbox("**Plan Validity**", [""] + plan_validity_options, help="Select the plan validity", key="plan_vd_2")
|
| 671 |
selected_payment_method = st.selectbox("**Payment Method**", [""] + payment_method_options, help="Select the payment method", key="py_vd_2")
|
| 672 |
|
| 673 |
+
|
| 674 |
# Submit button
|
| 675 |
if st.button("Submit"):
|
| 676 |
# Save user data
|
| 677 |
user_data = {
|
| 678 |
+
"Business Head": business_head,
|
|
|
|
|
|
|
|
|
|
| 679 |
"Company ID": company_id,
|
| 680 |
"Company Name": company_name,
|
| 681 |
+
"Currency": currency,
|
| 682 |
+
"Bundle by": bundle_by,
|
| 683 |
+
"Plan Name": plan_name,
|
| 684 |
+
"Plan Description": plan_description,
|
| 685 |
+
"Product lines": ordering_channels,
|
| 686 |
"Fulfilling Location": fulfilling_location,
|
| 687 |
"Application ID": application_id,
|
| 688 |
"Fee Type": selected_fee_type,
|
| 689 |
+
"Variable Type": selected_variable_type,
|
| 690 |
"Chargeable on": selected_chargeable_on,
|
| 691 |
+
"Fee Nature": "Flat currency",
|
| 692 |
+
"Commercial value": user_input_3,
|
| 693 |
+
"Fee reversal": 0,
|
| 694 |
+
"Reversal %": 0,
|
| 695 |
+
"Usage limit": usage_3,
|
| 696 |
+
"Threshold value": 0,
|
| 697 |
+
"Threshold option": 0,
|
| 698 |
+
"Expected Billing": user_input_3,
|
| 699 |
"Plan Validity": selected_plan_validity,
|
| 700 |
"Payment Method": selected_payment_method,
|
| 701 |
}
|