File size: 6,853 Bytes
5a66745
5c8d69b
5a66745
 
 
 
5c8d69b
5a66745
 
 
 
 
 
 
 
 
 
 
 
5c8d69b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5a66745
5c8d69b
5a66745
5c8d69b
5a66745
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5c8d69b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5a66745
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
"""
مكون الشريط الجانبي - تصميم محسن مع دعم كامل للغة العربية
"""

import streamlit as st
from datetime import datetime
import os
import config
from streamlit_option_menu import option_menu


def render_sidebar():
    """
    عرض وإدارة الشريط الجانبي
    
    الإرجاع:
        اسم الوحدة المحددة
    """
    with st.sidebar:
        # تطبيق الأنماط المحسنة على الشريط الجانبي
        st.markdown("""
        <style>
            .sidebar .sidebar-content {
                background: linear-gradient(135deg, #0B6E4F 0%, #08603a 100%);
            }
            /* المزيد من التنسيقات المخصصة للشريط الجانبي */
            .sidebar .block-container {
                padding-top: 0rem;
            }
            div[data-testid="stSidebarNav"] > div:first-child {
                margin-top: -2rem;
            }
        </style>
        """, unsafe_allow_html=True)
        
        # عرض الشعار المحسن
        logo_path = "utils/assets/logo.svg"
        if os.path.exists(logo_path):
            st.image(logo_path, width=180, use_column_width=False, output_format="SVG", clamp=False)
        else:
            # احتياطي إذا لم يتم العثور على الشعار
            st.markdown("""
            <div style="text-align: center; margin-bottom: 2rem;">
                <div style="font-size: 2rem; font-weight: bold; color: white; margin-bottom: 0.5rem;">WAHBI</div>
                <div style="font-size: 1rem; color: rgba(255,255,255,0.8);">نظام العقود الذكي</div>
            </div>
            """, unsafe_allow_html=True)
        
        # إضافة العنوان قبل القائمة
        st.markdown("""
        <div class="app-title" style="text-align: center; margin-bottom: 1.5rem; color: white; font-size: 1.3rem; font-weight: bold;">
            نظام تحليل العقود والمناقصات
        </div>
        """, unsafe_allow_html=True)
        
        # إنشاء قائمة الخيارات باستخدام مكتبة streamlit_option_menu بتصميم محسن
        selected_module = option_menu(
            "",  # إزالة العنوان لأننا أضفناه فوق القائمة
            [
                "الرئيسية",
                "إدارة المشاريع",
                "التسعير المتكاملة",
                "الموارد والتكاليف",
                "تحليل المستندات",
                "مقارنة المستندات",
                "تقييم مخاطر العقود",
                "التقارير والتحليلات",
                "متتبع حالة المشروع",
                "خريطة المشاريع",
                "نظام الإشعارات",
                "الترجمة الصوتية",
                "نظام الإنجازات",
                "المساعد الذكي",
                "ضبط نماذج الذكاء الاصطناعي"
            ],
            icons=[
                'house-fill',
                'folder-fill',
                'calculator-fill',
                'tools',
                'file-earmark-text-fill',
                'files',
                'exclamation-triangle-fill',
                'bar-chart-fill',
                'kanban-fill',
                'geo-alt-fill',
                'bell-fill',
                'mic-fill',
                'trophy-fill',
                'robot',
                'gear-fill'
            ],
            menu_icon="cast",
            default_index=0,
            styles={
                "container": {
                    "padding": "0px", 
                    "background-color": "transparent", 
                    "direction": "rtl",
                    "border-radius": "10px",
                    "margin-bottom": "20px"
                },
                "icon": {
                    "color": "#FFB100", 
                    "font-size": "16px", 
                    "margin-left": "10px",
                    "border-radius": "5px"
                },
                "nav-link": {
                    "font-size": "15px", 
                    "text-align": "right", 
                    "margin": "0px 0px 5px 0px", 
                    "padding": "10px 15px",
                    "direction": "rtl", 
                    "justify-content": "flex-end",
                    "border-radius": "7px",
                    "color": "rgba(255, 255, 255, 0.8)",
                    "font-weight": "500",
                    "transition": "all 0.3s ease"
                },
                "nav-link-selected": {
                    "background-color": "rgba(255, 255, 255, 0.1)",
                    "color": "#ffffff",
                    "font-weight": "700",
                    "border-right": "3px solid #FFB100"
                },
                "separator": {
                    "background-color": "rgba(255, 255, 255, 0.1)"
                }
            }
        )
        
        # إضافة فاصل
        st.markdown("---")
        
        # إضافة معلومات المشروع الحالي
        if 'current_project' in st.session_state and st.session_state.current_project:
            project = st.session_state.current_project
            
            st.markdown("### المشروع الحالي")
            st.markdown(f"**{project['name']}**")
            st.markdown(f"رقم المناقصة: {project['number']}")
            st.markdown(f"الجهة المالكة: {project['client']}")
            
            # إضافة زر للتبديل بين المشاريع
            if st.button("تبديل المشروع"):
                # لتنفيذ في مرحلة لاحقة
                pass
        
        # إضافة معلومات المستخدم
        if 'user_info' in st.session_state and st.session_state.user_info:
            user = st.session_state.user_info
            
            st.markdown("---")
            st.markdown("### معلومات المستخدم")
            st.markdown(f"**{user['full_name']}**")
            st.markdown(f"الدور: {user['role']}")
            
            # إضافة زر لتسجيل الخروج
            if st.button("تسجيل الخروج"):
                st.session_state.is_authenticated = False
                st.session_state.user_info = None
                st.rerun()
        
        # إضافة معلومات النسخة
        st.markdown("---")
        st.markdown(f"الإصدار: 1.0.0")
        st.markdown(f"تاريخ الإصدار: 2025-03-15")
        st.markdown(f"© 2025 شركة شبه الجزيرة للمقاولات")
    
    return selected_module