Spaces:
Sleeping
Sleeping
Update app.py
#12
by
Klnimri - opened
app.py
CHANGED
|
@@ -2,22 +2,15 @@ import streamlit as st
|
|
| 2 |
import pandas as pd
|
| 3 |
import time
|
| 4 |
import requests
|
|
|
|
| 5 |
|
| 6 |
# Set page configuration (must be the first Streamlit command)
|
| 7 |
st.set_page_config(page_title="Ticket System", layout="centered", initial_sidebar_state="expanded")
|
| 8 |
|
| 9 |
-
def center_logo(image_path, width=200):
|
| 10 |
-
# Use columns to center the logo
|
| 11 |
-
col1, col2, col3 = st.columns([1, 2, 1]) # Adjust the ratios to center the logo
|
| 12 |
-
with col2: # Place the logo in the middle column
|
| 13 |
-
st.image(image_path, width=width, use_container_width=False) # Adjust width as needed
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
# Apply custom CSS for design
|
| 18 |
st.markdown(
|
| 19 |
"""
|
| 20 |
-
|
| 21 |
/* Hide the header */
|
| 22 |
header[data-testid="stHeader"] {
|
| 23 |
display: none;
|
|
@@ -27,22 +20,25 @@ st.markdown(
|
|
| 27 |
.stApp {
|
| 28 |
margin-top: -50px;
|
| 29 |
}
|
| 30 |
-
|
| 31 |
.stApp { background-color: #E4ECE3; }
|
| 32 |
section[data-testid="stSidebar"] { background-color: #084C3C; }
|
| 33 |
section[data-testid="stSidebar"] p, section[data-testid="stSidebar"] label { color: white; }
|
| 34 |
input, textarea, select, .stFileUploader { background-color: white !important; border: 2px solid #084C3C !important; color: #084C3C !important; border-radius: 5px !important; }
|
| 35 |
input:focus, textarea:focus, select:focus, .stFileUploader:focus { border: 2px solid #7FDB8B !important; outline: none !important; }
|
| 36 |
div[data-testid="stFormSubmitButton"] button, div.stButton > button {
|
| 37 |
-
background-color: #
|
| 38 |
color: white !important; /* White text */
|
| 39 |
border-radius: 10px !important; /* Rounded corners */
|
| 40 |
padding: 10px 20px !important; /* Button padding */
|
| 41 |
-
border:
|
|
|
|
|
|
|
| 42 |
}
|
| 43 |
div[data-testid="stFormSubmitButton"] button:hover, div.stButton > button:hover {
|
| 44 |
-
background-color: #
|
| 45 |
-
color:
|
|
|
|
| 46 |
}
|
| 47 |
table { border-collapse: collapse; width: 100%; background-color: #E4ECE3; }
|
| 48 |
th, td { border: 1px solid #084C3C; text-align: left; padding: 10px; color: #084C3C; }
|
|
@@ -59,19 +55,21 @@ st.markdown(
|
|
| 59 |
color: #084C3C !important;
|
| 60 |
}
|
| 61 |
|
| 62 |
-
/*
|
| 63 |
-
|
| 64 |
-
background-color: #
|
| 65 |
color: white !important; /* White text */
|
| 66 |
-
border:
|
| 67 |
-
border-radius:
|
| 68 |
padding: 10px 20px !important; /* Button padding */
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
}
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
background-color: #066B4E !important; /* Slightly lighter green on hover/focus */
|
| 74 |
-
color: white !important; /* Keep white text on hover/focus */
|
| 75 |
}
|
| 76 |
</style>
|
| 77 |
""",
|
|
@@ -85,51 +83,109 @@ users = {
|
|
| 85 |
"customer789": {"password": "customerpass", "role": "Customer"},
|
| 86 |
}
|
| 87 |
|
| 88 |
-
# Function to load a Lottie animation from a URL
|
| 89 |
-
def load_lottie_url(url: str):
|
| 90 |
-
r = requests.get(url)
|
| 91 |
-
if r.status_code != 200:
|
| 92 |
-
return None
|
| 93 |
-
return r.json()
|
| 94 |
-
|
| 95 |
-
# URL for your animation (optional)
|
| 96 |
-
lottie_url = "https://assets6.lottiefiles.com/packages/lf20_5hhtik.json"
|
| 97 |
-
lottie_json = load_lottie_url(lottie_url)
|
| 98 |
-
|
| 99 |
-
def show_loading_animation():
|
| 100 |
-
if lottie_json:
|
| 101 |
-
st_lottie(lottie_json, height=300, key="loading")
|
| 102 |
-
|
| 103 |
def login_page():
|
| 104 |
-
|
| 105 |
# Add custom styling and an image at the top
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 109 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 110 |
# Check login state
|
| 111 |
if "login_success" not in st.session_state:
|
| 112 |
st.session_state["login_success"] = False
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 113 |
|
| 114 |
-
|
| 115 |
-
if
|
| 116 |
-
username
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
time.sleep(1)
|
| 125 |
-
else:
|
| 126 |
-
st.error("Invalid username or password.")
|
| 127 |
|
| 128 |
def add_return_to_login():
|
| 129 |
if "logged_in" in st.session_state and st.session_state["logged_in"]:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 130 |
if st.sidebar.button("Back"):
|
| 131 |
-
|
| 132 |
-
st.
|
|
|
|
| 133 |
|
| 134 |
def main():
|
| 135 |
if "logged_in" not in st.session_state or not st.session_state["logged_in"]:
|
|
@@ -137,7 +193,10 @@ def main():
|
|
| 137 |
return
|
| 138 |
|
| 139 |
add_return_to_login()
|
|
|
|
|
|
|
| 140 |
|
|
|
|
| 141 |
user_type = st.session_state.get("user_type", "Customer")
|
| 142 |
st.sidebar.title("Navigation")
|
| 143 |
|
|
@@ -151,9 +210,6 @@ def main():
|
|
| 151 |
st.sidebar.write("No pages available for this user type.")
|
| 152 |
return
|
| 153 |
|
| 154 |
-
with st.spinner("Loading..."):
|
| 155 |
-
show_loading_animation()
|
| 156 |
-
time.sleep(0.5)
|
| 157 |
|
| 158 |
if page == "Submit Ticket":
|
| 159 |
submit_ticket_page()
|
|
@@ -173,11 +229,12 @@ def main():
|
|
| 173 |
employee_ticket_status_page()
|
| 174 |
|
| 175 |
def submit_ticket_page():
|
|
|
|
| 176 |
st.image("logo.png", width=200)
|
| 177 |
-
#center_logo("logo.png") # Center the logo
|
| 178 |
st.markdown('<h1 style="color: #084C3C;">Submit a Ticket</h1>', unsafe_allow_html=True)
|
| 179 |
st.markdown('<p style="color: #084C3C;">Please fill out the form below to submit a ticket.</p>', unsafe_allow_html=True)
|
| 180 |
|
|
|
|
| 181 |
with st.form(key="submit_ticket_form"):
|
| 182 |
customer_id = st.text_input("Customer ID")
|
| 183 |
st.text_input("First Name")
|
|
@@ -188,19 +245,91 @@ def submit_ticket_page():
|
|
| 188 |
st.selectbox("Ticket Type", ["General", "Billing", "Technical"])
|
| 189 |
st.text_area("Describe your issue/request")
|
| 190 |
st.file_uploader("Upload Attachments (if any)", accept_multiple_files=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 191 |
if st.form_submit_button("Submit"):
|
| 192 |
-
|
|
|
|
|
|
|
|
|
|
| 193 |
|
| 194 |
def check_ticket_status_page():
|
|
|
|
| 195 |
st.image("logo.png", width=200)
|
| 196 |
-
#center_logo("logo.png") # Center the logo
|
| 197 |
st.markdown('<h1 style="color: #084C3C;">Check Ticket Status</h1>', unsafe_allow_html=True)
|
| 198 |
st.markdown('<p style="color: #084C3C;">Enter your Customer ID to view your tickets.</p>', unsafe_allow_html=True)
|
| 199 |
|
|
|
|
| 200 |
customer_id = st.text_input("Customer ID")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 201 |
if st.button("Check Status"):
|
| 202 |
-
if customer_id:
|
|
|
|
| 203 |
st.success(f"Displaying tickets for Customer ID: {customer_id}")
|
|
|
|
| 204 |
ticket_data = {
|
| 205 |
"Ticket Number": ["141", "565", "999"],
|
| 206 |
"Date": ["2025-01-18", "2025-03-28", "2025-04-01"],
|
|
@@ -210,11 +339,10 @@ def check_ticket_status_page():
|
|
| 210 |
df = pd.DataFrame(ticket_data)
|
| 211 |
st.dataframe(df)
|
| 212 |
else:
|
| 213 |
-
st.
|
| 214 |
|
| 215 |
def faq_info_page():
|
| 216 |
st.image("logo.png", width=200)
|
| 217 |
-
#center_logo("logo.png") # Center the logo
|
| 218 |
st.markdown('<h1 style="color: #084C3C;">FAQ & Information</h1>', unsafe_allow_html=True)
|
| 219 |
|
| 220 |
faq_data = [
|
|
@@ -229,9 +357,11 @@ def faq_info_page():
|
|
| 229 |
st.markdown(f'<p style="color: #084C3C;">{answer}</p>', unsafe_allow_html=True)
|
| 230 |
|
| 231 |
def respond_to_ticket_page():
|
|
|
|
| 232 |
st.image("logo.png", width=200)
|
| 233 |
-
#center_logo("logo.png") # Center the logo
|
| 234 |
st.markdown('<h1 style="color: #084C3C;">Respond to a Ticket</h1>', unsafe_allow_html=True)
|
|
|
|
|
|
|
| 235 |
ticket_data = {
|
| 236 |
"Ticket Number": ["141", "565", "999"],
|
| 237 |
"Customer ID": ["C001", "C002", "C003"],
|
|
@@ -242,38 +372,123 @@ def respond_to_ticket_page():
|
|
| 242 |
}
|
| 243 |
df = pd.DataFrame(ticket_data)
|
| 244 |
st.dataframe(df)
|
|
|
|
|
|
|
| 245 |
ticket_to_respond = st.selectbox("Select a ticket to respond to:", df["Ticket Number"].tolist())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 246 |
if st.button("Respond to Ticket"):
|
| 247 |
-
|
| 248 |
-
|
|
|
|
|
|
|
|
|
|
| 249 |
|
| 250 |
def employee_ticket_status_page():
|
|
|
|
| 251 |
st.image("logo.png", width=200)
|
| 252 |
-
#center_logo("logo.png") # Center the logo
|
| 253 |
st.markdown('<h1 style="color: #084C3C;">Ticket Status</h1>', unsafe_allow_html=True)
|
|
|
|
|
|
|
| 254 |
customer_id = st.text_input("Customer ID")
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 259 |
}
|
| 260 |
-
|
| 261 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 262 |
|
| 263 |
def ticket_dashboard_page():
|
| 264 |
st.image("logo.png", width=200)
|
| 265 |
-
#center_logo("logo.png") # Center the logo
|
| 266 |
st.markdown('<h1 style="color: #084C3C;">Ticket Dashboard</h1>', unsafe_allow_html=True)
|
| 267 |
st.components.v1.iframe(
|
| 268 |
"https://app.powerbi.com/view?r=eyJrIjoiMDEwNzA2YjUtNGY0MC00NTFjLTg1ZTctYTZlZjQzOTUwNWUxIiwidCI6ImI0NTNkOTFiLTZhYzEtNGI2MS1iOGI4LTVlNjVlNDIyMjMzZiIsImMiOjl9",
|
| 269 |
-
height=
|
| 270 |
width=1000,
|
| 271 |
scrolling=True
|
| 272 |
)
|
| 273 |
|
|
|
|
| 274 |
def customer_dashboard_page():
|
| 275 |
st.image("logo.png", width=200)
|
| 276 |
-
#center_logo("logo.png") # Center the logo
|
| 277 |
st.markdown('<h1 style="color: #084C3C;">Customer Dashboard</h1>', unsafe_allow_html=True)
|
| 278 |
customer_data = {
|
| 279 |
"Customer ID": ["C001", "C002", "C003"],
|
|
@@ -284,8 +499,8 @@ def customer_dashboard_page():
|
|
| 284 |
st.dataframe(df)
|
| 285 |
st.components.v1.iframe(
|
| 286 |
"https://app.powerbi.com/view?r=eyJrIjoiY2Q0ODE1NGItOThjMy00MzM4LWE2OGUtMjRkNmUzYmZlMDk3IiwidCI6ImI0NTNkOTFiLTZhYzEtNGI2MS1iOGI4LTVlNjVlNDIyMjMzZiIsImMiOjl9",
|
| 287 |
-
height=
|
| 288 |
-
width=
|
| 289 |
scrolling=True
|
| 290 |
)
|
| 291 |
|
|
@@ -313,6 +528,8 @@ def management_dashboard_page():
|
|
| 313 |
scrolling=True
|
| 314 |
)
|
| 315 |
|
|
|
|
|
|
|
| 316 |
def customize_navigation_menu_dark_green():
|
| 317 |
st.markdown(
|
| 318 |
"""
|
|
@@ -334,24 +551,36 @@ def customize_navigation_menu_dark_green():
|
|
| 334 |
unsafe_allow_html=True
|
| 335 |
)
|
| 336 |
|
| 337 |
-
|
| 338 |
-
|
| 339 |
-
|
| 340 |
-
|
| 341 |
-
|
| 342 |
-
|
| 343 |
-
|
| 344 |
-
|
| 345 |
-
|
| 346 |
-
|
| 347 |
-
|
| 348 |
-
|
| 349 |
-
|
| 350 |
-
|
| 351 |
-
|
| 352 |
-
|
| 353 |
-
|
| 354 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 355 |
|
| 356 |
def customize_submit_button():
|
| 357 |
st.markdown(
|
|
@@ -376,20 +605,9 @@ def customize_submit_button():
|
|
| 376 |
unsafe_allow_html=True
|
| 377 |
)
|
| 378 |
|
| 379 |
-
|
| 380 |
-
|
| 381 |
-
"""
|
| 382 |
-
<style>
|
| 383 |
-
/* Styling buttons to ensure white text */
|
| 384 |
-
div[data-testid="stFormSubmitButton"] button, div.stButton > button {
|
| 385 |
-
color: white !important; /* Ensure button text is white */
|
| 386 |
-
}
|
| 387 |
-
</style>
|
| 388 |
-
""",
|
| 389 |
-
unsafe_allow_html=True
|
| 390 |
-
)
|
| 391 |
|
| 392 |
if __name__ == "__main__":
|
| 393 |
customize_navigation_menu_dark_green()
|
| 394 |
-
customize_button_text_color()
|
| 395 |
main()
|
|
|
|
| 2 |
import pandas as pd
|
| 3 |
import time
|
| 4 |
import requests
|
| 5 |
+
import os
|
| 6 |
|
| 7 |
# Set page configuration (must be the first Streamlit command)
|
| 8 |
st.set_page_config(page_title="Ticket System", layout="centered", initial_sidebar_state="expanded")
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
# Apply custom CSS for design
|
| 11 |
st.markdown(
|
| 12 |
"""
|
| 13 |
+
<style>
|
| 14 |
/* Hide the header */
|
| 15 |
header[data-testid="stHeader"] {
|
| 16 |
display: none;
|
|
|
|
| 20 |
.stApp {
|
| 21 |
margin-top: -50px;
|
| 22 |
}
|
| 23 |
+
<style>
|
| 24 |
.stApp { background-color: #E4ECE3; }
|
| 25 |
section[data-testid="stSidebar"] { background-color: #084C3C; }
|
| 26 |
section[data-testid="stSidebar"] p, section[data-testid="stSidebar"] label { color: white; }
|
| 27 |
input, textarea, select, .stFileUploader { background-color: white !important; border: 2px solid #084C3C !important; color: #084C3C !important; border-radius: 5px !important; }
|
| 28 |
input:focus, textarea:focus, select:focus, .stFileUploader:focus { border: 2px solid #7FDB8B !important; outline: none !important; }
|
| 29 |
div[data-testid="stFormSubmitButton"] button, div.stButton > button {
|
| 30 |
+
background-color: #7FDB8B !important; /* Light green background */
|
| 31 |
color: white !important; /* White text */
|
| 32 |
border-radius: 10px !important; /* Rounded corners */
|
| 33 |
padding: 10px 20px !important; /* Button padding */
|
| 34 |
+
border: 2px solid #084C3C !important; /* Dark green border for consistency */
|
| 35 |
+
font-size: 16px !important; /* Ensure text size is visible */
|
| 36 |
+
box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.2); /* Subtle shadow */
|
| 37 |
}
|
| 38 |
div[data-testid="stFormSubmitButton"] button:hover, div.stButton > button:hover {
|
| 39 |
+
background-color: #084C3C !important; /* Dark green background on hover */
|
| 40 |
+
color: white !important; /* Keep white text on hover */
|
| 41 |
+
border-color: #7FDB8B !important; /* Lighter green border on hover */
|
| 42 |
}
|
| 43 |
table { border-collapse: collapse; width: 100%; background-color: #E4ECE3; }
|
| 44 |
th, td { border: 1px solid #084C3C; text-align: left; padding: 10px; color: #084C3C; }
|
|
|
|
| 55 |
color: #084C3C !important;
|
| 56 |
}
|
| 57 |
|
| 58 |
+
/* Custom login button */
|
| 59 |
+
.custom-login-button {
|
| 60 |
+
background-color: #7FDB8B !important; /* Light green background */
|
| 61 |
color: white !important; /* White text */
|
| 62 |
+
border: 2px solid #084C3C !important; /* Dark green border */
|
| 63 |
+
border-radius: 10px !important; /* Rounded corners */
|
| 64 |
padding: 10px 20px !important; /* Button padding */
|
| 65 |
+
font-size: 16px !important; /* Ensure text size is visible */
|
| 66 |
+
text-align: center; /* Center-align text */
|
| 67 |
+
box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.2); /* Subtle shadow */
|
| 68 |
+
cursor: pointer; /* Pointer cursor for hover */
|
| 69 |
}
|
| 70 |
+
.custom-login-button:hover {
|
| 71 |
+
background-color: #084C3C !important; /* Dark green background on hover */
|
| 72 |
+
color: white !important; /* Keep white text on hover */
|
|
|
|
|
|
|
| 73 |
}
|
| 74 |
</style>
|
| 75 |
""",
|
|
|
|
| 83 |
"customer789": {"password": "customerpass", "role": "Customer"},
|
| 84 |
}
|
| 85 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
def login_page():
|
|
|
|
| 87 |
# Add custom styling and an image at the top
|
| 88 |
+
customize_login_page()
|
| 89 |
+
st.markdown(
|
| 90 |
+
"""
|
| 91 |
+
<style>
|
| 92 |
+
.center-title {
|
| 93 |
+
display: flex;
|
| 94 |
+
justify-content: center;
|
| 95 |
+
align-items: center;
|
| 96 |
+
height: 50px; /* Optional: Adjust height */
|
| 97 |
+
font-size: 36px; /* Optional: Adjust font size */
|
| 98 |
+
font-weight: bold; /* Optional: Adjust font weight */
|
| 99 |
+
color: #084C3C; /* Optional: Set text color */
|
| 100 |
+
}
|
| 101 |
+
</style>
|
| 102 |
+
<div class="center-title">Login Page</div>
|
| 103 |
+
""",
|
| 104 |
+
unsafe_allow_html=True
|
| 105 |
+
)
|
| 106 |
|
| 107 |
+
|
| 108 |
+
username = st.text_input("Username")
|
| 109 |
+
password = st.text_input("Password", type="password")
|
| 110 |
+
|
| 111 |
# Check login state
|
| 112 |
if "login_success" not in st.session_state:
|
| 113 |
st.session_state["login_success"] = False
|
| 114 |
+
st.markdown(
|
| 115 |
+
"""
|
| 116 |
+
<style>
|
| 117 |
+
div.stButton > button {
|
| 118 |
+
background-color: #4CAF50 !important;
|
| 119 |
+
color: white !important;
|
| 120 |
+
border: none;
|
| 121 |
+
padding: 10px 20px !important;
|
| 122 |
+
text-align: center !important;
|
| 123 |
+
text-decoration: none;
|
| 124 |
+
font-size: 16px !important;
|
| 125 |
+
font-weight: bold !important;
|
| 126 |
+
cursor: pointer;
|
| 127 |
+
border-radius: 4px !important;
|
| 128 |
+
transition: background-color 0.3s ease;
|
| 129 |
+
display: inline-block;
|
| 130 |
+
margin-top: 20px; /* Space above the button */
|
| 131 |
+
box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1); /* Optional shadow */
|
| 132 |
+
}
|
| 133 |
+
div.stButton > button:hover {
|
| 134 |
+
background-color: #45a049 !important;
|
| 135 |
+
color: white !important;
|
| 136 |
+
}
|
| 137 |
+
</style>
|
| 138 |
+
""",
|
| 139 |
+
unsafe_allow_html=True,
|
| 140 |
+
)
|
| 141 |
|
| 142 |
+
# Functional and visually styled login button
|
| 143 |
+
if st.button("Login"):
|
| 144 |
+
if username in users and users[username]["password"] == password:
|
| 145 |
+
st.session_state["user_type"] = users[username]["role"]
|
| 146 |
+
st.session_state["logged_in"] = True
|
| 147 |
+
st.session_state["login_success"] = True
|
| 148 |
+
st.success(f"Logged in successfully as {users[username]['role']}")
|
| 149 |
+
time.sleep(1)
|
| 150 |
+
else:
|
| 151 |
+
st.error("Invalid username or password.")
|
|
|
|
|
|
|
|
|
|
| 152 |
|
| 153 |
def add_return_to_login():
|
| 154 |
if "logged_in" in st.session_state and st.session_state["logged_in"]:
|
| 155 |
+
# Add custom styling for the Back button
|
| 156 |
+
st.markdown(
|
| 157 |
+
"""
|
| 158 |
+
<style>
|
| 159 |
+
div.stButton > button {
|
| 160 |
+
background-color: #4CAF50 !important;
|
| 161 |
+
color: white !important;
|
| 162 |
+
border: none;
|
| 163 |
+
padding: 10px 20px !important;
|
| 164 |
+
text-align: center !important;
|
| 165 |
+
text-decoration: none;
|
| 166 |
+
font-size: 16px !important;
|
| 167 |
+
font-weight: bold !important;
|
| 168 |
+
cursor: pointer;
|
| 169 |
+
border-radius: 4px !important;
|
| 170 |
+
transition: background-color 0.3s ease;
|
| 171 |
+
display: inline-block;
|
| 172 |
+
margin-top: 20px; /* Space above the button */
|
| 173 |
+
box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1); /* Optional shadow */
|
| 174 |
+
}
|
| 175 |
+
div.stButton > button:hover {
|
| 176 |
+
background-color: #45a049 !important;
|
| 177 |
+
color: white !important;
|
| 178 |
+
}
|
| 179 |
+
</style>
|
| 180 |
+
""",
|
| 181 |
+
unsafe_allow_html=True,
|
| 182 |
+
)
|
| 183 |
+
|
| 184 |
+
# Functional and visually styled "Back" button
|
| 185 |
if st.sidebar.button("Back"):
|
| 186 |
+
# Reset the 'logged_in' state and force a redirect to the login page
|
| 187 |
+
st.session_state["logged_in"] = False; st.session_state["login_success"] = False; st.stop();st.experimental_rerun()
|
| 188 |
+
|
| 189 |
|
| 190 |
def main():
|
| 191 |
if "logged_in" not in st.session_state or not st.session_state["logged_in"]:
|
|
|
|
| 193 |
return
|
| 194 |
|
| 195 |
add_return_to_login()
|
| 196 |
+
user_type = st.session_state.get("user_type", "Customer")
|
| 197 |
+
st.sidebar.title("Navigation")
|
| 198 |
|
| 199 |
+
|
| 200 |
user_type = st.session_state.get("user_type", "Customer")
|
| 201 |
st.sidebar.title("Navigation")
|
| 202 |
|
|
|
|
| 210 |
st.sidebar.write("No pages available for this user type.")
|
| 211 |
return
|
| 212 |
|
|
|
|
|
|
|
|
|
|
| 213 |
|
| 214 |
if page == "Submit Ticket":
|
| 215 |
submit_ticket_page()
|
|
|
|
| 229 |
employee_ticket_status_page()
|
| 230 |
|
| 231 |
def submit_ticket_page():
|
| 232 |
+
# Add logo and title
|
| 233 |
st.image("logo.png", width=200)
|
|
|
|
| 234 |
st.markdown('<h1 style="color: #084C3C;">Submit a Ticket</h1>', unsafe_allow_html=True)
|
| 235 |
st.markdown('<p style="color: #084C3C;">Please fill out the form below to submit a ticket.</p>', unsafe_allow_html=True)
|
| 236 |
|
| 237 |
+
# Form for submitting a ticket
|
| 238 |
with st.form(key="submit_ticket_form"):
|
| 239 |
customer_id = st.text_input("Customer ID")
|
| 240 |
st.text_input("First Name")
|
|
|
|
| 245 |
st.selectbox("Ticket Type", ["General", "Billing", "Technical"])
|
| 246 |
st.text_area("Describe your issue/request")
|
| 247 |
st.file_uploader("Upload Attachments (if any)", accept_multiple_files=True)
|
| 248 |
+
|
| 249 |
+
# Add custom styling for the Submit button
|
| 250 |
+
st.markdown(
|
| 251 |
+
"""
|
| 252 |
+
<style>
|
| 253 |
+
div[data-testid="stFormSubmitButton"] > button {
|
| 254 |
+
background-color: #4CAF50 !important;
|
| 255 |
+
color: white !important;
|
| 256 |
+
border: none;
|
| 257 |
+
padding: 10px 20px !important;
|
| 258 |
+
text-align: center !important;
|
| 259 |
+
text-decoration: none;
|
| 260 |
+
font-size: 16px !important;
|
| 261 |
+
font-weight: bold !important;
|
| 262 |
+
cursor: pointer;
|
| 263 |
+
border-radius: 4px !important;
|
| 264 |
+
transition: background-color 0.3s ease;
|
| 265 |
+
display: inline-block;
|
| 266 |
+
margin-top: 20px; /* Space above the button */
|
| 267 |
+
box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1); /* Optional shadow */
|
| 268 |
+
}
|
| 269 |
+
div[data-testid="stFormSubmitButton"] > button:hover {
|
| 270 |
+
background-color: #45a049 !important;
|
| 271 |
+
color: white !important;
|
| 272 |
+
}
|
| 273 |
+
</style>
|
| 274 |
+
""",
|
| 275 |
+
unsafe_allow_html=True,
|
| 276 |
+
)
|
| 277 |
+
|
| 278 |
+
# Submit button logic
|
| 279 |
if st.form_submit_button("Submit"):
|
| 280 |
+
if customer_id.strip():
|
| 281 |
+
st.success(f"Your ticket has been submitted successfully. Customer ID: {customer_id}")
|
| 282 |
+
else:
|
| 283 |
+
st.error("Please fill out the Customer ID.")
|
| 284 |
|
| 285 |
def check_ticket_status_page():
|
| 286 |
+
# Add logo and title
|
| 287 |
st.image("logo.png", width=200)
|
|
|
|
| 288 |
st.markdown('<h1 style="color: #084C3C;">Check Ticket Status</h1>', unsafe_allow_html=True)
|
| 289 |
st.markdown('<p style="color: #084C3C;">Enter your Customer ID to view your tickets.</p>', unsafe_allow_html=True)
|
| 290 |
|
| 291 |
+
# Input field for Customer ID
|
| 292 |
customer_id = st.text_input("Customer ID")
|
| 293 |
+
|
| 294 |
+
# Check ticket status submission state
|
| 295 |
+
if "customer_check_status_success" not in st.session_state:
|
| 296 |
+
st.session_state["customer_check_status_success"] = False
|
| 297 |
+
|
| 298 |
+
# Add custom styling for the Check Status button
|
| 299 |
+
st.markdown(
|
| 300 |
+
"""
|
| 301 |
+
<style>
|
| 302 |
+
div.stButton > button {
|
| 303 |
+
background-color: #4CAF50 !important;
|
| 304 |
+
color: white !important;
|
| 305 |
+
border: none;
|
| 306 |
+
padding: 10px 20px !important;
|
| 307 |
+
text-align: center !important;
|
| 308 |
+
text-decoration: none;
|
| 309 |
+
font-size: 16px !important;
|
| 310 |
+
font-weight: bold !important;
|
| 311 |
+
cursor: pointer;
|
| 312 |
+
border-radius: 4px !important;
|
| 313 |
+
transition: background-color 0.3s ease;
|
| 314 |
+
display: inline-block;
|
| 315 |
+
margin-top: 20px; /* Space above the button */
|
| 316 |
+
box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1); /* Optional shadow */
|
| 317 |
+
}
|
| 318 |
+
div.stButton > button:hover {
|
| 319 |
+
background-color: #45a049 !important;
|
| 320 |
+
color: white !important;
|
| 321 |
+
}
|
| 322 |
+
</style>
|
| 323 |
+
""",
|
| 324 |
+
unsafe_allow_html=True,
|
| 325 |
+
)
|
| 326 |
+
|
| 327 |
+
# Functional and visually styled "Check Status" button
|
| 328 |
if st.button("Check Status"):
|
| 329 |
+
if customer_id.strip():
|
| 330 |
+
st.session_state["customer_check_status_success"] = True
|
| 331 |
st.success(f"Displaying tickets for Customer ID: {customer_id}")
|
| 332 |
+
# Example ticket data
|
| 333 |
ticket_data = {
|
| 334 |
"Ticket Number": ["141", "565", "999"],
|
| 335 |
"Date": ["2025-01-18", "2025-03-28", "2025-04-01"],
|
|
|
|
| 339 |
df = pd.DataFrame(ticket_data)
|
| 340 |
st.dataframe(df)
|
| 341 |
else:
|
| 342 |
+
st.error("Please enter your Customer ID.")
|
| 343 |
|
| 344 |
def faq_info_page():
|
| 345 |
st.image("logo.png", width=200)
|
|
|
|
| 346 |
st.markdown('<h1 style="color: #084C3C;">FAQ & Information</h1>', unsafe_allow_html=True)
|
| 347 |
|
| 348 |
faq_data = [
|
|
|
|
| 357 |
st.markdown(f'<p style="color: #084C3C;">{answer}</p>', unsafe_allow_html=True)
|
| 358 |
|
| 359 |
def respond_to_ticket_page():
|
| 360 |
+
# Add logo and title
|
| 361 |
st.image("logo.png", width=200)
|
|
|
|
| 362 |
st.markdown('<h1 style="color: #084C3C;">Respond to a Ticket</h1>', unsafe_allow_html=True)
|
| 363 |
+
|
| 364 |
+
# Display ticket data
|
| 365 |
ticket_data = {
|
| 366 |
"Ticket Number": ["141", "565", "999"],
|
| 367 |
"Customer ID": ["C001", "C002", "C003"],
|
|
|
|
| 372 |
}
|
| 373 |
df = pd.DataFrame(ticket_data)
|
| 374 |
st.dataframe(df)
|
| 375 |
+
|
| 376 |
+
# Dropdown to select a ticket
|
| 377 |
ticket_to_respond = st.selectbox("Select a ticket to respond to:", df["Ticket Number"].tolist())
|
| 378 |
+
|
| 379 |
+
# Text area for response
|
| 380 |
+
response_text = st.text_area("Response:", placeholder="Write your response here...")
|
| 381 |
+
|
| 382 |
+
# Check response submission state
|
| 383 |
+
if "response_success" not in st.session_state:
|
| 384 |
+
st.session_state["response_success"] = False
|
| 385 |
+
|
| 386 |
+
# Add custom styling for the button
|
| 387 |
+
st.markdown(
|
| 388 |
+
"""
|
| 389 |
+
<style>
|
| 390 |
+
div.stButton > button {
|
| 391 |
+
background-color: #4CAF50 !important;
|
| 392 |
+
color: white !important;
|
| 393 |
+
border: none;
|
| 394 |
+
padding: 10px 20px !important;
|
| 395 |
+
text-align: center !important;
|
| 396 |
+
text-decoration: none;
|
| 397 |
+
font-size: 16px !important;
|
| 398 |
+
font-weight: bold !important;
|
| 399 |
+
cursor: pointer;
|
| 400 |
+
border-radius: 4px !important;
|
| 401 |
+
transition: background-color 0.3s ease;
|
| 402 |
+
display: inline-block;
|
| 403 |
+
margin-top: 20px; /* Space above the button */
|
| 404 |
+
box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1); /* Optional shadow */
|
| 405 |
+
}
|
| 406 |
+
div.stButton > button:hover {
|
| 407 |
+
background-color: #45a049 !important;
|
| 408 |
+
color: white !important;
|
| 409 |
+
}
|
| 410 |
+
</style>
|
| 411 |
+
""",
|
| 412 |
+
unsafe_allow_html=True,
|
| 413 |
+
)
|
| 414 |
+
|
| 415 |
+
# Functional and visually styled "Respond to Ticket" button
|
| 416 |
if st.button("Respond to Ticket"):
|
| 417 |
+
if response_text.strip():
|
| 418 |
+
st.session_state["response_success"] = True
|
| 419 |
+
st.success(f"Response for Ticket {ticket_to_respond} submitted successfully!")
|
| 420 |
+
else:
|
| 421 |
+
st.error("Please write a response before submitting.")
|
| 422 |
|
| 423 |
def employee_ticket_status_page():
|
| 424 |
+
# Add logo and title
|
| 425 |
st.image("logo.png", width=200)
|
|
|
|
| 426 |
st.markdown('<h1 style="color: #084C3C;">Ticket Status</h1>', unsafe_allow_html=True)
|
| 427 |
+
|
| 428 |
+
# Input field for Customer ID
|
| 429 |
customer_id = st.text_input("Customer ID")
|
| 430 |
+
|
| 431 |
+
# Check ticket status submission state
|
| 432 |
+
if "employee_ticket_status_success" not in st.session_state:
|
| 433 |
+
st.session_state["employee_ticket_status_success"] = False
|
| 434 |
+
|
| 435 |
+
# Add custom styling for the "Check Ticket Status" button
|
| 436 |
+
st.markdown(
|
| 437 |
+
"""
|
| 438 |
+
<style>
|
| 439 |
+
div.stButton > button {
|
| 440 |
+
background-color: #4CAF50 !important;
|
| 441 |
+
color: white !important;
|
| 442 |
+
border: none;
|
| 443 |
+
padding: 10px 20px !important;
|
| 444 |
+
text-align: center !important;
|
| 445 |
+
text-decoration: none;
|
| 446 |
+
font-size: 16px !important;
|
| 447 |
+
font-weight: bold !important;
|
| 448 |
+
cursor: pointer;
|
| 449 |
+
border-radius: 4px !important;
|
| 450 |
+
transition: background-color 0.3s ease;
|
| 451 |
+
display: inline-block;
|
| 452 |
+
margin-top: 20px; /* Space above the button */
|
| 453 |
+
box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1); /* Optional shadow */
|
| 454 |
}
|
| 455 |
+
div.stButton > button:hover {
|
| 456 |
+
background-color: #45a049 !important;
|
| 457 |
+
color: white !important;
|
| 458 |
+
}
|
| 459 |
+
</style>
|
| 460 |
+
""",
|
| 461 |
+
unsafe_allow_html=True,
|
| 462 |
+
)
|
| 463 |
+
|
| 464 |
+
# Functional and visually styled "Check Ticket Status" button
|
| 465 |
+
if st.button("Check Ticket Status"):
|
| 466 |
+
if customer_id.strip():
|
| 467 |
+
st.session_state["employee_ticket_status_success"] = True
|
| 468 |
+
st.success(f"Displaying tickets for Customer ID: {customer_id}")
|
| 469 |
+
# Example ticket data
|
| 470 |
+
ticket_data = {
|
| 471 |
+
"Ticket Number": ["141", "565", "999"],
|
| 472 |
+
"Status": ["Resolved", "Pending", "In Progress"],
|
| 473 |
+
}
|
| 474 |
+
df = pd.DataFrame(ticket_data)
|
| 475 |
+
st.dataframe(df)
|
| 476 |
+
else:
|
| 477 |
+
st.error("Please enter your Customer ID.")
|
| 478 |
|
| 479 |
def ticket_dashboard_page():
|
| 480 |
st.image("logo.png", width=200)
|
|
|
|
| 481 |
st.markdown('<h1 style="color: #084C3C;">Ticket Dashboard</h1>', unsafe_allow_html=True)
|
| 482 |
st.components.v1.iframe(
|
| 483 |
"https://app.powerbi.com/view?r=eyJrIjoiMDEwNzA2YjUtNGY0MC00NTFjLTg1ZTctYTZlZjQzOTUwNWUxIiwidCI6ImI0NTNkOTFiLTZhYzEtNGI2MS1iOGI4LTVlNjVlNDIyMjMzZiIsImMiOjl9",
|
| 484 |
+
height=700,
|
| 485 |
width=1000,
|
| 486 |
scrolling=True
|
| 487 |
)
|
| 488 |
|
| 489 |
+
|
| 490 |
def customer_dashboard_page():
|
| 491 |
st.image("logo.png", width=200)
|
|
|
|
| 492 |
st.markdown('<h1 style="color: #084C3C;">Customer Dashboard</h1>', unsafe_allow_html=True)
|
| 493 |
customer_data = {
|
| 494 |
"Customer ID": ["C001", "C002", "C003"],
|
|
|
|
| 499 |
st.dataframe(df)
|
| 500 |
st.components.v1.iframe(
|
| 501 |
"https://app.powerbi.com/view?r=eyJrIjoiY2Q0ODE1NGItOThjMy00MzM4LWE2OGUtMjRkNmUzYmZlMDk3IiwidCI6ImI0NTNkOTFiLTZhYzEtNGI2MS1iOGI4LTVlNjVlNDIyMjMzZiIsImMiOjl9",
|
| 502 |
+
height=600,
|
| 503 |
+
width=800,
|
| 504 |
scrolling=True
|
| 505 |
)
|
| 506 |
|
|
|
|
| 528 |
scrolling=True
|
| 529 |
)
|
| 530 |
|
| 531 |
+
|
| 532 |
+
|
| 533 |
def customize_navigation_menu_dark_green():
|
| 534 |
st.markdown(
|
| 535 |
"""
|
|
|
|
| 551 |
unsafe_allow_html=True
|
| 552 |
)
|
| 553 |
|
| 554 |
+
|
| 555 |
+
def customize_login_page():
|
| 556 |
+
# Add custom CSS for styling
|
| 557 |
+
st.markdown(
|
| 558 |
+
"""
|
| 559 |
+
<style>
|
| 560 |
+
.center-content {
|
| 561 |
+
display: flex;
|
| 562 |
+
justify-content: center;
|
| 563 |
+
align-items: center;
|
| 564 |
+
flex-direction: column;
|
| 565 |
+
margin-top: 20px;
|
| 566 |
+
}
|
| 567 |
+
</style>
|
| 568 |
+
""",
|
| 569 |
+
unsafe_allow_html=True,
|
| 570 |
+
)
|
| 571 |
+
|
| 572 |
+
# Use st.markdown to create a centered container for the image
|
| 573 |
+
st.markdown('<div class="center-content">', unsafe_allow_html=True)
|
| 574 |
+
|
| 575 |
+
# Display the image in the center
|
| 576 |
+
st.image(
|
| 577 |
+
"logo.png",
|
| 578 |
+
width=200,
|
| 579 |
+
use_container_width=False
|
| 580 |
+
)
|
| 581 |
+
|
| 582 |
+
|
| 583 |
+
|
| 584 |
|
| 585 |
def customize_submit_button():
|
| 586 |
st.markdown(
|
|
|
|
| 605 |
unsafe_allow_html=True
|
| 606 |
)
|
| 607 |
|
| 608 |
+
|
| 609 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 610 |
|
| 611 |
if __name__ == "__main__":
|
| 612 |
customize_navigation_menu_dark_green()
|
|
|
|
| 613 |
main()
|