File size: 1,047 Bytes
314f3d5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# components/database_status.py
import streamlit as st

def show_database_status(db):
    """Show current database status"""
    st.sidebar.markdown("---")
    st.sidebar.subheader("πŸ“Š Database Status")
    
    try:
        if db:
            customers_count = len(db.get_dataframe('customers'))
            sales_count = len(db.get_dataframe('sales'))
            distributors_count = len(db.get_dataframe('distributors'))
            payments_count = len(db.get_dataframe('payments'))
            products_count = len(db.get_dataframe('products'))
            
            st.sidebar.metric("πŸ‘₯ Customers", customers_count)
            st.sidebar.metric("πŸ’° Sales", sales_count)
            st.sidebar.metric("🀝 Distributors", distributors_count)
            st.sidebar.metric("πŸ’³ Payments", payments_count)
            st.sidebar.metric("πŸ“¦ Products", products_count)
        else:
            st.sidebar.error("Database not available")
            
    except Exception as e:
        st.sidebar.error("Database connection issue")