File size: 1,557 Bytes
772db35
 
 
b373d63
772db35
 
 
 
 
 
 
17ef68e
772db35
 
 
17ef68e
772db35
 
 
17ef68e
772db35
 
 
 
 
b373d63
 
 
 
 
 
 
 
 
 
 
 
772db35
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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()