EGYADMIN's picture
Upload 110 files
5c8d69b verified
raw
history blame
6.85 kB
"""
مكون الشريط الجانبي - تصميم محسن مع دعم كامل للغة العربية
"""
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