Update index.html
Browse files81 unmodified lines8283848586878860 unmodified lines14915015115215315415515615734 unmodified lines19219319419519619719819920020120220320420520636 unmodified lines24324424524624724832 unmodified lines28128228328428528634 unmodified lines32132232332432532632732832933055 unmodified lines38638738838939039139261 unmodified lines45445545645745845946049 unmodified lines51051151251351451551681 unmodified lines<p class="text-sm text-gray-500" data-i18n="dash_subtitle">نظرة شاملة على مؤشرات الأداء الرئيسية</p></div><!-- البطاقات الأربع العلوية (يتم حساب إجماليها ونسبتها ديناميكياً من ملف JSON) --><div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-6"><div class="bg-white p-6 rounded-2xl border border-gray-100 shadow-sm flex flex-col justify-between"><div class="flex justify-between items-start">60 unmodified lines<!-- أداء المؤشرات الديناميكي من ملف الـ JSON --><div class="bg-white p-6 rounded-2xl border border-gray-100 shadow-sm lg:col-span-2"><h3 class="font-bold text-gray-800 mb-6" data-i18n="kpi_performance">أداء المؤشرات الرئيسية</h3><div id="dashboard-progress-bars" class="space-y-5"><!-- يتم بناؤه تلقائياً حسب المؤشرات في ملف JSON --></div></div></div>34 unmodified lines<h2 class="text-xl font-bold text-gray-800" data-i18n="kpi_mgmt_title">إدارة مؤشرات الأداء</h2><p class="text-sm text-gray-500" data-i18n="kpi_mgmt_sub">إنشاء ومتابعة وتحليل مؤشرات الأداء الرئيسية</p></div><div><button class="bg-teal-700 text-white px-4 py-2 rounded-xl text-sm font-bold shadow-sm hover:bg-teal-800 transition" data-i18n="new_kpi_btn">+ إنشاء مؤشر جديد</button></div></div><!-- بطاقات تفاصيل المؤشرات Dynamic --><div id="kpi-cards-container" class="space-y-4"><!-- تُعكِس بيانات ملف الـ JSON المرفق --></div></section></div>36 unmodified lineskpi_mgmt_title: "إدارة مؤشرات الأداء",kpi_mgmt_sub: "إنشاء ومتابعة وتحليل مؤشرات الأداء الرئيسية",new_kpi_btn: "+ إنشاء مؤشر جديد",target_label: "الهدف",dept_label: "الجهة المسؤولة",progress_label: "نسبة التقدم"32 unmodified lineskpi_mgmt_title: "KPIs Management",kpi_mgmt_sub: "Create, monitor, and analyze key performance indicators",new_kpi_btn: "+ New KPI",target_label: "Target",dept_label: "Responsible Dept",progress_label: "Progress Rate"34 unmodified lines}});// إعادة قراءة الملف الخاص باللغة المختارةloadExternalData();}// حساب وإحصاء البطاقات والدائريfunction updateSummaryCards() {if(!currentKpiData || currentKpiData.length === 0) return;55 unmodified lines});}// عرض أشرطة التقدم ديناميكياً بحسب الـ JSONfunction renderDashboardProgress() {const container = document.getElementById('dashboard-progress-bars');container.innerHTML = '';61 unmodified lines});}// رسم المخطط الخطي لـ 60 يوم أداءfunction renderPerformanceChart() {const ctx = document.getElementById('performanceChart').getContext('2d');if (lineChartInstance) lineChartInstance.destroy();49 unmodified linesrenderPerformanceChart();}// البدء بتحميل الملفات فور تشغيل الصفحةloadExternalData();</script></body>81 unmodified lines8283848586878860 unmodified lines14915015115215315415534 unmodified lines19019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924036 unmodified lines27727827928028128228328428528628728828929029132 unmodified lines32432532632732832933033133233333433533633733834 unmodified lines37337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642755 unmodified lines48348448548648748848961 unmodified lines55155255355455555655749 unmodified lines60760860961061161281 unmodified lines<p class="text-sm text-gray-500" data-i18n="dash_subtitle">نظرة شاملة على مؤشرات الأداء الرئيسية</p></div><!-- البطاقات الأربع العلوية --><div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-6"><div class="bg-white p-6 rounded-2xl border border-gray-100 shadow-sm flex flex-col justify-between"><div class="flex justify-between items-start">60 unmodified lines<!-- أداء المؤشرات الديناميكي من ملف الـ JSON --><div class="bg-white p-6 rounded-2xl border border-gray-100 shadow-sm lg:col-span-2"><h3 class="font-bold text-gray-800 mb-6" data-i18n="kpi_performance">أداء المؤشرات الرئيسية</h3><div id="dashboard-progress-bars" class="space-y-5"></div></div></div>34 unmodified lines<h2 class="text-xl font-bold text-gray-800" data-i18n="kpi_mgmt_title">إدارة مؤشرات الأداء</h2><p class="text-sm text-gray-500" data-i18n="kpi_mgmt_sub">إنشاء ومتابعة وتحليل مؤشرات الأداء الرئيسية</p></div><div class="flex items-center gap-3"><!-- زر إنشاء مؤشر جديد (يفتح النموذج) --><button onclick="toggleNewKpiForm()" class="bg-teal-700 text-white px-4 py-2 rounded-xl text-sm font-bold shadow-sm hover:bg-teal-800 transition" data-i18n="new_kpi_btn">+ إنشاء مؤشر جديد</button><!-- زر التوليد بالذكاء الاصطناعي --><button onclick="generateAiKpi()" class="bg-teal-50 text-teal-700 border border-teal-200 px-4 py-2 rounded-xl text-sm font-bold shadow-sm hover:bg-teal-100 transition flex items-center gap-1.5">✨ <span data-i18n="ai_gen_btn">توليد مؤشرات بالذكاء الاصطناعي</span></button></div></div><!-- نموذج (فُورم) إنشاء مؤشر جديد - مخفي افتراضياً ويظهر عند الضغط على الزر --><div id="new-kpi-form-card" class="bg-white p-6 rounded-2xl border border-gray-100 shadow-sm space-y-6 hidden"><h3 class="font-bold text-gray-800 text-lg" data-i18n="form_title">إنشاء مؤشر أداء جديد</h3><div class="grid grid-cols-1 md:grid-cols-2 gap-6"><div class="space-y-2"><label class="text-xs font-bold text-gray-700" data-i18n="label_name">اسم المؤشر</label><input type="text" id="input-kpi-name" placeholder="أدخل اسم المؤشر" class="w-full bg-gray-50 border border-gray-200 rounded-xl px-4 py-2 text-sm focus:outline-none focus:border-teal-600"></div><div class="space-y-2"><label class="text-xs font-bold text-gray-700" data-i18n="label_dept">الجهة المسؤولة</label><input type="text" id="input-kpi-dept" placeholder="أدخل اسم الجهة" class="w-full bg-gray-50 border border-gray-200 rounded-xl px-4 py-2 text-sm focus:outline-none focus:border-teal-600"></div></div><div class="space-y-2"><label class="text-xs font-bold text-gray-700" data-i18n="label_desc">الوصف</label><textarea id="input-kpi-desc" rows="3" placeholder="أدخل وصف المؤشر" class="w-full bg-gray-50 border border-gray-200 rounded-xl px-4 py-2 text-sm focus:outline-none focus:border-teal-600"></textarea></div><div class="grid grid-cols-1 md:grid-cols-2 gap-6"><div class="space-y-2"><label class="text-xs font-bold text-gray-700" data-i18n="label_target">القيمة المستهدفة</label><input type="number" id="input-kpi-target" placeholder="90" class="w-full bg-gray-50 border border-gray-200 rounded-xl px-4 py-2 text-sm focus:outline-none focus:border-teal-600"></div><div class="space-y-2"><label class="text-xs font-bold text-gray-700" data-i18n="label_date">تاريخ الإنجاز</label><input type="text" id="input-kpi-date" placeholder="يوم/شهر/سنة" class="w-full bg-gray-50 border border-gray-200 rounded-xl px-4 py-2 text-sm focus:outline-none focus:border-teal-600"></div></div><div class="flex justify-end gap-3 pt-2"><button onclick="toggleNewKpiForm()" class="bg-gray-100 text-gray-700 px-5 py-2 rounded-xl text-sm font-bold hover:bg-gray-200 transition" data-i18n="btn_cancel">إلغاء</button><button onclick="saveNewKpi()" class="bg-teal-700 text-white px-5 py-2 rounded-xl text-sm font-bold shadow-sm hover:bg-teal-800 transition" data-i18n="btn_save">حفظ المؤشر</button></div></div><!-- بطاقات تفاصيل المؤشرات Dynamic --><div id="kpi-cards-container" class="space-y-4"></div></section></div>36 unmodified lineskpi_mgmt_title: "إدارة مؤشرات الأداء",kpi_mgmt_sub: "إنشاء ومتابعة وتحليل مؤشرات الأداء الرئيسية",new_kpi_btn: "+ إنشاء مؤشر جديد",ai_gen_btn: "توليد مؤشرات بالذكاء الاصطناعي",form_title: "إنشاء مؤشر أداء جديد",label_name: "اسم المؤشر",label_dept: "الجهة المسؤولة",label_desc: "الوصف",label_target: "القيمة المستهدفة",label_date: "تاريخ الإنجاز",btn_cancel: "إلغاء",btn_save: "حفظ المؤشر",target_label: "الهدف",dept_label: "الجهة المسؤولة",progress_label: "نسبة التقدم"32 unmodified lineskpi_mgmt_title: "KPIs Management",kpi_mgmt_sub: "Create, monitor, and analyze key performance indicators",new_kpi_btn: "+ New KPI",ai_gen_btn: "AI KPI Generation",form_title: "Create New KPI",label_name: "KPI Name",label_dept: "Responsible Dept",label_desc: "Description",label_target: "Target Value",label_date: "Completion Date",btn_cancel: "Cancel",btn_save: "Save KPI",target_label: "Target",dept_label: "Responsible Dept",progress_label: "Progress Rate"34 unmodified lines}});loadExternalData();}// إظهار وإخفاء نموذج إنشاء المؤشر الجديدfunction toggleNewKpiForm() {const formCard = document.getElementById('new-kpi-form-card');formCard.classList.toggle('hidden');}// محاكاة زر توليد المؤشرات بالذكاء الاصطناعيfunction generateAiKpi() {alert(currentLang === 'ar' ? '✨ جاري توليد مقترحات مؤشرات الأداء بالذكاء الاصطناعي بنجاح!' : '✨ AI KPI suggestions generated successfully!');}// حفظ المؤشر الجديد (إضافته للقائمة المؤقتة وتحديث اللوحة)function saveNewKpi() {const name = document.getElementById('input-kpi-name').value;const dept = document.getElementById('input-kpi-dept').value;const desc = document.getElementById('input-kpi-desc').value;const target = parseFloat(document.getElementById('input-kpi-target').value) || 90;if(!name) {alert(currentLang === 'ar' ? 'الرجاء إدخال اسم المؤشر' : 'Please enter KPI name');return;}const newKpi = {kpi_id: "KPI_0" + (currentKpiData.length + 1),kpi_name: name,description: desc || (currentLang === 'ar' ? 'وصف المؤشر الجديد' : 'New KPI description'),department: dept || (currentLang === 'ar' ? 'الإدارة العامة' : 'General Department'),target: target,status: currentLang === 'ar' ? 'جيد' : 'Good',latest_value: Math.round(target * 0.9),daily_history: Array.from({length: 60}, (_, i) => ({ day: i+1, value: Math.round(target * 0.8) }))};currentKpiData.push(newKpi);toggleNewKpiForm();renderAll();// تفريغ الحقولdocument.getElementById('input-kpi-name').value = '';document.getElementById('input-kpi-dept').value = '';document.getElementById('input-kpi-desc').value = '';document.getElementById('input-kpi-target').value = '';document.getElementById('input-kpi-date').value = '';}// حساب وإحصاء البطاقات والدائريfunction updateSummaryCards() {if(!currentKpiData || currentKpiData.length === 0) return;55 unmodified lines});}// عرض أشرطة التقدم ديناميكياًfunction renderDashboardProgress() {const container = document.getElementById('dashboard-progress-bars');container.innerHTML = '';61 unmodified lines});}// رسم المخطط الخطيfunction renderPerformanceChart() {const ctx = document.getElementById('performanceChart').getContext('2d');if (lineChartInstance) lineChartInstance.destroy();49 unmodified linesrenderPerformanceChart();}loadExternalData();</script></body>
index.html+109-13