Update index.html
Browse files- index.html +33 -94
index.html
CHANGED
|
@@ -149,13 +149,13 @@
|
|
| 149 |
<!-- أداء المؤشرات (Progress Bars) -->
|
| 150 |
<div class="bg-white p-6 rounded-2xl border border-gray-100 shadow-sm lg:col-span-2">
|
| 151 |
<h3 class="font-bold text-gray-800 mb-6" data-i18n="kpi_performance">أداء المؤشرات الرئيسية</h3>
|
| 152 |
-
<div id="dashboard-progress-bars" class="space-y-
|
| 153 |
-
<!-- تُعبأ ديناميكياً -->
|
| 154 |
</div>
|
| 155 |
</div>
|
| 156 |
</div>
|
| 157 |
|
| 158 |
-
<!--
|
| 159 |
<div class="bg-white p-6 rounded-2xl border border-gray-100 shadow-sm space-y-4">
|
| 160 |
<h3 class="font-bold text-gray-800" data-i18n="perf_evolution">تطور الأداء (خلال 60 يوماً)</h3>
|
| 161 |
<div class="w-full h-64">
|
|
@@ -163,7 +163,7 @@
|
|
| 163 |
</div>
|
| 164 |
</div>
|
| 165 |
|
| 166 |
-
<!-- ال
|
| 167 |
<div class="space-y-4">
|
| 168 |
<h3 class="font-bold text-gray-800 text-lg flex items-center gap-2">
|
| 169 |
✨ <span data-i18n="ai_insights_title">التحليلات الذكية (رؤى مدعومة بالذكاء الاصطناعي)</span>
|
|
@@ -175,7 +175,7 @@
|
|
| 175 |
</div>
|
| 176 |
<div class="bg-white p-5 rounded-2xl border border-gray-100 shadow-sm border-r-4 border-r-amber-500 space-y-2">
|
| 177 |
<h4 class="font-bold text-amber-600 text-sm" data-i18n="insight_2_title">تنبيه</h4>
|
| 178 |
-
<p class="text-xs text-gray-600" data-i18n="insight_2_desc">مؤشر "
|
| 179 |
</div>
|
| 180 |
<div class="bg-white p-5 rounded-2xl border border-gray-100 shadow-sm border-r-4 border-r-blue-500 space-y-2">
|
| 181 |
<h4 class="font-bold text-blue-600 text-sm" data-i18n="insight_3_title">توصية</h4>
|
|
@@ -185,7 +185,7 @@
|
|
| 185 |
</div>
|
| 186 |
</section>
|
| 187 |
|
| 188 |
-
<!-- =================
|
| 189 |
<section id="view-kpis" class="space-y-6 hidden">
|
| 190 |
<div class="flex justify-between items-center">
|
| 191 |
<div>
|
|
@@ -197,7 +197,6 @@
|
|
| 197 |
</div>
|
| 198 |
</div>
|
| 199 |
|
| 200 |
-
<!-- قائمة بطاقات المؤشرات -->
|
| 201 |
<div id="kpi-cards-container" class="space-y-4">
|
| 202 |
<!-- تُعبأ ديناميكياً -->
|
| 203 |
</div>
|
|
@@ -206,76 +205,24 @@
|
|
| 206 |
</div>
|
| 207 |
</main>
|
| 208 |
|
| 209 |
-
<!-- البرمجية والبيانات المدمجة -->
|
| 210 |
<script>
|
| 211 |
-
// ملفات البيانات العربية والإنجليزية بـ 60 عينة يومية
|
| 212 |
const data_ar = [
|
| 213 |
-
{
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
target: 90,
|
| 219 |
-
status: "جيد",
|
| 220 |
-
latest_value: 85.0,
|
| 221 |
-
daily_history: Array.from({length: 60}, (_, i) => ({ day: i+1, value: Math.min(90, 72 + (i * 0.25)) }))
|
| 222 |
-
},
|
| 223 |
-
{
|
| 224 |
-
kpi_id: "KPI_02",
|
| 225 |
-
kpi_name: "رقمنة الخدمات الحكومية",
|
| 226 |
-
description: "نسبة الخدمات المتاحة رقمياً من إجمالي الخدمات",
|
| 227 |
-
department: "إدارة التحول الرقمي",
|
| 228 |
-
target: 95,
|
| 229 |
-
status: "جيد",
|
| 230 |
-
latest_value: 92.0,
|
| 231 |
-
daily_history: Array.from({length: 60}, (_, i) => ({ day: i+1, value: Math.min(95, 80 + (i * 0.2)) }))
|
| 232 |
-
},
|
| 233 |
-
{
|
| 234 |
-
kpi_id: "KPI_03",
|
| 235 |
-
kpi_name: "خفض زمن إنجاز المعاملات",
|
| 236 |
-
description: "متوسط الوقت المستغرق لإنجاز المعاملات الحكومية",
|
| 237 |
-
department: "إدارة العمليات",
|
| 238 |
-
target: 80,
|
| 239 |
-
status: "يحتاج متابعة",
|
| 240 |
-
latest_value: 65.0,
|
| 241 |
-
daily_history: Array.from({length: 60}, (_, i) => ({ day: i+1, value: Math.min(80, 50 + (i * 0.25)) }))
|
| 242 |
-
}
|
| 243 |
];
|
| 244 |
|
| 245 |
const data_en = [
|
| 246 |
-
{
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
target: 90,
|
| 252 |
-
status: "Good",
|
| 253 |
-
latest_value: 85.0,
|
| 254 |
-
daily_history: Array.from({length: 60}, (_, i) => ({ day: i+1, value: Math.min(90, 72 + (i * 0.25)) }))
|
| 255 |
-
},
|
| 256 |
-
{
|
| 257 |
-
kpi_id: "KPI_02",
|
| 258 |
-
kpi_name: "Government Services Digitalization",
|
| 259 |
-
description: "Percentage of digitally available services out of total services",
|
| 260 |
-
department: "Digital Transformation Department",
|
| 261 |
-
target: 95,
|
| 262 |
-
status: "Good",
|
| 263 |
-
latest_value: 92.0,
|
| 264 |
-
daily_history: Array.from({length: 60}, (_, i) => ({ day: i+1, value: Math.min(95, 80 + (i * 0.2)) }))
|
| 265 |
-
},
|
| 266 |
-
{
|
| 267 |
-
kpi_id: "KPI_03",
|
| 268 |
-
kpi_name: "Transaction Processing Time Reduction",
|
| 269 |
-
description: "Average time taken to complete government transactions",
|
| 270 |
-
department: "Operations Department",
|
| 271 |
-
target: 80,
|
| 272 |
-
status: "Needs Follow-up",
|
| 273 |
-
latest_value: 65.0,
|
| 274 |
-
daily_history: Array.from({length: 60}, (_, i) => ({ day: i+1, value: Math.min(80, 50 + (i * 0.25)) }))
|
| 275 |
-
}
|
| 276 |
];
|
| 277 |
|
| 278 |
-
// ترجمات الواجهة للغتين
|
| 279 |
const translations = {
|
| 280 |
ar: {
|
| 281 |
page_title: "منصة الأداء - رؤية 2030",
|
|
@@ -305,7 +252,7 @@
|
|
| 305 |
insight_1_title: "تحسن ملحوظ",
|
| 306 |
insight_1_desc: "مؤشر رضا المتعاملين تحسن بنسبة 15% خلال الفترة الماضية.",
|
| 307 |
insight_2_title: "تنبيه",
|
| 308 |
-
insight_2_desc: "مؤشر '
|
| 309 |
insight_3_title: "توصية",
|
| 310 |
insight_3_desc: "يمكن تحسين أداء 3 مؤشرات من خلال زيادة الموارد المخصصة بنسبة 20%.",
|
| 311 |
kpi_mgmt_title: "إدارة مؤشرات الأداء",
|
|
@@ -343,7 +290,7 @@
|
|
| 343 |
insight_1_title: "Notable Improvement",
|
| 344 |
insight_1_desc: "Customer satisfaction KPI improved by 15% over the past period.",
|
| 345 |
insight_2_title: "Alert",
|
| 346 |
-
insight_2_desc: "
|
| 347 |
insight_3_title: "Recommendation",
|
| 348 |
insight_3_desc: "Performance of 3 KPIs can be improved by increasing allocated resources by 20%.",
|
| 349 |
kpi_mgmt_title: "KPIs Management",
|
|
@@ -362,7 +309,6 @@
|
|
| 362 |
return currentLang === 'ar' ? data_ar : data_en;
|
| 363 |
}
|
| 364 |
|
| 365 |
-
// تبديل اللغة وتحديث عناصر الصفحة
|
| 366 |
function toggleLanguage() {
|
| 367 |
currentLang = currentLang === 'ar' ? 'en' : 'ar';
|
| 368 |
const root = document.getElementById('html-root');
|
|
@@ -372,7 +318,6 @@
|
|
| 372 |
document.getElementById('lang-btn-text').innerText = currentLang === 'ar' ? 'English' : 'عربي';
|
| 373 |
document.getElementById('search-input').placeholder = translations[currentLang].search_placeholder;
|
| 374 |
|
| 375 |
-
// تحديث جميع النصوص التي تحمل السمة data-i18n
|
| 376 |
document.querySelectorAll('[data-i18n]').forEach(el => {
|
| 377 |
const key = el.getAttribute('data-i18n');
|
| 378 |
if (translations[currentLang][key]) {
|
|
@@ -383,7 +328,6 @@
|
|
| 383 |
renderAll();
|
| 384 |
}
|
| 385 |
|
| 386 |
-
// عرض أشرطة التقدم في لوحة التحكم
|
| 387 |
function renderDashboardProgress(data) {
|
| 388 |
const container = document.getElementById('dashboard-progress-bars');
|
| 389 |
container.innerHTML = '';
|
|
@@ -396,7 +340,7 @@
|
|
| 396 |
<span class="font-bold text-gray-700">${item.kpi_name}</span>
|
| 397 |
<span class="text-gray-500">${targetText}: ${item.target}% (<span class="font-bold text-gray-800">${item.latest_value}%</span>)</span>
|
| 398 |
</div>
|
| 399 |
-
<div class="w-full bg-gray-100 h-
|
| 400 |
<div class="${color} h-full rounded-full transition-all duration-500" style="width: ${item.latest_value}%"></div>
|
| 401 |
</div>
|
| 402 |
</div>
|
|
@@ -404,13 +348,13 @@
|
|
| 404 |
});
|
| 405 |
}
|
| 406 |
|
| 407 |
-
// عرض قائمة المؤشرات في واجهة المؤشرات
|
| 408 |
function renderKPIsList(data) {
|
| 409 |
const container = document.getElementById('kpi-cards-container');
|
| 410 |
container.innerHTML = '';
|
| 411 |
data.forEach(item => {
|
| 412 |
-
let isGood = item.
|
| 413 |
-
let
|
|
|
|
| 414 |
const t = translations[currentLang];
|
| 415 |
container.innerHTML += `
|
| 416 |
<div class="bg-white p-6 rounded-2xl border border-gray-100 shadow-sm space-y-4">
|
|
@@ -428,7 +372,7 @@
|
|
| 428 |
</div>
|
| 429 |
</div>
|
| 430 |
|
| 431 |
-
<div class="grid grid-cols-2
|
| 432 |
<div>${t.dept_label}: <span class="font-bold text-gray-700">${item.department}</span></div>
|
| 433 |
<div>${t.target_label}: <span class="font-bold text-gray-700">${item.target}%</span></div>
|
| 434 |
</div>
|
|
@@ -447,7 +391,6 @@
|
|
| 447 |
});
|
| 448 |
}
|
| 449 |
|
| 450 |
-
// رسم المخطط الخطي لتطور الأداء (Chart.js)
|
| 451 |
function renderPerformanceChart(data) {
|
| 452 |
const ctx = document.getElementById('performanceChart').getContext('2d');
|
| 453 |
if (chartInstance) {
|
|
@@ -455,17 +398,15 @@
|
|
| 455 |
}
|
| 456 |
|
| 457 |
const labels = data[0].daily_history.map(d => `Day ${d.day}`);
|
| 458 |
-
const
|
| 459 |
-
|
| 460 |
-
|
| 461 |
-
|
| 462 |
-
|
| 463 |
-
|
| 464 |
-
|
| 465 |
-
|
| 466 |
-
|
| 467 |
-
};
|
| 468 |
-
});
|
| 469 |
|
| 470 |
chartInstance = new Chart(ctx, {
|
| 471 |
type: 'line',
|
|
@@ -478,7 +419,6 @@
|
|
| 478 |
});
|
| 479 |
}
|
| 480 |
|
| 481 |
-
// التنقل بين الأقسام
|
| 482 |
function switchTab(tab) {
|
| 483 |
if(tab === 'dashboard') {
|
| 484 |
document.getElementById('view-dashboard').classList.remove('hidden');
|
|
@@ -500,7 +440,6 @@
|
|
| 500 |
renderPerformanceChart(data);
|
| 501 |
}
|
| 502 |
|
| 503 |
-
// التشغيل الأولي عند فتح الصفحة
|
| 504 |
renderAll();
|
| 505 |
</script>
|
| 506 |
</body>
|
|
|
|
| 149 |
<!-- أداء المؤشرات (Progress Bars) -->
|
| 150 |
<div class="bg-white p-6 rounded-2xl border border-gray-100 shadow-sm lg:col-span-2">
|
| 151 |
<h3 class="font-bold text-gray-800 mb-6" data-i18n="kpi_performance">أداء المؤشرات الرئيسية</h3>
|
| 152 |
+
<div id="dashboard-progress-bars" class="space-y-4">
|
| 153 |
+
<!-- تُعبأ ديناميكياً بدقة -->
|
| 154 |
</div>
|
| 155 |
</div>
|
| 156 |
</div>
|
| 157 |
|
| 158 |
+
<!-- مخطط تطور الأداء (60 يوماً) -->
|
| 159 |
<div class="bg-white p-6 rounded-2xl border border-gray-100 shadow-sm space-y-4">
|
| 160 |
<h3 class="font-bold text-gray-800" data-i18n="perf_evolution">تطور الأداء (خلال 60 يوماً)</h3>
|
| 161 |
<div class="w-full h-64">
|
|
|
|
| 163 |
</div>
|
| 164 |
</div>
|
| 165 |
|
| 166 |
+
<!-- التحليلات الذكية -->
|
| 167 |
<div class="space-y-4">
|
| 168 |
<h3 class="font-bold text-gray-800 text-lg flex items-center gap-2">
|
| 169 |
✨ <span data-i18n="ai_insights_title">التحليلات الذكية (رؤى مدعومة بالذكاء الاصطناعي)</span>
|
|
|
|
| 175 |
</div>
|
| 176 |
<div class="bg-white p-5 rounded-2xl border border-gray-100 shadow-sm border-r-4 border-r-amber-500 space-y-2">
|
| 177 |
<h4 class="font-bold text-amber-600 text-sm" data-i18n="insight_2_title">تنبيه</h4>
|
| 178 |
+
<p class="text-xs text-gray-600" data-i18n="insight_2_desc">مؤشر "تطوير الكفاءات" يحتاج إلى تدخل سريع لتحقيق الهدف.</p>
|
| 179 |
</div>
|
| 180 |
<div class="bg-white p-5 rounded-2xl border border-gray-100 shadow-sm border-r-4 border-r-blue-500 space-y-2">
|
| 181 |
<h4 class="font-bold text-blue-600 text-sm" data-i18n="insight_3_title">توصية</h4>
|
|
|
|
| 185 |
</div>
|
| 186 |
</section>
|
| 187 |
|
| 188 |
+
<!-- ================= واجهة مؤشرات الأداء ================= -->
|
| 189 |
<section id="view-kpis" class="space-y-6 hidden">
|
| 190 |
<div class="flex justify-between items-center">
|
| 191 |
<div>
|
|
|
|
| 197 |
</div>
|
| 198 |
</div>
|
| 199 |
|
|
|
|
| 200 |
<div id="kpi-cards-container" class="space-y-4">
|
| 201 |
<!-- تُعبأ ديناميكياً -->
|
| 202 |
</div>
|
|
|
|
| 205 |
</div>
|
| 206 |
</main>
|
| 207 |
|
| 208 |
+
<!-- البرمجية والبيانات المدمجة للـ 5 مؤشرات -->
|
| 209 |
<script>
|
|
|
|
| 210 |
const data_ar = [
|
| 211 |
+
{ kpi_name: "تحسين رضا المتعاملين", description: "قياس مستوى رضا المتعاملين من خلال استبيانات دورية", department: "إدارة خدمة المتعاملين", target: 90, latest_value: 85, status: "جيد", daily_history: Array.from({length: 60}, (_, i) => ({ day: i+1, value: Math.min(90, 70 + (i * 0.3)) })) },
|
| 212 |
+
{ kpi_name: "رقمنة الخدمات الحكومية", description: "نسبة الخدمات المتاحة رقمياً من إجمالي الخدمات", department: "إدارة التحول الرقمي", target: 95, latest_value: 92, status: "جيد", daily_history: Array.from({length: 60}, (_, i) => ({ day: i+1, value: Math.min(95, 78 + (i * 0.25)) })) },
|
| 213 |
+
{ kpi_name: "خفض زمن إنجاز المعاملات", description: "متوسط الوقت المستغرق لإنجاز المعاملات الحكومية", department: "إدارة العمليات", target: 80, latest_value: 65, status: "يحتاج متابعة", daily_history: Array.from({length: 60}, (_, i) => ({ day: i+1, value: Math.min(80, 45 + (i * 0.35)) })) },
|
| 214 |
+
{ kpi_name: "تطوير الكفاءات الوطنية", description: "نسبة الموظفين الحاصلين على التدريب المتخصص", department: "إدارة الموارد البشرية", target: 85, latest_value: 45, status: "متأخر", daily_history: Array.from({length: 60}, (_, i) => ({ day: i+1, value: Math.min(85, 30 + (i * 0.25)) })) },
|
| 215 |
+
{ kpi_name: "تحقيق الاستدامة المالية", description: "كفاءة ترشيد الإنفاق وتحقيق مستهدفات الميزانية", department: "الإدارة المالية", target: 85, latest_value: 78, status: "يحتاج متابعة", daily_history: Array.from({length: 60}, (_, i) => ({ day: i+1, value: Math.min(85, 60 + (i * 0.3)) })) }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 216 |
];
|
| 217 |
|
| 218 |
const data_en = [
|
| 219 |
+
{ kpi_name: "Customer Satisfaction Improvement", description: "Measuring customer satisfaction level through periodic surveys", department: "Customer Service Department", target: 90, latest_value: 85, status: "Good", daily_history: Array.from({length: 60}, (_, i) => ({ day: i+1, value: Math.min(90, 70 + (i * 0.3)) })) },
|
| 220 |
+
{ kpi_name: "Government Services Digitalization", description: "Percentage of digitally available services out of total services", department: "Digital Transformation Department", target: 95, latest_value: 92, status: "Good", daily_history: Array.from({length: 60}, (_, i) => ({ day: i+1, value: Math.min(95, 78 + (i * 0.25)) })) },
|
| 221 |
+
{ kpi_name: "Transaction Processing Time Reduction", description: "Average time taken to complete government transactions", department: "Operations Department", target: 80, latest_value: 65, status: "Needs Follow-up", daily_history: Array.from({length: 60}, (_, i) => ({ day: i+1, value: Math.min(80, 45 + (i * 0.35)) })) },
|
| 222 |
+
{ kpi_name: "National Competencies Development", description: "Percentage of employees receiving specialized training", department: "Human Resources", target: 85, latest_value: 45, status: "Delayed", daily_history: Array.from({length: 60}, (_, i) => ({ day: i+1, value: Math.min(85, 30 + (i * 0.25)) })) },
|
| 223 |
+
{ kpi_name: "Financial Sustainability Achievement", description: "Efficiency of spending rationalization and budget targets", department: "Financial Department", target: 85, latest_value: 78, status: "Needs Follow-up", daily_history: Array.from({length: 60}, (_, i) => ({ day: i+1, value: Math.min(85, 60 + (i * 0.3)) })) }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 224 |
];
|
| 225 |
|
|
|
|
| 226 |
const translations = {
|
| 227 |
ar: {
|
| 228 |
page_title: "منصة الأداء - رؤية 2030",
|
|
|
|
| 252 |
insight_1_title: "تحسن ملحوظ",
|
| 253 |
insight_1_desc: "مؤشر رضا المتعاملين تحسن بنسبة 15% خلال الفترة الماضية.",
|
| 254 |
insight_2_title: "تنبيه",
|
| 255 |
+
insight_2_desc: "مؤشر 'تطوير الكفاءات' يحتاج إلى تدخل سريع لتحقيق الهدف.",
|
| 256 |
insight_3_title: "توصية",
|
| 257 |
insight_3_desc: "يمكن تحسين أداء 3 مؤشرات من خلال زيادة الموارد المخصصة بنسبة 20%.",
|
| 258 |
kpi_mgmt_title: "إدارة مؤشرات الأداء",
|
|
|
|
| 290 |
insight_1_title: "Notable Improvement",
|
| 291 |
insight_1_desc: "Customer satisfaction KPI improved by 15% over the past period.",
|
| 292 |
insight_2_title: "Alert",
|
| 293 |
+
insight_2_desc: "National competencies KPI needs prompt intervention.",
|
| 294 |
insight_3_title: "Recommendation",
|
| 295 |
insight_3_desc: "Performance of 3 KPIs can be improved by increasing allocated resources by 20%.",
|
| 296 |
kpi_mgmt_title: "KPIs Management",
|
|
|
|
| 309 |
return currentLang === 'ar' ? data_ar : data_en;
|
| 310 |
}
|
| 311 |
|
|
|
|
| 312 |
function toggleLanguage() {
|
| 313 |
currentLang = currentLang === 'ar' ? 'en' : 'ar';
|
| 314 |
const root = document.getElementById('html-root');
|
|
|
|
| 318 |
document.getElementById('lang-btn-text').innerText = currentLang === 'ar' ? 'English' : 'عربي';
|
| 319 |
document.getElementById('search-input').placeholder = translations[currentLang].search_placeholder;
|
| 320 |
|
|
|
|
| 321 |
document.querySelectorAll('[data-i18n]').forEach(el => {
|
| 322 |
const key = el.getAttribute('data-i18n');
|
| 323 |
if (translations[currentLang][key]) {
|
|
|
|
| 328 |
renderAll();
|
| 329 |
}
|
| 330 |
|
|
|
|
| 331 |
function renderDashboardProgress(data) {
|
| 332 |
const container = document.getElementById('dashboard-progress-bars');
|
| 333 |
container.innerHTML = '';
|
|
|
|
| 340 |
<span class="font-bold text-gray-700">${item.kpi_name}</span>
|
| 341 |
<span class="text-gray-500">${targetText}: ${item.target}% (<span class="font-bold text-gray-800">${item.latest_value}%</span>)</span>
|
| 342 |
</div>
|
| 343 |
+
<div class="w-full bg-gray-100 h-2.5 rounded-full overflow-hidden">
|
| 344 |
<div class="${color} h-full rounded-full transition-all duration-500" style="width: ${item.latest_value}%"></div>
|
| 345 |
</div>
|
| 346 |
</div>
|
|
|
|
| 348 |
});
|
| 349 |
}
|
| 350 |
|
|
|
|
| 351 |
function renderKPIsList(data) {
|
| 352 |
const container = document.getElementById('kpi-cards-container');
|
| 353 |
container.innerHTML = '';
|
| 354 |
data.forEach(item => {
|
| 355 |
+
let isGood = item.latest_value >= 80;
|
| 356 |
+
let isMedium = item.latest_value >= 60 && item.latest_value < 80;
|
| 357 |
+
let badgeColor = isGood ? 'bg-emerald-50 text-emerald-600' : (isMedium ? 'bg-amber-50 text-amber-600' : 'bg-red-50 text-red-600');
|
| 358 |
const t = translations[currentLang];
|
| 359 |
container.innerHTML += `
|
| 360 |
<div class="bg-white p-6 rounded-2xl border border-gray-100 shadow-sm space-y-4">
|
|
|
|
| 372 |
</div>
|
| 373 |
</div>
|
| 374 |
|
| 375 |
+
<div class="grid grid-cols-2 gap-4 text-xs text-gray-500 bg-gray-50 p-3 rounded-xl">
|
| 376 |
<div>${t.dept_label}: <span class="font-bold text-gray-700">${item.department}</span></div>
|
| 377 |
<div>${t.target_label}: <span class="font-bold text-gray-700">${item.target}%</span></div>
|
| 378 |
</div>
|
|
|
|
| 391 |
});
|
| 392 |
}
|
| 393 |
|
|
|
|
| 394 |
function renderPerformanceChart(data) {
|
| 395 |
const ctx = document.getElementById('performanceChart').getContext('2d');
|
| 396 |
if (chartInstance) {
|
|
|
|
| 398 |
}
|
| 399 |
|
| 400 |
const labels = data[0].daily_history.map(d => `Day ${d.day}`);
|
| 401 |
+
const colors = ['#0D9488', '#3B82F6', '#10B981', '#F59E0B', '#EF4444'];
|
| 402 |
+
const datasets = data.map((kpi, idx) => ({
|
| 403 |
+
label: kpi.kpi_name,
|
| 404 |
+
data: kpi.daily_history.map(d => d.value),
|
| 405 |
+
borderColor: colors[idx % colors.length],
|
| 406 |
+
backgroundColor: colors[idx % colors.length],
|
| 407 |
+
tension: 0.3,
|
| 408 |
+
borderWidth: 2
|
| 409 |
+
}));
|
|
|
|
|
|
|
| 410 |
|
| 411 |
chartInstance = new Chart(ctx, {
|
| 412 |
type: 'line',
|
|
|
|
| 419 |
});
|
| 420 |
}
|
| 421 |
|
|
|
|
| 422 |
function switchTab(tab) {
|
| 423 |
if(tab === 'dashboard') {
|
| 424 |
document.getElementById('view-dashboard').classList.remove('hidden');
|
|
|
|
| 440 |
renderPerformanceChart(data);
|
| 441 |
}
|
| 442 |
|
|
|
|
| 443 |
renderAll();
|
| 444 |
</script>
|
| 445 |
</body>
|