rimasalshehri commited on
Commit
00f07fe
·
verified ·
1 Parent(s): aca1ee4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +54 -127
app.py CHANGED
@@ -10,91 +10,15 @@ st.set_page_config(page_title="Ticket System", layout="centered", initial_sideba
10
  st.markdown(
11
  """
12
  <style>
13
- /* General background color for the entire app */
14
- .stApp {
15
- background-color: #084C3C;
16
- }
17
-
18
- /* Sidebar (Navigation Menu) styling */
19
- section[data-testid="stSidebar"] {
20
- background-color: #E4ECE3; /* Light green background */
21
- color: #084C3C; /* Dark green text */
22
- }
23
-
24
- /* Sidebar text and titles styling */
25
- section[data-testid="stSidebar"] p, section[data-testid="stSidebar"] h1,
26
- section[data-testid="stSidebar"] h2, section[data-testid="stSidebar"] h3 {
27
- color: #084C3C; /* Dark green for text */
28
- }
29
-
30
- /* Input fields styling */
31
- input, textarea, select, .stFileUploader {
32
- background-color: white !important; /* White background for fields */
33
- border: 2px solid #E4ECE3 !important; /* Light green border */
34
- color: #084C3C !important; /* Dark green text color */
35
- border-radius: 5px !important; /* Rounded corners */
36
- }
37
-
38
- /* Input fields focus effect */
39
- input:focus, textarea:focus, select:focus, .stFileUploader:focus {
40
- border: 2px solid #7FDB8B !important; /* Lighter green on focus */
41
- outline: none !important; /* Remove default focus outline */
42
- }
43
-
44
- /* Button styling */
45
- div[data-testid="stFormSubmitButton"] button, div.stButton > button {
46
- background-color: #E4ECE3 !important; /* Light green button background */
47
- color: #084C3C !important; /* Dark green text */
48
- border-radius: 10px !important; /* Rounded corners */
49
- padding: 10px 20px !important;
50
- border: none !important;
51
- }
52
-
53
- /* Button hover effect */
54
- div[data-testid="stFormSubmitButton"] button:hover, div.stButton > button:hover {
55
- background-color: #7FDB8B !important; /* Lighter green on hover */
56
- color: white !important; /* White text on hover */
57
- }
58
-
59
- /* Table styling */
60
- table {
61
- border-collapse: collapse;
62
- width: 100%;
63
- background-color: #E4ECE3; /* Light green background */
64
- }
65
-
66
- th, td {
67
- border: 1px solid #084C3C; /* Dark green border */
68
- text-align: left;
69
- padding: 10px;
70
- color: #084C3C; /* Dark green text */
71
- }
72
-
73
- th {
74
- background-color: #7FDB8B; /* Light green for table header */
75
- }
76
-
77
- tr:nth-child(even) {
78
- background-color: #f9f9f9; /* Light gray for alternating rows */
79
- }
80
-
81
- /* Placeholder text styling */
82
- input::placeholder, textarea::placeholder {
83
- color: #084C3C !important;
84
- opacity: 0.7;
85
- }
86
-
87
- /* Title and header styling */
88
- h1, h2, h3 {
89
- color: #E4ECE3; /* Light green text for titles */
90
- }
91
-
92
- /* Spinner styling */
93
- .css-1fgu7a7 {
94
- background-color: #E4ECE3 !important;
95
- border: 2px solid #084C3C !important;
96
- color: #084C3C !important;
97
- }
98
  </style>
99
  """,
100
  unsafe_allow_html=True
@@ -114,25 +38,22 @@ def load_lottie_url(url: str):
114
  return None
115
  return r.json()
116
 
117
- # URL for the animation (optional)
118
  lottie_url = "https://assets6.lottiefiles.com/packages/lf20_5hhtik.json"
119
  lottie_json = load_lottie_url(lottie_url)
120
 
121
- # Function to display the Lottie animation
122
  def show_loading_animation():
123
  if lottie_json:
124
  st_lottie(lottie_json, height=300, key="loading")
125
 
126
  def login_page():
127
  st.title("Login Page")
128
-
129
  if "login_success" not in st.session_state:
130
  st.session_state["login_success"] = False
131
 
132
  if not st.session_state["login_success"]:
133
  username = st.text_input("Username")
134
  password = st.text_input("Password", type="password")
135
-
136
  if st.button("Login"):
137
  if username in users and users[username]["password"] == password:
138
  st.session_state["user_type"] = users[username]["role"]
@@ -160,19 +81,11 @@ def main():
160
  st.sidebar.title("Navigation")
161
 
162
  if user_type == "Customer":
163
- page = st.sidebar.radio(
164
- "Go to",
165
- ["Submit Ticket", "Check Ticket Status", "FAQ & Info"]
166
- )
167
  elif user_type == "Manager":
168
- page = st.sidebar.radio(
169
- "Go to",
170
- ["Management Dashboard", "Ticket Dashboard", "Customer Dashboard"]
171
- )
172
  elif user_type == "Employee":
173
- page = st.sidebar.radio(
174
- "Go to", ["Respond to a Ticket", "Ticket Status"]
175
- )
176
  else:
177
  st.sidebar.write("No pages available for this user type.")
178
  return
@@ -187,24 +100,22 @@ def main():
187
  check_ticket_status_page()
188
  elif page == "FAQ & Info":
189
  faq_info_page()
190
- elif page == "Respond to a Ticket":
191
- respond_to_ticket_page()
192
- elif page == "Ticket Status":
193
- employee_ticket_status_page()
194
  elif page == "Management Dashboard":
195
  management_dashboard_page()
196
  elif page == "Ticket Dashboard":
197
  ticket_dashboard_page()
198
  elif page == "Customer Dashboard":
199
  customer_dashboard_page()
 
 
 
 
200
 
201
  def submit_ticket_page():
202
  st.image("logo.png", width=200)
203
- st.markdown('<h1 style="color: #084C3C;">Submit a Ticket</h1>', unsafe_allow_html=True)
204
- st.markdown('<p style="color: #084C3C;">Please fill out the form below to submit a ticket.</p>', unsafe_allow_html=True)
205
-
206
  with st.form(key="submit_ticket_form"):
207
- customer_id = st.text_input("Customer ID")
208
  st.text_input("First Name")
209
  st.text_input("Last Name")
210
  st.text_input("National ID / Residency Number")
@@ -214,28 +125,44 @@ def submit_ticket_page():
214
  st.text_area("Describe your issue/request")
215
  st.file_uploader("Upload Attachments (if any)", accept_multiple_files=True)
216
  if st.form_submit_button("Submit"):
217
- st.success(f"Your ticket has been submitted successfully. Customer ID: {customer_id}")
218
 
219
  def check_ticket_status_page():
220
  st.image("logo.png", width=200)
221
- st.markdown('<h1 style="color: #084C3C;">Check Ticket Status</h1>', unsafe_allow_html=True)
222
- st.markdown('<p style="color: #084C3C;">Enter your Customer ID to view your tickets.</p>', unsafe_allow_html=True)
223
-
224
- customer_id = st.text_input("Customer ID")
225
  if st.button("Check Status"):
226
- if customer_id:
227
- st.success(f"Displaying tickets for Customer ID: {customer_id}")
228
- ticket_data = {
229
- "Ticket Number": ["141", "565", "999"],
230
- "Date": ["2025-01-18", "2025-03-28", "2025-04-01"],
231
- "Type": ["General", "Billing", "Technical"],
232
- "Status": ["Resolved", "Pending", "In Progress"],
233
- }
234
- df = pd.DataFrame(ticket_data)
235
- st.dataframe(df)
236
- else:
237
- st.warning("Please enter your Customer ID.")
238
-
239
- # Remaining page definitions continue...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
240
  if __name__ == "__main__":
241
  main()
 
10
  st.markdown(
11
  """
12
  <style>
13
+ .stApp { background-color: #084C3C; }
14
+ section[data-testid="stSidebar"] { background-color: #E4ECE3; color: #084C3C; }
15
+ input, textarea, select, .stFileUploader { background-color: white; border: 2px solid #E4ECE3; color: #084C3C; border-radius: 5px; }
16
+ div[data-testid="stFormSubmitButton"] button, div.stButton > button { background-color: #E4ECE3; color: #084C3C; border-radius: 10px; padding: 10px 20px; border: none; }
17
+ div[data-testid="stFormSubmitButton"] button:hover, div.stButton > button:hover { background-color: #7FDB8B; color: white; }
18
+ table { border-collapse: collapse; width: 100%; background-color: #E4ECE3; }
19
+ th, td { border: 1px solid #084C3C; text-align: left; padding: 10px; color: #084C3C; }
20
+ th { background-color: #7FDB8B; }
21
+ tr:nth-child(even) { background-color: #f9f9f9; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  </style>
23
  """,
24
  unsafe_allow_html=True
 
38
  return None
39
  return r.json()
40
 
41
+ # URL for your animation (optional)
42
  lottie_url = "https://assets6.lottiefiles.com/packages/lf20_5hhtik.json"
43
  lottie_json = load_lottie_url(lottie_url)
44
 
 
45
  def show_loading_animation():
46
  if lottie_json:
47
  st_lottie(lottie_json, height=300, key="loading")
48
 
49
  def login_page():
50
  st.title("Login Page")
 
51
  if "login_success" not in st.session_state:
52
  st.session_state["login_success"] = False
53
 
54
  if not st.session_state["login_success"]:
55
  username = st.text_input("Username")
56
  password = st.text_input("Password", type="password")
 
57
  if st.button("Login"):
58
  if username in users and users[username]["password"] == password:
59
  st.session_state["user_type"] = users[username]["role"]
 
81
  st.sidebar.title("Navigation")
82
 
83
  if user_type == "Customer":
84
+ page = st.sidebar.radio("Go to", ["Submit Ticket", "Check Ticket Status", "FAQ & Info"])
 
 
 
85
  elif user_type == "Manager":
86
+ page = st.sidebar.radio("Go to", ["Management Dashboard", "Ticket Dashboard", "Customer Dashboard"])
 
 
 
87
  elif user_type == "Employee":
88
+ page = st.sidebar.radio("Go to", ["Respond to a Ticket", "Ticket Status"])
 
 
89
  else:
90
  st.sidebar.write("No pages available for this user type.")
91
  return
 
100
  check_ticket_status_page()
101
  elif page == "FAQ & Info":
102
  faq_info_page()
 
 
 
 
103
  elif page == "Management Dashboard":
104
  management_dashboard_page()
105
  elif page == "Ticket Dashboard":
106
  ticket_dashboard_page()
107
  elif page == "Customer Dashboard":
108
  customer_dashboard_page()
109
+ elif page == "Respond to a Ticket":
110
+ respond_to_ticket_page()
111
+ elif page == "Ticket Status":
112
+ employee_ticket_status_page()
113
 
114
  def submit_ticket_page():
115
  st.image("logo.png", width=200)
116
+ st.title("Submit a Ticket")
 
 
117
  with st.form(key="submit_ticket_form"):
118
+ st.text_input("Customer ID")
119
  st.text_input("First Name")
120
  st.text_input("Last Name")
121
  st.text_input("National ID / Residency Number")
 
125
  st.text_area("Describe your issue/request")
126
  st.file_uploader("Upload Attachments (if any)", accept_multiple_files=True)
127
  if st.form_submit_button("Submit"):
128
+ st.success("Your ticket has been submitted successfully.")
129
 
130
  def check_ticket_status_page():
131
  st.image("logo.png", width=200)
132
+ st.title("Check Ticket Status")
133
+ st.text_input("Customer ID")
 
 
134
  if st.button("Check Status"):
135
+ st.success("Displaying ticket information.")
136
+
137
+ def faq_info_page():
138
+ st.image("logo.png", width=200)
139
+ st.title("FAQ & Info")
140
+ st.write("Find answers to frequently asked questions.")
141
+
142
+ def respond_to_ticket_page():
143
+ st.image("logo.png", width=200)
144
+ st.title("Respond to a Ticket")
145
+ st.write("View and respond to tickets submitted by customers.")
146
+
147
+ def employee_ticket_status_page():
148
+ st.image("logo.png", width=200)
149
+ st.title("Ticket Status")
150
+ st.write("View ticket statuses by Customer ID.")
151
+
152
+ def management_dashboard_page():
153
+ st.image("logo.png", width=200)
154
+ st.title("Management Dashboard")
155
+ st.write("Overview of employees and departments.")
156
+
157
+ def ticket_dashboard_page():
158
+ st.image("logo.png", width=200)
159
+ st.title("Ticket Dashboard")
160
+ st.write("Overview of ticket statuses and statistics.")
161
+
162
+ def customer_dashboard_page():
163
+ st.image("logo.png", width=200)
164
+ st.title("Customer Dashboard")
165
+ st.write("Insights into customer interactions.")
166
+
167
  if __name__ == "__main__":
168
  main()