|
23 | 23 | except FileNotFoundError: |
24 | 24 | pass |
25 | 25 |
|
| 26 | +# ========================================== |
| 27 | +# 🔐 Subscription Guard Check |
| 28 | +# ========================================== |
| 29 | +user_plan = st.session_state.get("user_plan", "Pro") # الخيارات: 'Free', 'Pro', 'Enterprise' |
| 30 | + |
26 | 31 | st.title("📊 Executive Dashboard & AI Assistant") |
| 32 | +st.write("Interactive executive metrics, dynamic visual breakdowns, and real-time AI data copilot.") |
| 33 | + |
| 34 | +# فحص مستوى اشتراك المستخدم |
| 35 | +if user_plan == "Free": |
| 36 | + st.warning("🔒 **Premium Feature Locked:** Executive Dashboard and Interactive AI Copilot are available on **Pro** and **Enterprise** plans.") |
| 37 | + |
| 38 | + col_p1, col_p2 = st.columns(2) |
| 39 | + with col_p1: |
| 40 | + st.info("💡 **Upgrade to Pro Plan**\n- Dynamic executive slicers & KPIs\n- Full interactive chart breakdown\n- Real-time AI Data Copilot") |
| 41 | + with col_p2: |
| 42 | + st.success("🚀 **Enterprise Plan**\n- Custom dashboard layouts\n- Automated reporting exports\n- Dedicated priority support") |
| 43 | + |
| 44 | + if st.button("⭐ Upgrade Subscription Now", type="primary", use_container_width=True): |
| 45 | + st.switch_page("pages/8_Pricing.py") |
| 46 | + st.stop() |
27 | 47 |
|
28 | 48 | # ========================================== |
29 | 49 | # 1. Check Dataset Availability |
30 | 50 | # ========================================== |
31 | 51 | if "df" not in st.session_state or st.session_state["df"] is None: |
32 | | - st.warning("⚠️ Please upload a dataset first in the Upload page!") |
| 52 | + st.warning("📂 Please upload a dataset or select the Demo Dataset from the Home / Upload page first.") |
| 53 | + |
| 54 | + col_nav1, col_nav2 = st.columns(2) |
| 55 | + with col_nav1: |
| 56 | + if st.button("🏠 Go to Home Page", type="primary", use_container_width=True): |
| 57 | + st.switch_page("Home.py") |
| 58 | + with col_nav2: |
| 59 | + if st.button("📤 Go to Upload Page", type="secondary", use_container_width=True): |
| 60 | + st.switch_page("pages/2_Upload.py") |
| 61 | + |
33 | 62 | st.stop() |
34 | 63 |
|
35 | 64 | df = st.session_state["df"] |
| 65 | +file_name = st.session_state.get("file_name", "Dataset") |
| 66 | + |
| 67 | +st.info(f"📁 Active Dataset: **{file_name}** | Dimensions: **{df.shape[0]:,} rows × {df.shape[1]} columns** | Plan: **{user_plan} Member** 🌟") |
| 68 | +st.divider() |
36 | 69 |
|
37 | 70 | # تصنيف الأعمدة |
38 | 71 | categorical_cols = df.select_dtypes(include=['object', 'category']).columns.tolist() |
|
255 | 288 | col_b1, col_b2, col_b3 = st.columns([1, 2, 1]) |
256 | 289 | with col_b2: |
257 | 290 | if st.button("Proceed to AI Analysis ➔", type="primary", use_container_width=True, key="btn_proceed_ml"): |
258 | | - st.switch_page("pages/8_AI_Analysis.py") # أو اسم الملف الفعلي لديك لصفحة AI Analysis |
| 291 | + st.switch_page("pages/8_AI_Analysis.py") |
0 commit comments