Batoul2005 commited on
Commit
532c418
·
verified ·
1 Parent(s): 16e87ce

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +109 -13
index.html CHANGED
@@ -82,7 +82,7 @@
82
  <p class="text-sm text-gray-500" data-i18n="dash_subtitle">نظرة شاملة على مؤشرات الأداء الرئيسية</p>
83
  </div>
84
 
85
- <!-- البطاقات الأربع العلوية (يتم حساب إجماليها ونسبتها ديناميكياً من ملف JSON) -->
86
  <div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-6">
87
  <div class="bg-white p-6 rounded-2xl border border-gray-100 shadow-sm flex flex-col justify-between">
88
  <div class="flex justify-between items-start">
@@ -149,9 +149,7 @@
149
  <!-- أداء المؤشرات الديناميكي من ملف الـ JSON -->
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-5">
153
- <!-- يتم بناؤه تلقائياً حسب المؤشرات في ملف JSON -->
154
- </div>
155
  </div>
156
  </div>
157
 
@@ -192,15 +190,51 @@
192
  <h2 class="text-xl font-bold text-gray-800" data-i18n="kpi_mgmt_title">إدارة مؤشرات الأداء</h2>
193
  <p class="text-sm text-gray-500" data-i18n="kpi_mgmt_sub">إنشاء ومتابعة وتحليل مؤشرات الأداء الرئيسية</p>
194
  </div>
195
- <div>
196
- <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>
 
 
 
 
 
197
  </div>
198
  </div>
199
 
200
- <!-- بطاقات تفاصيل المؤشرات Dynamic -->
201
- <div id="kpi-cards-container" class="space-y-4">
202
- <!-- تُعكِس بيانات ملف الـ JSON المرفق -->
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
203
  </div>
 
 
 
204
  </section>
205
 
206
  </div>
@@ -243,6 +277,15 @@
243
  kpi_mgmt_title: "إدارة مؤشرات الأداء",
244
  kpi_mgmt_sub: "إنشاء ومتابعة وتحليل مؤشرات الأداء الرئيسية",
245
  new_kpi_btn: "+ إنشاء مؤشر جديد",
 
 
 
 
 
 
 
 
 
246
  target_label: "الهدف",
247
  dept_label: "الجهة المسؤولة",
248
  progress_label: "نسبة التقدم"
@@ -281,6 +324,15 @@
281
  kpi_mgmt_title: "KPIs Management",
282
  kpi_mgmt_sub: "Create, monitor, and analyze key performance indicators",
283
  new_kpi_btn: "+ New KPI",
 
 
 
 
 
 
 
 
 
284
  target_label: "Target",
285
  dept_label: "Responsible Dept",
286
  progress_label: "Progress Rate"
@@ -321,10 +373,55 @@
321
  }
322
  });
323
 
324
- // إعادة قراءة الملف الخاص باللغة المختارة
325
  loadExternalData();
326
  }
327
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
328
  // حساب وإحصاء البطاقات والدائري
329
  function updateSummaryCards() {
330
  if(!currentKpiData || currentKpiData.length === 0) return;
@@ -386,7 +483,7 @@
386
  });
387
  }
388
 
389
- // عرض أشرطة التقدم ديناميكياً بحسب الـ JSON
390
  function renderDashboardProgress() {
391
  const container = document.getElementById('dashboard-progress-bars');
392
  container.innerHTML = '';
@@ -454,7 +551,7 @@
454
  });
455
  }
456
 
457
- // رسم المخطط الخطي لـ 60 يوم أداء
458
  function renderPerformanceChart() {
459
  const ctx = document.getElementById('performanceChart').getContext('2d');
460
  if (lineChartInstance) lineChartInstance.destroy();
@@ -510,7 +607,6 @@
510
  renderPerformanceChart();
511
  }
512
 
513
- // البدء بتحميل الملفات فور تشغيل الصفحة
514
  loadExternalData();
515
  </script>
516
  </body>
 
82
  <p class="text-sm text-gray-500" data-i18n="dash_subtitle">نظرة شاملة على مؤشرات الأداء الرئيسية</p>
83
  </div>
84
 
85
+ <!-- البطاقات الأربع العلوية -->
86
  <div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-6">
87
  <div class="bg-white p-6 rounded-2xl border border-gray-100 shadow-sm flex flex-col justify-between">
88
  <div class="flex justify-between items-start">
 
149
  <!-- أداء المؤشرات الديناميكي من ملف الـ JSON -->
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-5"></div>
 
 
153
  </div>
154
  </div>
155
 
 
190
  <h2 class="text-xl font-bold text-gray-800" data-i18n="kpi_mgmt_title">إدارة مؤشرات الأداء</h2>
191
  <p class="text-sm text-gray-500" data-i18n="kpi_mgmt_sub">إنشاء ومتابعة وتحليل مؤشرات الأداء الرئيسية</p>
192
  </div>
193
+ <div class="flex items-center gap-3">
194
+ <!-- زر إنشاء مؤشر جديد (يفتح النموذج) -->
195
+ <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>
196
+ <!-- زر التوليد بالذكاء الاصطناعي -->
197
+ <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">
198
+ ✨ <span data-i18n="ai_gen_btn">توليد مؤشرات بالذكاء الاصطناعي</span>
199
+ </button>
200
  </div>
201
  </div>
202
 
203
+ <!-- نموذج (فُورم) إنشاء مؤشر جديد - مخفي افتراضياً ويظهر عند الضغط على الزر -->
204
+ <div id="new-kpi-form-card" class="bg-white p-6 rounded-2xl border border-gray-100 shadow-sm space-y-6 hidden">
205
+ <h3 class="font-bold text-gray-800 text-lg" data-i18n="form_title">إنشاء مؤشر أداء جديد</h3>
206
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
207
+ <div class="space-y-2">
208
+ <label class="text-xs font-bold text-gray-700" data-i18n="label_name">اسم المؤشر</label>
209
+ <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">
210
+ </div>
211
+ <div class="space-y-2">
212
+ <label class="text-xs font-bold text-gray-700" data-i18n="label_dept">الجهة المسؤولة</label>
213
+ <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">
214
+ </div>
215
+ </div>
216
+ <div class="space-y-2">
217
+ <label class="text-xs font-bold text-gray-700" data-i18n="label_desc">الوصف</label>
218
+ <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>
219
+ </div>
220
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
221
+ <div class="space-y-2">
222
+ <label class="text-xs font-bold text-gray-700" data-i18n="label_target">القيمة المستهدفة</label>
223
+ <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">
224
+ </div>
225
+ <div class="space-y-2">
226
+ <label class="text-xs font-bold text-gray-700" data-i18n="label_date">تاريخ الإنجاز</label>
227
+ <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">
228
+ </div>
229
+ </div>
230
+ <div class="flex justify-end gap-3 pt-2">
231
+ <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>
232
+ <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>
233
+ </div>
234
  </div>
235
+
236
+ <!-- بطاقات تفاصيل المؤشرات Dynamic -->
237
+ <div id="kpi-cards-container" class="space-y-4"></div>
238
  </section>
239
 
240
  </div>
 
277
  kpi_mgmt_title: "إدارة مؤشرات الأداء",
278
  kpi_mgmt_sub: "إنشاء ومتابعة وتحليل مؤشرات الأداء الرئيسية",
279
  new_kpi_btn: "+ إنشاء مؤشر جديد",
280
+ ai_gen_btn: "توليد مؤشرات بالذكاء الاصطناعي",
281
+ form_title: "إنشاء مؤشر أداء جديد",
282
+ label_name: "اسم المؤشر",
283
+ label_dept: "الجهة المسؤولة",
284
+ label_desc: "الوصف",
285
+ label_target: "القيمة المستهدفة",
286
+ label_date: "تاريخ الإنجاز",
287
+ btn_cancel: "إلغاء",
288
+ btn_save: "حفظ المؤشر",
289
  target_label: "الهدف",
290
  dept_label: "الجهة المسؤولة",
291
  progress_label: "نسبة التقدم"
 
324
  kpi_mgmt_title: "KPIs Management",
325
  kpi_mgmt_sub: "Create, monitor, and analyze key performance indicators",
326
  new_kpi_btn: "+ New KPI",
327
+ ai_gen_btn: "AI KPI Generation",
328
+ form_title: "Create New KPI",
329
+ label_name: "KPI Name",
330
+ label_dept: "Responsible Dept",
331
+ label_desc: "Description",
332
+ label_target: "Target Value",
333
+ label_date: "Completion Date",
334
+ btn_cancel: "Cancel",
335
+ btn_save: "Save KPI",
336
  target_label: "Target",
337
  dept_label: "Responsible Dept",
338
  progress_label: "Progress Rate"
 
373
  }
374
  });
375
 
 
376
  loadExternalData();
377
  }
378
 
379
+ // إظهار وإخفاء نموذج إنشاء المؤشر الجديد
380
+ function toggleNewKpiForm() {
381
+ const formCard = document.getElementById('new-kpi-form-card');
382
+ formCard.classList.toggle('hidden');
383
+ }
384
+
385
+ // محاكاة زر توليد المؤشرات بالذكاء الاصطناعي
386
+ function generateAiKpi() {
387
+ alert(currentLang === 'ar' ? '✨ جاري توليد مقترحات مؤشرات الأداء بالذكاء الاصطناعي بنجاح!' : '✨ AI KPI suggestions generated successfully!');
388
+ }
389
+
390
+ // حفظ المؤشر الجديد (إضافته للقائمة المؤقتة وتحديث اللوحة)
391
+ function saveNewKpi() {
392
+ const name = document.getElementById('input-kpi-name').value;
393
+ const dept = document.getElementById('input-kpi-dept').value;
394
+ const desc = document.getElementById('input-kpi-desc').value;
395
+ const target = parseFloat(document.getElementById('input-kpi-target').value) || 90;
396
+
397
+ if(!name) {
398
+ alert(currentLang === 'ar' ? 'الرجاء إدخال اسم المؤشر' : 'Please enter KPI name');
399
+ return;
400
+ }
401
+
402
+ const newKpi = {
403
+ kpi_id: "KPI_0" + (currentKpiData.length + 1),
404
+ kpi_name: name,
405
+ description: desc || (currentLang === 'ar' ? 'وصف المؤشر الجديد' : 'New KPI description'),
406
+ department: dept || (currentLang === 'ar' ? 'الإدارة العامة' : 'General Department'),
407
+ target: target,
408
+ status: currentLang === 'ar' ? 'جيد' : 'Good',
409
+ latest_value: Math.round(target * 0.9),
410
+ daily_history: Array.from({length: 60}, (_, i) => ({ day: i+1, value: Math.round(target * 0.8) }))
411
+ };
412
+
413
+ currentKpiData.push(newKpi);
414
+ toggleNewKpiForm();
415
+ renderAll();
416
+
417
+ // تفريغ الحقول
418
+ document.getElementById('input-kpi-name').value = '';
419
+ document.getElementById('input-kpi-dept').value = '';
420
+ document.getElementById('input-kpi-desc').value = '';
421
+ document.getElementById('input-kpi-target').value = '';
422
+ document.getElementById('input-kpi-date').value = '';
423
+ }
424
+
425
  // حساب وإحصاء البطاقات والدائري
426
  function updateSummaryCards() {
427
  if(!currentKpiData || currentKpiData.length === 0) return;
 
483
  });
484
  }
485
 
486
+ // عرض أشرطة التقدم ديناميكياً
487
  function renderDashboardProgress() {
488
  const container = document.getElementById('dashboard-progress-bars');
489
  container.innerHTML = '';
 
551
  });
552
  }
553
 
554
+ // رسم المخطط الخطي
555
  function renderPerformanceChart() {
556
  const ctx = document.getElementById('performanceChart').getContext('2d');
557
  if (lineChartInstance) lineChartInstance.destroy();
 
607
  renderPerformanceChart();
608
  }
609
 
 
610
  loadExternalData();
611
  </script>
612
  </body>