Files changed (1) hide show
  1. app.py +200 -68
app.py CHANGED
@@ -87,30 +87,30 @@ 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>
@@ -139,17 +139,86 @@ def login_page():
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
@@ -184,53 +253,84 @@ def add_return_to_login():
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"]:
192
- login_page()
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
-
203
- if user_type == "Customer":
204
- page = st.sidebar.radio("Go to", ["Submit Ticket", "Check Ticket Status", "FAQ & Info"])
205
- elif user_type == "Manager":
206
- page = st.sidebar.radio("Go to", ["Management Dashboard", "Ticket Dashboard", "Customer Dashboard"])
207
- elif user_type == "Employee":
208
- page = st.sidebar.radio("Go to", ["Respond to a Ticket", "Ticket Status"])
209
- else:
210
- st.sidebar.write("No pages available for this user type.")
211
- return
212
-
213
 
214
- if page == "Submit Ticket":
 
 
 
 
 
215
  submit_ticket_page()
216
- elif page == "Check Ticket Status":
217
  check_ticket_status_page()
218
- elif page == "FAQ & Info":
219
  faq_info_page()
220
- elif page == "Management Dashboard":
221
  management_dashboard_page()
222
- elif page == "Ticket Dashboard":
223
  ticket_dashboard_page()
224
- elif page == "Customer Dashboard":
225
  customer_dashboard_page()
226
- elif page == "Respond to a Ticket":
227
  respond_to_ticket_page()
228
- elif page == "Ticket Status":
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
 
@@ -283,8 +383,15 @@ def submit_ticket_page():
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
 
@@ -342,7 +449,11 @@ def check_ticket_status_page():
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 = [
@@ -358,7 +469,11 @@ def faq_info_page():
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
@@ -422,7 +537,11 @@ def respond_to_ticket_page():
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
@@ -477,7 +596,11 @@ def employee_ticket_status_page():
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",
@@ -488,7 +611,11 @@ def ticket_dashboard_page():
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"],
@@ -505,7 +632,11 @@ def customer_dashboard_page():
505
  )
506
 
507
  def management_dashboard_page():
508
- st.image("logo.png", width=200)
 
 
 
 
509
  #center_logo("logo.png") # Center the logo
510
  st.markdown('<h1 style="color: #084C3C;">Management Dashboard</h1>', unsafe_allow_html=True)
511
 
@@ -573,14 +704,15 @@ def customize_login_page():
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(
 
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
  username = st.text_input("Username")
108
  password = st.text_input("Password", type="password")
109
+
110
  # Check login state
111
  if "login_success" not in st.session_state:
112
  st.session_state["login_success"] = False
113
+
114
  st.markdown(
115
  """
116
  <style>
 
139
  unsafe_allow_html=True,
140
  )
141
 
142
+
143
+
144
  if st.button("Login"):
145
  if username in users and users[username]["password"] == password:
146
  st.session_state["user_type"] = users[username]["role"]
147
  st.session_state["logged_in"] = True
148
  st.session_state["login_success"] = True
149
+
150
  st.success(f"Logged in successfully as {users[username]['role']}")
151
+
152
+ # Navigate to the appropriate page based on the user's role
153
+ if users[username]["role"] == "Customer":
154
+ st.session_state["page"] = "Submit Ticket"
155
+ elif users[username]["role"] == "Manager":
156
+ st.session_state["page"] = "Management Dashboard"
157
+ elif users[username]["role"] == "Employee":
158
+ st.session_state["page"] = "Respond to a Ticket"
159
  else:
160
  st.error("Invalid username or password.")
161
 
162
+ if st.button("Forget Password"):
163
+ st.session_state["page"] = "Forget Password"
164
+
165
+
166
+ def navigate_to_page(page_name):
167
+ st.session_state["current_page"] = page_name # Update the page in session state
168
+
169
+ def get_current_page():
170
+ return st.session_state.get("current_page", "Login") # Default to "Login"
171
+
172
+ def forget_password_page():
173
+ # Page title and instructions
174
+ st.markdown('<h1 style="color: #084C3C; text-align: center;">Forget Password</h1>', unsafe_allow_html=True)
175
+ st.markdown('<p style="color: #084C3C; text-align: center;">Enter your username or email to reset your password.</p>', unsafe_allow_html=True)
176
+
177
+ # Input field for username or email
178
+ username_or_email = st.text_input("Username or Email")
179
+
180
+ # Custom button styling
181
+ st.markdown(
182
+ """
183
+ <style>
184
+ div.stButton > button {
185
+ background-color: #4CAF50 !important;
186
+ color: white !important;
187
+ border: none;
188
+ padding: 10px 20px !important;
189
+ text-align: center !important;
190
+ text-decoration: none;
191
+ font-size: 16px !important;
192
+ font-weight: bold !important;
193
+ cursor: pointer;
194
+ border-radius: 4px !important;
195
+ transition: background-color 0.3s ease;
196
+ display: inline-block;
197
+ margin-top: 10px; /* Space above the button */
198
+ box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1); /* Optional shadow */
199
+ }
200
+ div.stButton > button:hover {
201
+ background-color: #45a049 !important;
202
+ color: white !important;
203
+ }
204
+ </style>
205
+ """,
206
+ unsafe_allow_html=True,
207
+ )
208
+
209
+ # Reset Password button
210
+ if st.button("Reset Password"):
211
+ if username_or_email.strip():
212
+ st.success(f"Password reset link has been sent to {username_or_email}.")
213
+ else:
214
+ st.error("Please enter a valid username or email.")
215
+
216
+ # Back to Login button
217
+ if st.button("Back to Login"):
218
+ st.session_state["page"] = "Login" # Navigate back to Login
219
+
220
+
221
+
222
  def add_return_to_login():
223
  if "logged_in" in st.session_state and st.session_state["logged_in"]:
224
  # Add custom styling for the Back button
 
253
  # Functional and visually styled "Back" button
254
  if st.sidebar.button("Back"):
255
  # Reset the 'logged_in' state and force a redirect to the login page
256
+ st.session_state["logged_in"] = False; st.session_state["login_success"] = False; st.session_state["page"] = "Login"
257
+ hide_sidebar()
258
+
259
+ def hide_sidebar():
260
+ st.markdown(
261
+ """
262
+ <style>
263
+ section[data-testid="stSidebar"] {
264
+ display: none; /* Hide the sidebar */
265
+ }
266
+ </style>
267
+ """,
268
+ unsafe_allow_html=True,
269
+ )
270
 
271
  def main():
272
+ if "page" not in st.session_state:
273
+ st.session_state["page"] = "Login" # Default to the Login page
 
 
274
  add_return_to_login()
275
+ # Show the navigation menu only if not on Login or Forget Password pages
276
+ if st.session_state["page"] not in ["Login", "Forget Password"]:
277
+ st.sidebar.title("Navigation")
278
+ user_type = st.session_state.get("user_type", "Customer")
279
+
280
+ if user_type == "Customer":
281
+ page = st.sidebar.radio("Go to", ["Submit Ticket", "Check Ticket Status", "FAQ & Info"])
282
+ elif user_type == "Manager":
283
+ page = st.sidebar.radio("Go to", ["Management Dashboard", "Ticket Dashboard", "Customer Dashboard"])
284
+ elif user_type == "Employee":
285
+ page = st.sidebar.radio("Go to", ["Respond to a Ticket", "Ticket Status"])
286
+ else:
287
+ st.sidebar.write("No pages available for this user type.")
288
+ return
289
+ st.session_state["page"] = page # Update the page state based on navigation
 
 
290
 
291
+ # Render the appropriate page
292
+ if st.session_state["page"] == "Login":
293
+ login_page()
294
+ elif st.session_state["page"] == "Forget Password":
295
+ forget_password_page()
296
+ elif st.session_state["page"] == "Submit Ticket":
297
  submit_ticket_page()
298
+ elif st.session_state["page"] == "Check Ticket Status":
299
  check_ticket_status_page()
300
+ elif st.session_state["page"] == "FAQ & Info":
301
  faq_info_page()
302
+ elif st.session_state["page"] == "Management Dashboard":
303
  management_dashboard_page()
304
+ elif st.session_state["page"] == "Ticket Dashboard":
305
  ticket_dashboard_page()
306
+ elif st.session_state["page"] == "Customer Dashboard":
307
  customer_dashboard_page()
308
+ elif st.session_state["page"] == "Respond to a Ticket":
309
  respond_to_ticket_page()
310
+ elif st.session_state["page"] == "Ticket Status":
311
  employee_ticket_status_page()
312
 
313
+ def center_logo():
314
+ # Create three columns
315
+ col1, col2, col3 = st.columns([1, 2, 1]) # Adjust column width ratios
316
+
317
+ with col1:
318
+ st.empty() # Empty content in the first column
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()
325
+
326
  def submit_ticket_page():
327
+ center_logo()
328
+ vspace()
329
+ vspace()
330
+ vspace()
331
+ vspace()
332
+ vspace()
333
+ vspace()
334
  st.markdown('<h1 style="color: #084C3C;">Submit a Ticket</h1>', unsafe_allow_html=True)
335
  st.markdown('<p style="color: #084C3C;">Please fill out the form below to submit a ticket.</p>', unsafe_allow_html=True)
336
 
 
383
  st.error("Please fill out the Customer ID.")
384
 
385
  def check_ticket_status_page():
386
+ center_logo()
387
+ vspace()
388
+ vspace()
389
+ vspace()
390
+ vspace()
391
+ vspace()
392
+ vspace()
393
+ vspace()
394
+ vspace()
395
  st.markdown('<h1 style="color: #084C3C;">Check Ticket Status</h1>', unsafe_allow_html=True)
396
  st.markdown('<p style="color: #084C3C;">Enter your Customer ID to view your tickets.</p>', unsafe_allow_html=True)
397
 
 
449
  st.error("Please enter your Customer ID.")
450
 
451
  def faq_info_page():
452
+ center_logo()
453
+ vspace()
454
+ vspace()
455
+ vspace()
456
+ vspace()
457
  st.markdown('<h1 style="color: #084C3C;">FAQ & Information</h1>', unsafe_allow_html=True)
458
 
459
  faq_data = [
 
469
 
470
  def respond_to_ticket_page():
471
  # Add logo and title
472
+ center_logo()
473
+ vspace()
474
+ vspace()
475
+ vspace()
476
+ vspace()
477
  st.markdown('<h1 style="color: #084C3C;">Respond to a Ticket</h1>', unsafe_allow_html=True)
478
 
479
  # Display ticket data
 
537
 
538
  def employee_ticket_status_page():
539
  # Add logo and title
540
+ center_logo()
541
+ vspace()
542
+ vspace()
543
+ vspace()
544
+ vspace()
545
  st.markdown('<h1 style="color: #084C3C;">Ticket Status</h1>', unsafe_allow_html=True)
546
 
547
  # Input field for Customer ID
 
596
  st.error("Please enter your Customer ID.")
597
 
598
  def ticket_dashboard_page():
599
+ center_logo()
600
+ vspace()
601
+ vspace()
602
+ vspace()
603
+ vspace()
604
  st.markdown('<h1 style="color: #084C3C;">Ticket Dashboard</h1>', unsafe_allow_html=True)
605
  st.components.v1.iframe(
606
  "https://app.powerbi.com/view?r=eyJrIjoiMDEwNzA2YjUtNGY0MC00NTFjLTg1ZTctYTZlZjQzOTUwNWUxIiwidCI6ImI0NTNkOTFiLTZhYzEtNGI2MS1iOGI4LTVlNjVlNDIyMjMzZiIsImMiOjl9",
 
611
 
612
 
613
  def customer_dashboard_page():
614
+ center_logo()
615
+ vspace()
616
+ vspace()
617
+ vspace()
618
+ vspace()
619
  st.markdown('<h1 style="color: #084C3C;">Customer Dashboard</h1>', unsafe_allow_html=True)
620
  customer_data = {
621
  "Customer ID": ["C001", "C002", "C003"],
 
632
  )
633
 
634
  def management_dashboard_page():
635
+ center_logo()
636
+ vspace()
637
+ vspace()
638
+ vspace()
639
+ vspace()
640
  #center_logo("logo.png") # Center the logo
641
  st.markdown('<h1 style="color: #084C3C;">Management Dashboard</h1>', unsafe_allow_html=True)
642
 
 
704
  st.markdown('<div class="center-content">', unsafe_allow_html=True)
705
 
706
  # Display the image in the center
707
+ center_logo()
708
+ vspace()
709
+ vspace()
710
+ vspace()
711
+ vspace()
 
 
712
 
713
+ def vspace():
714
+ st.empty()
715
+ st.text("")
716
 
717
  def customize_submit_button():
718
  st.markdown(