stat2025 commited on
Commit
59856af
·
verified ·
1 Parent(s): 0211fb5

Upload 6 files

Browse files
Files changed (3) hide show
  1. app.js +10 -15
  2. index.html +1 -5
  3. style.css +175 -41
app.js CHANGED
@@ -22,8 +22,6 @@ const noResults = document.getElementById("noResults");
22
  const loadMoreWrap = document.getElementById("loadMoreWrap");
23
  const loadMoreButton = document.getElementById("loadMoreButton");
24
  const loadMoreMeta = document.getElementById("loadMoreMeta");
25
- const totalCounter = document.getElementById("totalCounter");
26
- const regionStats = document.getElementById("regionStats");
27
  const toast = document.getElementById("toast");
28
 
29
  const PAGE_SIZE = 24;
@@ -174,6 +172,14 @@ function isCoordinate(value) {
174
  return /^[-+]?\d{1,2}(?:\.\d+)?\s*,\s*[-+]?\d{1,3}(?:\.\d+)?$/.test(String(value ?? "").trim());
175
  }
176
 
 
 
 
 
 
 
 
 
177
  function createSvgIcon(path) {
178
  const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
179
  svg.setAttribute("viewBox", "0 0 24 24");
@@ -328,14 +334,14 @@ function applyFilters() {
328
  return matchesRegion && matchesCity;
329
  });
330
 
331
- visibleRows = scopedRows.filter((row) => {
332
  if (!query) return Boolean(city || region);
333
  return (
334
  normalize(row.establishmentName).includes(query) ||
335
  normalize(row.commercialRecord).includes(query) ||
336
  normalize(row.cityClarification).includes(query)
337
  );
338
- });
339
 
340
  const shouldShow = visibleRows.length > 0 || city || region || query;
341
  emptyState.hidden = shouldShow;
@@ -349,7 +355,6 @@ function applyFilters() {
349
 
350
  function initializeDashboard(data) {
351
  rows = data.rows || [];
352
- totalCounter.textContent = `${rows.length} منشأة`;
353
  const regions = data.regions || uniqueSorted(rows.map((row) => row.region));
354
  setOptions(regionSelect, regions, "اختر المنطقة");
355
  const regionCounts = new Map();
@@ -371,16 +376,6 @@ function initializeDashboard(data) {
371
  return button;
372
  }),
373
  );
374
- regionStats.replaceChildren(
375
- ...regions.map((region) => {
376
- const chip = document.createElement("button");
377
- chip.type = "button";
378
- chip.className = "region-stat";
379
- chip.innerHTML = `<span>${region}</span><strong>${regionCounts.get(region) || 0}</strong>`;
380
- chip.addEventListener("click", () => setRegion(region, true));
381
- return chip;
382
- }),
383
- );
384
  setOptions(citySelect, [], "اختر المدينة الصناعية");
385
  citySelect.disabled = true;
386
  restoreFilterState();
 
22
  const loadMoreWrap = document.getElementById("loadMoreWrap");
23
  const loadMoreButton = document.getElementById("loadMoreButton");
24
  const loadMoreMeta = document.getElementById("loadMoreMeta");
 
 
25
  const toast = document.getElementById("toast");
26
 
27
  const PAGE_SIZE = 24;
 
172
  return /^[-+]?\d{1,2}(?:\.\d+)?\s*,\s*[-+]?\d{1,3}(?:\.\d+)?$/.test(String(value ?? "").trim());
173
  }
174
 
175
+ function hasLocationInfo(row) {
176
+ return Boolean(String(row.coordinates ?? "").trim());
177
+ }
178
+
179
+ function sortRowsByLocationInfo(items) {
180
+ return [...items].sort((a, b) => Number(hasLocationInfo(b)) - Number(hasLocationInfo(a)));
181
+ }
182
+
183
  function createSvgIcon(path) {
184
  const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
185
  svg.setAttribute("viewBox", "0 0 24 24");
 
334
  return matchesRegion && matchesCity;
335
  });
336
 
337
+ visibleRows = sortRowsByLocationInfo(scopedRows.filter((row) => {
338
  if (!query) return Boolean(city || region);
339
  return (
340
  normalize(row.establishmentName).includes(query) ||
341
  normalize(row.commercialRecord).includes(query) ||
342
  normalize(row.cityClarification).includes(query)
343
  );
344
+ }));
345
 
346
  const shouldShow = visibleRows.length > 0 || city || region || query;
347
  emptyState.hidden = shouldShow;
 
355
 
356
  function initializeDashboard(data) {
357
  rows = data.rows || [];
 
358
  const regions = data.regions || uniqueSorted(rows.map((row) => row.region));
359
  setOptions(regionSelect, regions, "اختر المنطقة");
360
  const regionCounts = new Map();
 
376
  return button;
377
  }),
378
  );
 
 
 
 
 
 
 
 
 
 
379
  setOptions(citySelect, [], "اختر المدينة الصناعية");
380
  citySelect.disabled = true;
381
  restoreFilterState();
index.html CHANGED
@@ -3,7 +3,7 @@
3
  <head>
4
  <meta charset="UTF-8" />
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <meta name="theme-color" content="#0f4c5c" />
7
  <meta name="robots" content="noindex, nofollow" />
8
  <title>شاشة استعلام</title>
9
  <link rel="preconnect" href="https://fonts.googleapis.com" />
@@ -63,10 +63,6 @@
63
  <p class="eyebrow">لوحة الاستعلام</p>
64
  <h2>اختر المنطقة والمدينة الصناعية أو ابحث باسم المنشأة مباشرة</h2>
65
  </div>
66
- <div class="summary-side">
67
- <div id="totalCounter" class="counter-pill">0 منشأة</div>
68
- <div id="regionStats" class="region-stats" aria-label="ملخص المناطق"></div>
69
- </div>
70
  </section>
71
 
72
  <section class="controls-panel">
 
3
  <head>
4
  <meta charset="UTF-8" />
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <meta name="theme-color" content="#4137A8" />
7
  <meta name="robots" content="noindex, nofollow" />
8
  <title>شاشة استعلام</title>
9
  <link rel="preconnect" href="https://fonts.googleapis.com" />
 
63
  <p class="eyebrow">لوحة الاستعلام</p>
64
  <h2>اختر المنطقة والمدينة الصناعية أو ابحث باسم المنشأة مباشرة</h2>
65
  </div>
 
 
 
 
66
  </section>
67
 
68
  <section class="controls-panel">
style.css CHANGED
@@ -1,17 +1,20 @@
1
  :root {
2
- --ink: #1d2935;
3
- --muted: #667789;
4
- --line: #d9e3e8;
5
- --page: #f4f7f8;
6
  --surface: #ffffff;
7
- --primary: #0f4c5c;
8
- --primary-dark: #0a3440;
9
- --accent: #1b8a6b;
10
- --accent-soft: #e6f5ef;
11
- --warning: #8a5a13;
12
- --warning-soft: #fff5df;
13
- --danger: #b43d4f;
14
- --shadow: 0 10px 28px rgba(28, 53, 68, 0.08);
 
 
 
15
  }
16
 
17
  * {
@@ -285,10 +288,11 @@ p {
285
  .summary-panel {
286
  display: flex;
287
  align-items: center;
288
- justify-content: space-between;
289
  gap: 18px;
290
- padding: 22px;
291
  border-top: 4px solid var(--primary);
 
292
  }
293
 
294
  .summary-panel h2 {
@@ -540,7 +544,7 @@ select:disabled {
540
  }
541
 
542
  .map-detail::before {
543
- background: #168a5b;
544
  }
545
 
546
  .statement-detail {
@@ -549,7 +553,7 @@ select:disabled {
549
  }
550
 
551
  .statement-detail::before {
552
- background: #227997;
553
  }
554
 
555
  .map-detail .detail-label,
@@ -563,23 +567,23 @@ select:disabled {
563
  }
564
 
565
  .map-detail .detail-label {
566
- color: #116343;
567
  background: #dff4e9;
568
  }
569
 
570
  .statement-detail .detail-label {
571
- color: #17647d;
572
  background: #dff0f6;
573
  }
574
 
575
  .map-detail .action-link {
576
- color: #116343;
577
  background: #ffffff;
578
  border-color: #b7e3ca;
579
  }
580
 
581
  .statement-detail .action-link {
582
- color: #17647d;
583
  background: #ffffff;
584
  border-color: #bddce8;
585
  }
@@ -844,32 +848,26 @@ select:focus-visible {
844
  }
845
 
846
  .summary-panel {
847
- align-items: stretch;
848
- min-height: 150px;
849
  padding: 24px;
850
  border-top: 0;
851
- border-right: 5px solid var(--primary);
 
852
  }
853
 
854
  .summary-copy {
855
  display: flex;
856
  flex-direction: column;
857
  justify-content: center;
 
858
  min-width: 0;
 
859
  }
860
 
861
  .summary-panel h2 {
862
- max-width: 760px;
863
- font-size: 27px;
864
- }
865
-
866
- .summary-side {
867
- flex: 0 0 min(380px, 42%);
868
- display: flex;
869
- flex-direction: column;
870
- justify-content: center;
871
- gap: 12px;
872
- min-width: 280px;
873
  }
874
 
875
  .counter-pill {
@@ -1027,12 +1025,6 @@ select:focus-visible {
1027
  flex-direction: column;
1028
  }
1029
 
1030
- .summary-side {
1031
- flex-basis: auto;
1032
- width: 100%;
1033
- min-width: 0;
1034
- }
1035
-
1036
  .controls-panel {
1037
  position: static;
1038
  }
@@ -1055,7 +1047,7 @@ select:focus-visible {
1055
  .summary-panel {
1056
  min-height: auto;
1057
  padding: 18px;
1058
- border-right-width: 4px;
1059
  }
1060
 
1061
  .summary-panel h2 {
@@ -1281,3 +1273,145 @@ select:focus-visible {
1281
  min-height: 48px;
1282
  }
1283
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  :root {
2
+ --ink: #1CADE4;
3
+ --muted: #5C6E88;
4
+ --line: #d7e2ee;
5
+ --page: #f5f8fb;
6
  --surface: #ffffff;
7
+ --primary: #4137A8;
8
+ --primary-dark: #1CADE4;
9
+ --accent: #00B050;
10
+ --accent-soft: #e8f8f0;
11
+ --accent-alt: #42BA97;
12
+ --info: #27CED7;
13
+ --purple: #7030A0;
14
+ --warning: #5C6E88;
15
+ --warning-soft: #fff7d1;
16
+ --danger: #F5544A;
17
+ --shadow: 0 10px 28px rgba(92, 110, 136, 0.11);
18
  }
19
 
20
  * {
 
288
  .summary-panel {
289
  display: flex;
290
  align-items: center;
291
+ justify-content: center;
292
  gap: 18px;
293
+ padding: 28px 24px;
294
  border-top: 4px solid var(--primary);
295
+ text-align: center;
296
  }
297
 
298
  .summary-panel h2 {
 
544
  }
545
 
546
  .map-detail::before {
547
+ background: var(--accent);
548
  }
549
 
550
  .statement-detail {
 
553
  }
554
 
555
  .statement-detail::before {
556
+ background: var(--info);
557
  }
558
 
559
  .map-detail .detail-label,
 
567
  }
568
 
569
  .map-detail .detail-label {
570
+ color: var(--primary-dark);
571
  background: #dff4e9;
572
  }
573
 
574
  .statement-detail .detail-label {
575
+ color: var(--primary-dark);
576
  background: #dff0f6;
577
  }
578
 
579
  .map-detail .action-link {
580
+ color: var(--primary-dark);
581
  background: #ffffff;
582
  border-color: #b7e3ca;
583
  }
584
 
585
  .statement-detail .action-link {
586
+ color: var(--primary-dark);
587
  background: #ffffff;
588
  border-color: #bddce8;
589
  }
 
848
  }
849
 
850
  .summary-panel {
851
+ align-items: center;
852
+ min-height: 128px;
853
  padding: 24px;
854
  border-top: 0;
855
+ border-right: 0;
856
+ border-bottom: 4px solid var(--primary);
857
  }
858
 
859
  .summary-copy {
860
  display: flex;
861
  flex-direction: column;
862
  justify-content: center;
863
+ align-items: center;
864
  min-width: 0;
865
+ width: 100%;
866
  }
867
 
868
  .summary-panel h2 {
869
+ max-width: 820px;
870
+ font-size: 28px;
 
 
 
 
 
 
 
 
 
871
  }
872
 
873
  .counter-pill {
 
1025
  flex-direction: column;
1026
  }
1027
 
 
 
 
 
 
 
1028
  .controls-panel {
1029
  position: static;
1030
  }
 
1047
  .summary-panel {
1048
  min-height: auto;
1049
  padding: 18px;
1050
+ border-bottom-width: 4px;
1051
  }
1052
 
1053
  .summary-panel h2 {
 
1273
  min-height: 48px;
1274
  }
1275
  }
1276
+
1277
+ /* Identity color system */
1278
+ body {
1279
+ background:
1280
+ linear-gradient(180deg, rgba(65, 55, 168, 0.07) 0, rgba(65, 55, 168, 0) 260px),
1281
+ linear-gradient(180deg, #fbfcfd 0%, var(--page) 100%);
1282
+ }
1283
+
1284
+ .eyebrow,
1285
+ .results-meta,
1286
+ .sample-index {
1287
+ color: var(--accent);
1288
+ }
1289
+
1290
+ .login-card::before {
1291
+ background: linear-gradient(90deg, var(--accent), var(--primary));
1292
+ }
1293
+
1294
+ .brand-mark,
1295
+ .primary-button,
1296
+ .region-choice.active {
1297
+ background: linear-gradient(145deg, var(--primary), var(--primary-dark));
1298
+ }
1299
+
1300
+ .primary-button:hover,
1301
+ .action-link:hover,
1302
+ .secondary-button:hover {
1303
+ background: var(--primary-dark);
1304
+ border-color: var(--primary-dark);
1305
+ }
1306
+
1307
+ .topbar {
1308
+ border-bottom-color: rgba(92, 110, 136, 0.18);
1309
+ }
1310
+
1311
+ .summary-panel {
1312
+ border-bottom-color: var(--primary);
1313
+ }
1314
+
1315
+ .sample-card-header {
1316
+ border-right-color: var(--accent);
1317
+ }
1318
+
1319
+ .status-badge {
1320
+ color: #5C6E88;
1321
+ background: #fff4bf;
1322
+ border-color: #FFC000;
1323
+ }
1324
+
1325
+ .map-detail {
1326
+ background: rgba(0, 176, 80, 0.08);
1327
+ border-color: rgba(0, 176, 80, 0.28) !important;
1328
+ }
1329
+
1330
+ .map-detail::before {
1331
+ background: var(--accent);
1332
+ }
1333
+
1334
+ .map-detail .detail-label {
1335
+ color: #1CADE4;
1336
+ background: rgba(0, 176, 80, 0.13);
1337
+ }
1338
+
1339
+ .map-detail .action-link {
1340
+ color: #1CADE4;
1341
+ border-color: rgba(0, 176, 80, 0.32);
1342
+ }
1343
+
1344
+ .statement-detail {
1345
+ background: rgba(39, 206, 215, 0.1);
1346
+ border-color: rgba(39, 206, 215, 0.35) !important;
1347
+ }
1348
+
1349
+ .statement-detail::before {
1350
+ background: var(--info);
1351
+ }
1352
+
1353
+ .statement-detail .detail-label {
1354
+ color: #1CADE4;
1355
+ background: rgba(39, 206, 215, 0.16);
1356
+ }
1357
+
1358
+ .statement-detail .action-link {
1359
+ color: #1CADE4;
1360
+ border-color: rgba(39, 206, 215, 0.42);
1361
+ }
1362
+
1363
+ .action-link,
1364
+ .secondary-button,
1365
+ .clear-filters-button {
1366
+ color: var(--primary-dark);
1367
+ background: #ffffff;
1368
+ border-color: rgba(39, 206, 215, 0.34);
1369
+ }
1370
+
1371
+ .clear-filters-button:hover {
1372
+ color: #ffffff;
1373
+ background: var(--danger);
1374
+ border-color: var(--danger);
1375
+ }
1376
+
1377
+ .region-choice {
1378
+ color: var(--primary-dark);
1379
+ border-color: rgba(39, 206, 215, 0.28);
1380
+ }
1381
+
1382
+ .region-choice:hover {
1383
+ background: rgba(39, 206, 215, 0.08);
1384
+ border-color: var(--info);
1385
+ }
1386
+
1387
+ .region-choice strong,
1388
+ .region-choice.active strong {
1389
+ color: var(--primary-dark);
1390
+ background: rgba(0, 176, 80, 0.14);
1391
+ }
1392
+
1393
+ .region-choice.active {
1394
+ color: #ffffff;
1395
+ }
1396
+
1397
+ .region-choice.active strong {
1398
+ background: #ffffff;
1399
+ }
1400
+
1401
+ .password-field input:focus,
1402
+ .search-wrap input:focus,
1403
+ .select-wrap select:focus {
1404
+ border-color: var(--primary);
1405
+ box-shadow: 0 0 0 3px rgba(65, 55, 168, 0.13);
1406
+ }
1407
+
1408
+ button:focus-visible,
1409
+ a:focus-visible,
1410
+ input:focus-visible,
1411
+ select:focus-visible {
1412
+ outline-color: rgba(65, 55, 168, 0.28);
1413
+ }
1414
+
1415
+ .toast {
1416
+ background: var(--primary-dark);
1417
+ }