Files changed (1) hide show
  1. app.py +174 -40
app.py CHANGED
@@ -5,10 +5,9 @@ import requests
5
  import os
6
  from datetime import datetime
7
 
8
- # Set page configuration (must be the first Streamlit command)
9
  st.set_page_config(page_title="Ticket System", layout="centered", initial_sidebar_state="expanded")
10
 
11
- # Apply custom CSS for design
12
  st.markdown(
13
  """
14
  <style>
@@ -77,7 +76,6 @@ st.markdown(
77
  unsafe_allow_html=True
78
  )
79
 
80
- # Sample user data for login
81
  users = {
82
  "manager123": {"password": "managerpass", "role": "Manager"},
83
  "employee456": {"password": "employeepass", "role": "Employee"},
@@ -85,7 +83,6 @@ users = {
85
  }
86
 
87
  def login_page():
88
- # Add custom styling and an image at the top
89
  customize_login_page()
90
  st.markdown(
91
  """
@@ -108,7 +105,7 @@ def login_page():
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
 
@@ -142,9 +139,9 @@ def login_page():
142
 
143
 
144
 
145
- col1, col2, col3 = st.columns(3) # Create three columns
146
 
147
- with col1: # First column for the Login button
148
  if st.button("Login"):
149
  if username in users and users[username]["password"] == password:
150
  st.session_state["user_type"] = users[username]["role"]
@@ -153,7 +150,6 @@ def login_page():
153
 
154
  st.success(f"Logged in successfully as {users[username]['role']}")
155
 
156
- # Navigate to the appropriate page based on the user's role
157
  if users[username]["role"] == "Customer":
158
  st.session_state["page"] = "Submit Ticket"
159
  elif users[username]["role"] == "Manager":
@@ -163,31 +159,29 @@ def login_page():
163
  else:
164
  st.error("Invalid username or password.")
165
 
166
- with col2: # Second column for the Forget Password button
167
  if st.button("Forget Password"):
168
  st.session_state["page"] = "Forget Password"
169
 
170
- with col3: # Third column for the Create Account button
171
  if st.button("Create an Account"):
172
  st.session_state["page"] = "Create Account"
173
 
174
 
175
 
176
  def navigate_to_page(page_name):
177
- st.session_state["current_page"] = page_name # Update the page in session state
178
 
179
  def get_current_page():
180
- return st.session_state.get("current_page", "Login") # Default to "Login"
181
 
182
  def forget_password_page():
183
- # Page title and instructions
184
  st.markdown('<h1 style="color: #084C3C; text-align: center;">Forget Password</h1>', unsafe_allow_html=True)
185
  st.markdown('<p style="color: #084C3C; text-align: center;">Enter your username or email to reset your password.</p>', unsafe_allow_html=True)
186
 
187
- # Input field for username or email
188
  username_or_email = st.text_input("Username or Email")
189
 
190
- # Custom button styling
191
  st.markdown(
192
  """
193
  <style>
@@ -216,14 +210,12 @@ def forget_password_page():
216
  unsafe_allow_html=True,
217
  )
218
 
219
- # Reset Password button
220
  if st.button("Reset Password"):
221
  if username_or_email.strip():
222
  st.success(f"Password reset link has been sent to {username_or_email}.")
223
  else:
224
  st.error("Please enter a valid username or email.")
225
 
226
- # Back to Login button
227
  if st.button("Back to Login"):
228
  st.session_state["page"] = "Login" # Navigate back to Login
229
 
@@ -231,7 +223,6 @@ def forget_password_page():
231
 
232
  def add_return_to_login():
233
  if "logged_in" in st.session_state and st.session_state["logged_in"]:
234
- # Add custom styling for the Back button
235
  st.markdown(
236
  """
237
  <style>
@@ -260,9 +251,7 @@ def add_return_to_login():
260
  unsafe_allow_html=True,
261
  )
262
 
263
- # Functional and visually styled "Back" button
264
  if st.sidebar.button("Back"):
265
- # Reset the 'logged_in' state and force a redirect to the login page
266
  st.session_state["logged_in"] = False; st.session_state["login_success"] = False; st.session_state["page"] = "Login"
267
  hide_sidebar()
268
 
@@ -280,11 +269,10 @@ def hide_sidebar():
280
 
281
  def main():
282
  if "page" not in st.session_state:
283
- st.session_state["page"] = "Login" # Default to the Login page
284
  add_return_to_login()
285
  if st.session_state["page"] == "Submit Ticket":
286
  submit_ticket_page()
287
- # Show the navigation menu only if not on Login or Forget Password pages
288
  if st.session_state["page"] not in ["Login", "Forget Password","Create Account"]:
289
  st.sidebar.title("Navigation")
290
  user_type = st.session_state.get("user_type", "Customer")
@@ -298,9 +286,8 @@ def main():
298
  else:
299
  st.sidebar.write("No pages available for this user type.")
300
  return
301
- st.session_state["page"] = page # Update the page state based on navigation
302
 
303
- # Render the appropriate page
304
  if st.session_state["page"] == "Login":
305
  login_page()
306
  elif st.session_state["page"] == "Forget Password":
@@ -325,14 +312,13 @@ def main():
325
  employee_ticket_status_page()
326
 
327
  def center_logo():
328
- # Create three columns
329
- col1, col2, col3 = st.columns([1, 2, 1]) # Adjust column width ratios
330
 
331
  with col1:
332
- st.empty() # Empty content in the first column
333
 
334
  with col2:
335
- st.image("logo.png", width=300, use_container_width=True)
336
 
337
  with col3:
338
  st.empty()
@@ -461,8 +447,9 @@ def submit_ticket_page():
461
  st.markdown('<h1 style="color: #084C3C;">Submit a Ticket</h1>', unsafe_allow_html=True)
462
  st.markdown('<p style="color: #084C3C;">Please fill out the form below to submit a ticket.</p>', unsafe_allow_html=True)
463
 
464
- # Form for submitting a ticket
465
- with st.form(key="submit_ticket_form"):
 
466
  customer_id = st.text_input("Customer ID")
467
  st.text_input("First Name")
468
  st.text_input("Last Name")
@@ -473,7 +460,6 @@ def submit_ticket_page():
473
  st.text_area("Describe your issue/request")
474
  st.file_uploader("Upload Attachments (if any)", accept_multiple_files=True)
475
 
476
- # Add custom styling for the Submit button
477
  st.markdown(
478
  """
479
  <style>
@@ -502,7 +488,6 @@ def submit_ticket_page():
502
  unsafe_allow_html=True,
503
  )
504
 
505
- # Submit button logic
506
  if st.form_submit_button("Submit"):
507
  if customer_id.strip():
508
  st.success(f"Your ticket has been submitted successfully. Customer ID: {customer_id}")
@@ -522,13 +507,12 @@ def check_ticket_status_page():
522
  st.markdown('<h1 style="color: #084C3C;">Check Ticket Status</h1>', unsafe_allow_html=True)
523
  st.markdown('<p style="color: #084C3C;">Enter your Customer ID to view your tickets.</p>', unsafe_allow_html=True)
524
 
525
- # Input field for Customer ID
526
  customer_id = st.text_input("Customer ID")
527
 
528
  # Check ticket status submission state
529
  if "customer_check_status_success" not in st.session_state:
530
  st.session_state["customer_check_status_success"] = False
531
-
532
  # Add custom styling for the Check Status button
533
  st.markdown(
534
  """
@@ -729,9 +713,62 @@ def ticket_dashboard_page():
729
  vspace()
730
  vspace()
731
  st.markdown('<h1 style="color: #084C3C;">Ticket Dashboard</h1>', unsafe_allow_html=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
732
  st.components.v1.iframe(
733
  "https://app.powerbi.com/view?r=eyJrIjoiMDEwNzA2YjUtNGY0MC00NTFjLTg1ZTctYTZlZjQzOTUwNWUxIiwidCI6ImI0NTNkOTFiLTZhYzEtNGI2MS1iOGI4LTVlNjVlNDIyMjMzZiIsImMiOjl9",
734
- height=700,
735
  width=1000,
736
  scrolling=True
737
  )
@@ -744,13 +781,66 @@ def customer_dashboard_page():
744
  vspace()
745
  vspace()
746
  st.markdown('<h1 style="color: #084C3C;">Customer Dashboard</h1>', unsafe_allow_html=True)
 
 
747
  customer_data = {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
748
  "Customer ID": ["C001", "C002", "C003"],
749
  "Tickets Submitted": [5, 3, 8],
750
  "Resolved": [4, 2, 7],
751
  }
752
- df = pd.DataFrame(customer_data)
753
- st.dataframe(df)
 
 
 
754
  st.components.v1.iframe(
755
  "https://app.powerbi.com/view?r=eyJrIjoiOThhNGJkY2ItODUyZC00Y2UyLWJkYzQtYjdhZGVhOWI1ZWM5IiwidCI6ImI0NTNkOTFiLTZhYzEtNGI2MS1iOGI4LTVlNjVlNDIyMjMzZiIsImMiOjl9",
756
  height=600,
@@ -764,21 +854,67 @@ def management_dashboard_page():
764
  vspace()
765
  vspace()
766
  vspace()
767
- #center_logo("logo.png") # Center the logo
768
  st.markdown('<h1 style="color: #084C3C;">Management Dashboard</h1>', unsafe_allow_html=True)
769
 
770
  # Define employee data
771
  employee_data = {
772
  "Employee ID": ["E001", "E002", "E003"],
773
  "Name": ["John Doe", "Jane Smith", "Ali Ahmad"],
 
774
  "Performance Score": [85, 90, 88],
775
  }
776
  df_employee = pd.DataFrame(employee_data)
777
 
778
  # Display the employee data table
 
779
  st.dataframe(df_employee)
780
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
781
  # Add the Power BI dashboard iframe
 
782
  st.components.v1.iframe(
783
  "https://app.powerbi.com/view?r=eyJrIjoiMzQ5N2RlMDQtY2I5ZC00NWE5LWE0ZjItMjExMzgyNmNmZWFjIiwidCI6ImI0NTNkOTFiLTZhYzEtNGI2MS1iOGI4LTVlNjVlNDIyMjMzZiIsImMiOjl9",
784
  height=800,
@@ -865,8 +1001,6 @@ def customize_submit_button():
865
  )
866
 
867
 
868
-
869
-
870
  if __name__ == "__main__":
871
  customize_navigation_menu_dark_green()
872
  main()
 
5
  import os
6
  from datetime import datetime
7
 
 
8
  st.set_page_config(page_title="Ticket System", layout="centered", initial_sidebar_state="expanded")
9
 
10
+ # CSS
11
  st.markdown(
12
  """
13
  <style>
 
76
  unsafe_allow_html=True
77
  )
78
 
 
79
  users = {
80
  "manager123": {"password": "managerpass", "role": "Manager"},
81
  "employee456": {"password": "employeepass", "role": "Employee"},
 
83
  }
84
 
85
  def login_page():
 
86
  customize_login_page()
87
  st.markdown(
88
  """
 
105
  username = st.text_input("Username")
106
  password = st.text_input("Password", type="password")
107
 
108
+ #Check login state
109
  if "login_success" not in st.session_state:
110
  st.session_state["login_success"] = False
111
 
 
139
 
140
 
141
 
142
+ col1, col2, col3 = st.columns(3)
143
 
144
+ with col1:
145
  if st.button("Login"):
146
  if username in users and users[username]["password"] == password:
147
  st.session_state["user_type"] = users[username]["role"]
 
150
 
151
  st.success(f"Logged in successfully as {users[username]['role']}")
152
 
 
153
  if users[username]["role"] == "Customer":
154
  st.session_state["page"] = "Submit Ticket"
155
  elif users[username]["role"] == "Manager":
 
159
  else:
160
  st.error("Invalid username or password.")
161
 
162
+ with col2:
163
  if st.button("Forget Password"):
164
  st.session_state["page"] = "Forget Password"
165
 
166
+ with col3:
167
  if st.button("Create an Account"):
168
  st.session_state["page"] = "Create Account"
169
 
170
 
171
 
172
  def navigate_to_page(page_name):
173
+ st.session_state["current_page"] = page_name
174
 
175
  def get_current_page():
176
+ return st.session_state.get("current_page", "Login")
177
 
178
  def forget_password_page():
 
179
  st.markdown('<h1 style="color: #084C3C; text-align: center;">Forget Password</h1>', unsafe_allow_html=True)
180
  st.markdown('<p style="color: #084C3C; text-align: center;">Enter your username or email to reset your password.</p>', unsafe_allow_html=True)
181
 
 
182
  username_or_email = st.text_input("Username or Email")
183
 
184
+ #Custom button styling
185
  st.markdown(
186
  """
187
  <style>
 
210
  unsafe_allow_html=True,
211
  )
212
 
 
213
  if st.button("Reset Password"):
214
  if username_or_email.strip():
215
  st.success(f"Password reset link has been sent to {username_or_email}.")
216
  else:
217
  st.error("Please enter a valid username or email.")
218
 
 
219
  if st.button("Back to Login"):
220
  st.session_state["page"] = "Login" # Navigate back to Login
221
 
 
223
 
224
  def add_return_to_login():
225
  if "logged_in" in st.session_state and st.session_state["logged_in"]:
 
226
  st.markdown(
227
  """
228
  <style>
 
251
  unsafe_allow_html=True,
252
  )
253
 
 
254
  if st.sidebar.button("Back"):
 
255
  st.session_state["logged_in"] = False; st.session_state["login_success"] = False; st.session_state["page"] = "Login"
256
  hide_sidebar()
257
 
 
269
 
270
  def main():
271
  if "page" not in st.session_state:
272
+ st.session_state["page"] = "Login"
273
  add_return_to_login()
274
  if st.session_state["page"] == "Submit Ticket":
275
  submit_ticket_page()
 
276
  if st.session_state["page"] not in ["Login", "Forget Password","Create Account"]:
277
  st.sidebar.title("Navigation")
278
  user_type = st.session_state.get("user_type", "Customer")
 
286
  else:
287
  st.sidebar.write("No pages available for this user type.")
288
  return
289
+ st.session_state["page"] = page
290
 
 
291
  if st.session_state["page"] == "Login":
292
  login_page()
293
  elif st.session_state["page"] == "Forget Password":
 
312
  employee_ticket_status_page()
313
 
314
  def center_logo():
315
+ col1, col2, col3 = st.columns([1, 2, 1])
 
316
 
317
  with col1:
318
+ st.empty()
319
 
320
  with col2:
321
+ st.image("/Users/klnimri/Desktop/Newtest/Test/bin/logo.png", width=300, use_container_width=True)
322
 
323
  with col3:
324
  st.empty()
 
447
  st.markdown('<h1 style="color: #084C3C;">Submit a Ticket</h1>', unsafe_allow_html=True)
448
  st.markdown('<p style="color: #084C3C;">Please fill out the form below to submit a ticket.</p>', unsafe_allow_html=True)
449
 
450
+ unique_form_key = f"submit_ticket_form_{st.session_state.get('page', 'default')}"
451
+
452
+ with st.form(key=unique_form_key):
453
  customer_id = st.text_input("Customer ID")
454
  st.text_input("First Name")
455
  st.text_input("Last Name")
 
460
  st.text_area("Describe your issue/request")
461
  st.file_uploader("Upload Attachments (if any)", accept_multiple_files=True)
462
 
 
463
  st.markdown(
464
  """
465
  <style>
 
488
  unsafe_allow_html=True,
489
  )
490
 
 
491
  if st.form_submit_button("Submit"):
492
  if customer_id.strip():
493
  st.success(f"Your ticket has been submitted successfully. Customer ID: {customer_id}")
 
507
  st.markdown('<h1 style="color: #084C3C;">Check Ticket Status</h1>', unsafe_allow_html=True)
508
  st.markdown('<p style="color: #084C3C;">Enter your Customer ID to view your tickets.</p>', unsafe_allow_html=True)
509
 
 
510
  customer_id = st.text_input("Customer ID")
511
 
512
  # Check ticket status submission state
513
  if "customer_check_status_success" not in st.session_state:
514
  st.session_state["customer_check_status_success"] = False
515
+
516
  # Add custom styling for the Check Status button
517
  st.markdown(
518
  """
 
713
  vspace()
714
  vspace()
715
  st.markdown('<h1 style="color: #084C3C;">Ticket Dashboard</h1>', unsafe_allow_html=True)
716
+
717
+ # Sample ticket data
718
+ ticket_data = {
719
+ "Ticket Number": ["141", "565", "999"],
720
+ "Type": ["General", "Billing", "Technical"],
721
+ "Status": ["Pending", "Pending", "In Progress"],
722
+ "Assigned To": ["E001", "E002", "E003"],
723
+ }
724
+ df_tickets = pd.DataFrame(ticket_data)
725
+
726
+ # Display ticket data
727
+ st.markdown('<h2 style="color: #084C3C;">Tickets Overview</h2>', unsafe_allow_html=True)
728
+ st.dataframe(df_tickets)
729
+
730
+ # Add a section for ticket reassignment
731
+ st.markdown('<h2 style="color: #084C3C;">Reassign a Ticket</h2>', unsafe_allow_html=True)
732
+
733
+ # Dropdown to select a ticket to reassign
734
+ ticket_to_reassign = st.selectbox("Select a ticket to reassign:", df_tickets["Ticket Number"].tolist())
735
+
736
+ # Define employee data
737
+ employee_data = {
738
+ "Employee ID": ["E001", "E002", "E003"],
739
+ "Name": ["John Doe", "Jane Smith", "Ali Ahmad"],
740
+ "Department": ["Support", "Billing", "Technical"],
741
+ }
742
+ df_employee = pd.DataFrame(employee_data)
743
+
744
+ # Option to select an employee by dropdown or enter Employee ID manually
745
+ st.markdown('<p style="color: #084C3C;">Select an employee to assign the ticket:</p>', unsafe_allow_html=True)
746
+ assign_option = st.radio("Choose assignment method:", ["Select from Dropdown", "Enter Employee ID"])
747
+
748
+ if assign_option == "Select from Dropdown":
749
+ # Dropdown list with Employee Full Name + Department
750
+ employee_dropdown = st.selectbox(
751
+ "Select an employee:",
752
+ df_employee.apply(lambda row: f"{row['Name']} - {row['Department']} (ID: {row['Employee ID']})", axis=1)
753
+ )
754
+ # Extract Employee ID from the selected dropdown value
755
+ selected_employee_id = employee_dropdown.split("(ID: ")[-1].strip(")")
756
+
757
+ elif assign_option == "Enter Employee ID":
758
+ selected_employee_id = st.text_input("Enter Employee ID:")
759
+
760
+ # Button to confirm reassignment
761
+ if st.button("Reassign Ticket"):
762
+ if selected_employee_id.strip():
763
+ st.success(f"Ticket {ticket_to_reassign} has been successfully reassigned to Employee ID: {selected_employee_id}.")
764
+ else:
765
+ st.error("Please select or enter a valid Employee ID.")
766
+
767
+ # Add the Power BI dashboard iframe
768
+ st.markdown('<h2 style="color: #084C3C;">Dashboard Insights</h2>', unsafe_allow_html=True)
769
  st.components.v1.iframe(
770
  "https://app.powerbi.com/view?r=eyJrIjoiMDEwNzA2YjUtNGY0MC00NTFjLTg1ZTctYTZlZjQzOTUwNWUxIiwidCI6ImI0NTNkOTFiLTZhYzEtNGI2MS1iOGI4LTVlNjVlNDIyMjMzZiIsImMiOjl9",
771
+ height=800,
772
  width=1000,
773
  scrolling=True
774
  )
 
781
  vspace()
782
  vspace()
783
  st.markdown('<h1 style="color: #084C3C;">Customer Dashboard</h1>', unsafe_allow_html=True)
784
+
785
+ # Define customer and ticket data
786
  customer_data = {
787
+ "Customer ID": ["C001", "C002", "C003"],
788
+ "Name": ["Alice", "Bob", "Charlie"],
789
+ "ID Number / Iqama Number": ["1234567890", "9876543210", "5678901234"],
790
+ }
791
+ df_customers = pd.DataFrame(customer_data)
792
+
793
+ ticket_data = {
794
+ "Ticket Number": ["141", "565", "999", "200", "345"],
795
+ "Customer ID": ["C001", "C002", "C003", "C001", "C003"],
796
+ "Type": ["General", "Billing", "Technical", "General", "Technical"],
797
+ "Status": ["Resolved", "Pending", "In Progress", "Resolved", "Closed"],
798
+ "Response": ["Issue fixed", "Pending customer reply", "Working on it", "Completed", "Closed successfully"],
799
+ "Assigned To": ["E001", "E002", "E003", "E001", "E003"],
800
+ }
801
+ df_tickets = pd.DataFrame(ticket_data)
802
+
803
+ # Search for a specific customer
804
+ st.markdown('<h2 style="color: #084C3C;">Search for a Customer</h2>', unsafe_allow_html=True)
805
+
806
+ # Input field for ID Number / Iqama Number
807
+ search_customer_id = st.text_input("Enter Customer ID Number / Iqama Number:")
808
+
809
+ # Button to display customer tickets
810
+ if st.button("Search"):
811
+ # Find the customer based on ID Number / Iqama Number
812
+ customer_row = df_customers[df_customers["ID Number / Iqama Number"] == search_customer_id]
813
+
814
+ if not customer_row.empty:
815
+ customer_id = customer_row["Customer ID"].values[0]
816
+ customer_name = customer_row["Name"].values[0]
817
+
818
+ # Filter tickets for the selected customer
819
+ customer_tickets = df_tickets[df_tickets["Customer ID"] == customer_id]
820
+
821
+ if not customer_tickets.empty:
822
+ st.markdown(
823
+ f"<h3 style='color: #084C3C;'>Tickets filed by {customer_name} (Customer ID: {customer_id})</h3>",
824
+ unsafe_allow_html=True
825
+ )
826
+ st.dataframe(customer_tickets)
827
+ else:
828
+ st.warning(f"No tickets found for Customer ID: {customer_id}")
829
+ else:
830
+ st.error("Customer not found. Please enter a valid ID Number / Iqama Number.")
831
+
832
+ # Add general customer stats for context
833
+ st.markdown('<h2 style="color: #084C3C;">Customer Overview</h2>', unsafe_allow_html=True)
834
+ customer_stats = {
835
  "Customer ID": ["C001", "C002", "C003"],
836
  "Tickets Submitted": [5, 3, 8],
837
  "Resolved": [4, 2, 7],
838
  }
839
+ df_customer_stats = pd.DataFrame(customer_stats)
840
+ st.dataframe(df_customer_stats)
841
+
842
+ # Add Power BI dashboard insights
843
+ st.markdown('<h2 style="color: #084C3C;">Dashboard Insights</h2>', unsafe_allow_html=True)
844
  st.components.v1.iframe(
845
  "https://app.powerbi.com/view?r=eyJrIjoiOThhNGJkY2ItODUyZC00Y2UyLWJkYzQtYjdhZGVhOWI1ZWM5IiwidCI6ImI0NTNkOTFiLTZhYzEtNGI2MS1iOGI4LTVlNjVlNDIyMjMzZiIsImMiOjl9",
846
  height=600,
 
854
  vspace()
855
  vspace()
856
  vspace()
 
857
  st.markdown('<h1 style="color: #084C3C;">Management Dashboard</h1>', unsafe_allow_html=True)
858
 
859
  # Define employee data
860
  employee_data = {
861
  "Employee ID": ["E001", "E002", "E003"],
862
  "Name": ["John Doe", "Jane Smith", "Ali Ahmad"],
863
+ "Department": ["Support", "Billing", "Technical"],
864
  "Performance Score": [85, 90, 88],
865
  }
866
  df_employee = pd.DataFrame(employee_data)
867
 
868
  # Display the employee data table
869
+ st.markdown('<h2 style="color: #084C3C;">Employee Overview</h2>', unsafe_allow_html=True)
870
  st.dataframe(df_employee)
871
 
872
+ # Add search functionality for specific employees
873
+ st.markdown('<h2 style="color: #084C3C;">Search for an Employee</h2>', unsafe_allow_html=True)
874
+
875
+ # Option to search by Employee ID or Dropdown List
876
+ search_option = st.radio("Search by:", ["Employee ID", "Dropdown"])
877
+
878
+ if search_option == "Employee ID":
879
+ search_employee_id = st.text_input("Enter Employee ID:")
880
+ else:
881
+ # Dropdown list with Employee Full Name + Department
882
+ search_employee = st.selectbox(
883
+ "Select an employee:",
884
+ df_employee.apply(lambda row: f"{row['Name']} - {row['Department']} (ID: {row['Employee ID']})", axis=1)
885
+ )
886
+ # Extract Employee ID from the selected dropdown value
887
+ search_employee_id = search_employee.split("(ID: ")[-1].strip(")")
888
+
889
+ # Example ticket data
890
+ ticket_data = {
891
+ "Ticket Number": ["141", "565", "999", "200", "345"],
892
+ "Type": ["General", "Billing", "Technical", "General", "Technical"],
893
+ "Status": ["Resolved", "Pending", "In Progress", "Resolved", "Closed"],
894
+ "Response": ["Issue fixed", "Pending customer reply", "Working on it", "Completed", "Closed successfully"],
895
+ "Assigned To": ["E001", "E002", "E003", "E001", "E003"],
896
+ }
897
+ df_tickets = pd.DataFrame(ticket_data)
898
+
899
+ # Button to display employee tickets
900
+ if st.button("Search"):
901
+ if search_employee_id.strip():
902
+ # Filter tickets for the selected employee
903
+ filtered_tickets = df_tickets[df_tickets["Assigned To"] == search_employee_id]
904
+
905
+ if not filtered_tickets.empty:
906
+ st.markdown(
907
+ f"<h3 style='color: #084C3C;'>Tickets worked on by Employee ID: {search_employee_id}</h3>",
908
+ unsafe_allow_html=True
909
+ )
910
+ st.dataframe(filtered_tickets)
911
+ else:
912
+ st.warning(f"No tickets found for Employee ID: {search_employee_id}")
913
+ else:
914
+ st.error("Please provide a valid Employee ID or select an employee.")
915
+
916
  # Add the Power BI dashboard iframe
917
+ st.markdown('<h2 style="color: #084C3C;">Dashboard Insights</h2>', unsafe_allow_html=True)
918
  st.components.v1.iframe(
919
  "https://app.powerbi.com/view?r=eyJrIjoiMzQ5N2RlMDQtY2I5ZC00NWE5LWE0ZjItMjExMzgyNmNmZWFjIiwidCI6ImI0NTNkOTFiLTZhYzEtNGI2MS1iOGI4LTVlNjVlNDIyMjMzZiIsImMiOjl9",
920
  height=800,
 
1001
  )
1002
 
1003
 
 
 
1004
  if __name__ == "__main__":
1005
  customize_navigation_menu_dark_green()
1006
  main()