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") |