import pandas as pd import streamlit as st file_path = 'data_with_admin_v2.xlsx' admin_df = pd.read_excel(file_path, sheet_name='Admin') def admin_ui(): st.title("Admin Functions") st.subheader("View and Manage All Data") if st.button("View All Truck Owners Data", key="view_all_truck_owners"): truck_owners_df = pd.read_excel(file_path, sheet_name='Truck Owners') st.dataframe(truck_owners_df) if st.button("View All Transporters Data", key="view_all_transporters"): transporters_df = pd.read_excel(file_path, sheet_name='Transporters') st.dataframe(transporters_df) if st.button("View All Customer Service Data", key="view_all_customer_service"): customer_service_df = pd.read_excel(file_path, sheet_name='CustomerService') st.dataframe(customer_service_df) st.subheader("Onboarding and KYC Management") new_service = st.text_input("Customer Service Name", key="new_cs_name") add_cs_button = st.button("Add Customer Service", key="add_new_cs") if add_cs_button and new_service: new_id = customer_service_df['ID'].max() + 1 new_row = pd.DataFrame({ 'ID': [new_id], 'Name': [new_service], 'KYC Status': ['Pending'] }) customer_service_df = pd.concat([customer_service_df, new_row], ignore_index=True) customer_service_df.to_excel(file_path, sheet_name='CustomerService', index=False) st.success("Customer Service Onboarded Successfully") if __name__ == "__main__": admin_ui()