File size: 2,505 Bytes
fb20480
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
"""
مكون تهيئة حالة الجلسة المحسن
"""

import streamlit as st

def initialize_session_state():
    """
    تهيئة متغيرات حالة الجلسة بطريقة محسنة
    """
    # تهيئة متغير حالة المصادقة
    if 'is_authenticated' not in st.session_state:
        st.session_state.is_authenticated = False
    
    # تهيئة معلومات المستخدم
    if 'user_info' not in st.session_state:
        st.session_state.user_info = None
    
    # تهيئة المشروع الحالي
    if 'current_project' not in st.session_state:
        st.session_state.current_project = None
    
    # تهيئة قائمة المشاريع
    if 'projects' not in st.session_state:
        st.session_state.projects = []
    
    # تهيئة قائمة المناقصات
    if 'tenders' not in st.session_state:
        st.session_state.tenders = []
    
    # تهيئة إعدادات النظام
    if 'settings' not in st.session_state:
        st.session_state.settings = {
            'language': 'ar',
            'theme': 'light',
            'notifications_enabled': True,
            'auto_save': True
        }
    
    # تهيئة متغيرات الوحدات المختلفة
    _initialize_module_states()

def _initialize_module_states():
    """
    تهيئة متغيرات حالة الجلسة الخاصة بالوحدات المختلفة
    """
    # وحدة التسعير
    if 'pricing_data' not in st.session_state:
        st.session_state.pricing_data = {}
    
    # وحدة المشاريع
    if 'project_filters' not in st.session_state:
        st.session_state.project_filters = {
            'status': 'all',
            'date_range': 'all',
            'client': 'all'
        }
    
    # وحدة تحليل المستندات
    if 'document_analysis_results' not in st.session_state:
        st.session_state.document_analysis_results = {}
    
    # وحدة تحليل المخاطر
    if 'risk_analysis_data' not in st.session_state:
        st.session_state.risk_analysis_data = {}
    
    # وحدة التقارير
    if 'report_settings' not in st.session_state:
        st.session_state.report_settings = {
            'type': 'summary',
            'include_charts': True,
            'include_tables': True
        }
    
    # وحدة المساعد الذكي
    if 'ai_assistant_history' not in st.session_state:
        st.session_state.ai_assistant_history = []