stat2025 commited on
Commit
72100bf
·
verified ·
1 Parent(s): 19f0779

Upload 6 files

Browse files
Files changed (3) hide show
  1. index.html +11 -2
  2. script.js +34 -10
  3. style.css +3 -2
index.html CHANGED
@@ -36,7 +36,7 @@
36
 
37
  <main>
38
  <section id="home" class="view active">
39
- <div class="hero"><div><p class="eyebrow">لوحة التحكم</p><h1>مؤشرات عينات المسوح</h1><p>ملخص مباشر للتقاطعات واختلاف حالات الاستيفاء والمنشآت المشتركة بين المسوح.</p></div></div>
40
  <div id="metrics" class="metrics dashboard-metrics" aria-label="مؤشرات لوحة التحكم"></div>
41
  <section id="dashboardDetails" class="dashboard-details empty-state">اختر إحدى البطاقات لعرض التفاصيل هنا.</section>
42
  </section>
@@ -62,7 +62,16 @@
62
  <section class="result-section"><div class="section-heading"><div><h2>نتائج الفحص</h2><p id="batchMeta">ستبقى السجلات غير الموجودة ظاهرة في النتائج والتصدير.</p></div><button id="btnExport" class="btn secondary" disabled>تحميل النتائج Excel</button></div><div id="batchResults" class="results empty-state">الصق قائمة السجلات ثم اختر «فحص السجلات».</div></section>
63
  </section>
64
 
65
- <section id="intersections" class="view"><div class="section-heading"><div><p class="eyebrow">تداخل العينات</p><h1>التقاطعات بين المسوح</h1><p>السجلات التي يظهر لها أكثر من مسح فقط.</p></div></div><div id="intersectionMetrics" class="metrics compact"></div><div id="intersectionResults" class="results empty-state">يجري تحميل البيانات…</div></section>
 
 
 
 
 
 
 
 
 
66
  <section id="researchers" class="view"><div class="section-heading"><div><p class="eyebrow">المسؤوليات</p><h1>الباحثون</h1><p>ابحث باسم الباحث لعرض مؤشرات العينات والمسوح.</p></div><input id="researcherFilter" class="small-search" placeholder="ابحث باسم الباحث" /></div><div id="researcherResults" class="results"></div></section>
67
  <section id="surveys" class="view"><div class="section-heading"><div><p class="eyebrow">مصدر البيانات</p><h1>المسوح</h1><p>ملخص كل مسح محمّل في النظام.</p></div></div><div id="surveyResults" class="survey-grid"></div></section>
68
  </main>
 
36
 
37
  <main>
38
  <section id="home" class="view active">
39
+ <div class="hero"><div><p class="eyebrow">لوحة التحكم</p><h1>مؤشرات عينات المسوح</h1><p>ملخص المنشآت المشتركة بين المسوح واختلاف حالات استيفائها.</p></div></div>
40
  <div id="metrics" class="metrics dashboard-metrics" aria-label="مؤشرات لوحة التحكم"></div>
41
  <section id="dashboardDetails" class="dashboard-details empty-state">اختر إحدى البطاقات لعرض التفاصيل هنا.</section>
42
  </section>
 
62
  <section class="result-section"><div class="section-heading"><div><h2>نتائج الفحص</h2><p id="batchMeta">ستبقى السجلات غير الموجودة ظاهرة في النتائج والتصدير.</p></div><button id="btnExport" class="btn secondary" disabled>تحميل النتائج Excel</button></div><div id="batchResults" class="results empty-state">الصق قائمة السجلات ثم اختر «فحص السجلات».</div></section>
63
  </section>
64
 
65
+ <section id="intersections" class="view">
66
+ <div class="section-heading"><div><p class="eyebrow">تداخل العينات</p><h1>التقاطعات بين المسوح</h1><p>السجلات التي يظهر لها أكثر من مسح فقط.</p></div></div>
67
+ <div id="intersectionMetrics" class="metrics compact"></div>
68
+ <section aria-labelledby="surveyPairsHeading">
69
+ <div class="section-heading"><h2 id="surveyPairsHeading">المنشآت المشتركة حسب زوج المسوح</h2></div>
70
+ <div id="surveyPairs"></div>
71
+ </section>
72
+ <div class="section-heading"><h2>السجلات المتقاطعة</h2></div>
73
+ <div id="intersectionResults" class="results empty-state">يجري تحميل البيانات…</div>
74
+ </section>
75
  <section id="researchers" class="view"><div class="section-heading"><div><p class="eyebrow">المسؤوليات</p><h1>الباحثون</h1><p>ابحث باسم الباحث لعرض مؤشرات العينات والمسوح.</p></div><input id="researcherFilter" class="small-search" placeholder="ابحث باسم الباحث" /></div><div id="researcherResults" class="results"></div></section>
76
  <section id="surveys" class="view"><div class="section-heading"><div><p class="eyebrow">مصدر البيانات</p><h1>المسوح</h1><p>ملخص كل مسح محمّل في النظام.</p></div></div><div id="surveyResults" class="survey-grid"></div></section>
77
  </main>
script.js CHANGED
@@ -196,15 +196,11 @@ function toast(message) {
196
  }
197
 
198
  function renderMetrics() {
199
- const intersectionGroups = [...app.byRegister.entries()]
200
- .map(([register, rows]) => groupInfo({ key: `cr:${register}`, commercialRegister: register, rows }))
201
- .filter((group) => group.multiSurvey);
202
- const shared = intersectionGroups.length;
203
- const statusDifferenceGroups = intersectionGroups.filter((group) => new Set(group.rows.map((row) => plain(row.collectionStatus)).filter(Boolean)).size > 1);
204
  $("metrics").innerHTML = [
205
- metric(shared.toLocaleString("ar-SA"), "عدد التقاطعات", "intersections", "سجلات ظهرت في أكثر من مسح"),
206
- metric(statusDifferenceGroups.length.toLocaleString("ar-SA"), "اختلاف حالات الاستيفاء", "statuses", "اختلاف حالة المنشأة بين المسوح"),
207
- metric(shared.toLocaleString("ar-SA"), "المنشآت المتقاطعة", "establishments", "منشآت مشتركة قابلة للمراجعة"),
208
  ].join("");
209
  }
210
 
@@ -264,7 +260,7 @@ function renderDashboardDetail(type) {
264
  <div class="table-wrap compact-table"><table><thead><tr><th>الباحث</th><th>عدد الظهور في التقاطعات</th></tr></thead><tbody>${researchers.map(([name, count]) => `<tr>${td("الباحث", escapeHtml(name))}${td("عدد الظهور في التقاطعات", count.toLocaleString("ar-SA"))}</tr>`).join("")}</tbody></table></div>`;
265
  } else {
266
  const filtered = groups;
267
- const title = type === "establishments" ? "المنشآت المتقاطعة" : "تفاصيل التقاطعات";
268
  const subtitle = "السجلات التجارية التي ظهرت في أكثر من مسح.";
269
  panel.innerHTML = `${dashboardDetailHeader(title, subtitle)}
270
  <div class="table-wrap"><table><thead><tr><th>السجل التجاري</th><th>اسم المنشأة</th><th>عدد المسوح</th><th>المسوح</th><th>الباحثون</th></tr></thead><tbody>${filtered.slice(0, 50).map((group) => `<tr>${td("السجل التجاري", `<button class="row-button" data-entity="${escapeHtml(group.key)}">${escapeHtml(group.commercialRegister)}</button>`)}${td("اسم المنشأة", escapeHtml(group.name))}${td("عدد المسوح", group.surveys.length)}${td("المسوح", stackedList(group.surveys))}${td("الباحثون", stackedList(group.researchers))}</tr>`).join("")}</tbody></table></div>`;
@@ -373,11 +369,39 @@ function renderBatchTable(items) {
373
  }).join("")}</tbody></table></div>`;
374
  }
375
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
376
  function renderIntersections() {
377
- const groups = [...app.byRegister.entries()].map(([register, rows]) => groupInfo({ key: `cr:${register}`, commercialRegister: register, rows })).filter((group) => group.multiSurvey).sort((a, b) => b.surveys.length - a.surveys.length);
378
  const two = groups.filter((group) => group.surveys.length === 2).length;
379
  const three = groups.filter((group) => group.surveys.length >= 3).length;
380
  $("intersectionMetrics").innerHTML = [metric(groups.length, "منشآت مشتركة"), metric(two, "في مسحين"), metric(three, "في 3 مسوح أو أكثر"), metric(app.byRegister.size, "سجلات قابلة للمطابقة"), metric(app.surveys.size, "إجمالي المسوح")].join("");
 
381
  $("intersectionResults").className = "results";
382
  $("intersectionResults").innerHTML = groups.length ? `<div class="table-wrap"><table><thead><tr><th>السجل التجاري</th><th>اسم المنشأة</th><th>عدد المسوح</th><th>المسوح</th><th>الباحثون</th></tr></thead><tbody>${groups.slice(0, 200).map((group) => `<tr>${td("السجل التجاري", `<button class="row-button" data-entity="${escapeHtml(group.key)}">${escapeHtml(group.commercialRegister)}</button>`)}${td("اسم المنشأة", escapeHtml(group.name))}${td("عدد المسوح", group.surveys.length)}${td("المسوح", stackedList(group.surveys))}${td("الباحثون", stackedList(group.researchers))}</tr>`).join("")}</tbody></table></div>` : "<div class='empty-state'>لا توجد تقاطعات قابلة للحساب.</div>";
383
  }
 
196
  }
197
 
198
  function renderMetrics() {
199
+ const groups = intersectionGroups();
200
+ const statusDifferenceGroups = groups.filter((group) => new Set(group.rows.map((row) => plain(row.collectionStatus)).filter(Boolean)).size > 1);
 
 
 
201
  $("metrics").innerHTML = [
202
+ metric(groups.length.toLocaleString("ar-SA"), "المنشآت المتقاطعة", "establishments", "منشآت ظهرت في أكثر من مسح"),
203
+ metric(statusDifferenceGroups.length.toLocaleString("ar-SA"), "منشآت تختلف حالات استيفائها", "statuses", "اختلاف حالة المنشأة بين المسوح"),
 
204
  ].join("");
205
  }
206
 
 
260
  <div class="table-wrap compact-table"><table><thead><tr><th>الباحث</th><th>عدد الظهور في التقاطعات</th></tr></thead><tbody>${researchers.map(([name, count]) => `<tr>${td("الباحث", escapeHtml(name))}${td("عدد الظهور في التقاطعات", count.toLocaleString("ar-SA"))}</tr>`).join("")}</tbody></table></div>`;
261
  } else {
262
  const filtered = groups;
263
+ const title = "المنشآت المتقاطعة";
264
  const subtitle = "السجلات التجارية التي ظهرت في أكثر من مسح.";
265
  panel.innerHTML = `${dashboardDetailHeader(title, subtitle)}
266
  <div class="table-wrap"><table><thead><tr><th>السجل التجاري</th><th>اسم المنشأة</th><th>عدد المسوح</th><th>المسوح</th><th>الباحثون</th></tr></thead><tbody>${filtered.slice(0, 50).map((group) => `<tr>${td("السجل التجاري", `<button class="row-button" data-entity="${escapeHtml(group.key)}">${escapeHtml(group.commercialRegister)}</button>`)}${td("اسم المنشأة", escapeHtml(group.name))}${td("عدد المسوح", group.surveys.length)}${td("المسوح", stackedList(group.surveys))}${td("الباحثون", stackedList(group.researchers))}</tr>`).join("")}</tbody></table></div>`;
 
369
  }).join("")}</tbody></table></div>`;
370
  }
371
 
372
+ function renderSurveyPairs(groups) {
373
+ const names = [...app.surveys.keys()].sort((a, b) => a.localeCompare(b, "ar"));
374
+ const registerSurveys = groups.map((group) => new Set(group.surveys));
375
+ const pairs = names.flatMap((first, index) => names.slice(index + 1).map((second) => ({
376
+ first,
377
+ second,
378
+ count: registerSurveys.filter((surveys) => surveys.has(first) && surveys.has(second)).length,
379
+ }))).sort((a, b) => b.count - a.count);
380
+
381
+ if (!pairs.length) {
382
+ $("surveyPairs").innerHTML = "<div class='empty-state'>تتطلب المقارنة وجود مسحين على الأقل.</div>";
383
+ return;
384
+ }
385
+
386
+ const rows = pairs.map(({ first, second, count }) => `<tr>
387
+ ${td("المسح الأول", escapeHtml(first))}
388
+ ${td("المسح الثاني", escapeHtml(second))}
389
+ ${td("المنشآت المشتركة", count.toLocaleString("ar-SA"))}
390
+ </tr>`).join("");
391
+ $("surveyPairs").innerHTML = `<div class="table-wrap compact-table survey-pairs-table">
392
+ <table aria-labelledby="surveyPairsHeading">
393
+ <thead><tr><th scope="col">المسح الأول</th><th scope="col">المسح الثاني</th><th scope="col">المنشآت المشتركة</th></tr></thead>
394
+ <tbody>${rows}</tbody>
395
+ </table>
396
+ </div>`;
397
+ }
398
+
399
  function renderIntersections() {
400
+ const groups = intersectionGroups();
401
  const two = groups.filter((group) => group.surveys.length === 2).length;
402
  const three = groups.filter((group) => group.surveys.length >= 3).length;
403
  $("intersectionMetrics").innerHTML = [metric(groups.length, "منشآت مشتركة"), metric(two, "في مسحين"), metric(three, "في 3 مسوح أو أكثر"), metric(app.byRegister.size, "سجلات قابلة للمطابقة"), metric(app.surveys.size, "إجمالي المسوح")].join("");
404
+ renderSurveyPairs(groups);
405
  $("intersectionResults").className = "results";
406
  $("intersectionResults").innerHTML = groups.length ? `<div class="table-wrap"><table><thead><tr><th>السجل التجاري</th><th>اسم المنشأة</th><th>عدد المسوح</th><th>المسوح</th><th>الباحثون</th></tr></thead><tbody>${groups.slice(0, 200).map((group) => `<tr>${td("السجل التجاري", `<button class="row-button" data-entity="${escapeHtml(group.key)}">${escapeHtml(group.commercialRegister)}</button>`)}${td("اسم المنشأة", escapeHtml(group.name))}${td("عدد المسوح", group.surveys.length)}${td("المسوح", stackedList(group.surveys))}${td("الباحثون", stackedList(group.researchers))}</tr>`).join("")}</tbody></table></div>` : "<div class='empty-state'>لا توجد تقاطعات قابلة للحساب.</div>";
407
  }
style.css CHANGED
@@ -60,13 +60,12 @@ input:focus,textarea:focus{border-color:rgba(29,154,138,.65);box-shadow:0 0 0 4p
60
  .metric b{font-size:23px;display:block;color:var(--primary);margin-bottom:3px}
61
  .metric span{color:var(--muted);font-size:12px}
62
  .metric small{display:block;margin-top:8px;color:#526a84;font-size:12.5px;line-height:1.6}
63
- .dashboard-metrics{grid-template-columns:repeat(3,1fr);gap:16px;margin-top:28px}
64
  .dashboard-metrics .metric{min-height:126px;display:flex;flex-direction:column;justify-content:center;text-align:center;padding:22px 20px;border-radius:18px;background:linear-gradient(180deg,#fff 0%,#f9fcff 100%)}
65
  .dashboard-metrics .metric b{font-size:36px;line-height:1;color:var(--primary-dark)}
66
  .dashboard-metrics .metric span{margin-top:7px;color:var(--primary);font-size:14px;font-weight:950}
67
  .dashboard-metrics .metric:nth-child(1):before{background:linear-gradient(90deg,var(--primary-dark),var(--primary-2))}
68
  .dashboard-metrics .metric:nth-child(2):before{background:linear-gradient(90deg,var(--teal),var(--green))}
69
- .dashboard-metrics .metric:nth-child(3):before{background:linear-gradient(90deg,#245a86,var(--cyan))}
70
  .metric-action{cursor:pointer;transition:transform .15s ease,box-shadow .2s ease,border-color .2s ease}
71
  .metric-action:after{content:"عرض التفاصيل";align-self:center;display:inline-flex;margin-top:12px;padding:5px 12px;border-radius:999px;background:#eefaf7;color:#087b70;font-size:12px;font-weight:950}
72
  .metric-action:hover,.metric-action:focus{transform:translateY(-3px);box-shadow:0 26px 58px rgba(18,51,86,.16);border-color:rgba(29,154,138,.45);outline:none}
@@ -132,6 +131,8 @@ td:nth-child(2),td:nth-child(5){max-width:380px;white-space:normal}
132
  .mini-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:10px}
133
  .status-cloud{gap:8px}
134
  .compact-table table{min-width:700px}
 
 
135
  .login-gate{position:fixed;inset:0;z-index:50;display:grid;place-items:center;padding:22px;background:linear-gradient(135deg,rgba(31,63,135,.96),rgba(29,154,138,.94) 58%,rgba(98,184,70,.9))}
136
  .login-gate.hidden{opacity:0;pointer-events:none;transition:opacity .25s ease}
137
  .login-card{width:min(420px,92vw);background:rgba(255,255,255,.96);border:1px solid rgba(255,255,255,.75);border-radius:24px;padding:30px;box-shadow:0 30px 80px rgba(0,0,0,.22);text-align:center}
 
60
  .metric b{font-size:23px;display:block;color:var(--primary);margin-bottom:3px}
61
  .metric span{color:var(--muted);font-size:12px}
62
  .metric small{display:block;margin-top:8px;color:#526a84;font-size:12.5px;line-height:1.6}
63
+ .dashboard-metrics{grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;margin-top:28px}
64
  .dashboard-metrics .metric{min-height:126px;display:flex;flex-direction:column;justify-content:center;text-align:center;padding:22px 20px;border-radius:18px;background:linear-gradient(180deg,#fff 0%,#f9fcff 100%)}
65
  .dashboard-metrics .metric b{font-size:36px;line-height:1;color:var(--primary-dark)}
66
  .dashboard-metrics .metric span{margin-top:7px;color:var(--primary);font-size:14px;font-weight:950}
67
  .dashboard-metrics .metric:nth-child(1):before{background:linear-gradient(90deg,var(--primary-dark),var(--primary-2))}
68
  .dashboard-metrics .metric:nth-child(2):before{background:linear-gradient(90deg,var(--teal),var(--green))}
 
69
  .metric-action{cursor:pointer;transition:transform .15s ease,box-shadow .2s ease,border-color .2s ease}
70
  .metric-action:after{content:"عرض التفاصيل";align-self:center;display:inline-flex;margin-top:12px;padding:5px 12px;border-radius:999px;background:#eefaf7;color:#087b70;font-size:12px;font-weight:950}
71
  .metric-action:hover,.metric-action:focus{transform:translateY(-3px);box-shadow:0 26px 58px rgba(18,51,86,.16);border-color:rgba(29,154,138,.45);outline:none}
 
131
  .mini-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:10px}
132
  .status-cloud{gap:8px}
133
  .compact-table table{min-width:700px}
134
+ .survey-pairs-table table{min-width:0}
135
+ .survey-pairs-table td:first-child{white-space:normal}
136
  .login-gate{position:fixed;inset:0;z-index:50;display:grid;place-items:center;padding:22px;background:linear-gradient(135deg,rgba(31,63,135,.96),rgba(29,154,138,.94) 58%,rgba(98,184,70,.9))}
137
  .login-gate.hidden{opacity:0;pointer-events:none;transition:opacity .25s ease}
138
  .login-card{width:min(420px,92vw);background:rgba(255,255,255,.96);border:1px solid rgba(255,255,255,.75);border-radius:24px;padding:30px;box-shadow:0 30px 80px rgba(0,0,0,.22);text-align:center}