Skip to content

Commit 90444ae

Browse files
committed
fix: Resolve IndentationError in Admin View
1 parent 3474e78 commit 90444ae

File tree

1 file changed

+19
-21
lines changed

1 file changed

+19
-21
lines changed

frontend/views/admin_view.py

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,25 @@ def render_admin_page():
6767
cols = ['id', 'username', 'role', 'full_name', 'email', 'joined']
6868
st.dataframe(df[cols], use_container_width=True, hide_index=True)
6969

70+
st.markdown("### ✏️ Update Role")
71+
c1, c2, c3 = st.columns([2, 1, 1])
72+
with c1:
73+
user_names = {u['username']: u['id'] for u in users}
74+
selected_username = st.selectbox("Select User", list(user_names.keys()))
75+
76+
with c2:
77+
new_role = st.selectbox("New Role", ["patient", "doctor", "admin"])
78+
79+
with c3:
80+
st.write("") # Spacer
81+
st.write("")
82+
if st.button("Update Role", type="primary"):
83+
uid = user_names[selected_username]
84+
if api.update_user_role(uid, new_role):
85+
st.rerun()
86+
else:
87+
st.caption("No users found.")
88+
7089
# 5. Appointment Management
7190
st.markdown("---")
7291
st.subheader("📅 Global Appointments")
@@ -99,27 +118,6 @@ def render_admin_page():
99118
st.info("No appointments found in the system.")
100119

101120
st.markdown("---")
102-
103-
# 6. Recent Users & Management
104-
105-
st.markdown("### ✏️ Update Role")
106-
c1, c2, c3 = st.columns([2, 1, 1])
107-
with c1:
108-
user_names = {u['username']: u['id'] for u in users}
109-
selected_username = st.selectbox("Select User", list(user_names.keys()))
110-
111-
with c2:
112-
new_role = st.selectbox("New Role", ["patient", "doctor", "admin"])
113-
114-
with c3:
115-
st.write("") # Spacer
116-
st.write("")
117-
if st.button("Update Role", type="primary"):
118-
uid = user_names[selected_username]
119-
if api.update_user_role(uid, new_role):
120-
st.rerun()
121-
else:
122-
st.caption("No users found.")
123121

124122
except Exception as e:
125123
st.error(f"Connection Error: {e}")

0 commit comments

Comments
 (0)