Commit e3fe1525 authored by Mahmoud Aglan's avatar Mahmoud Aglan

fix(manager): console counts read NaN; public pages show the Arabic name

- The judge's console attendance panel showed NaN until its first poll:
  app.js animates every [data-count] element as a number, and the panel
  used data-count for the field names. It uses data-tally now.
- The live pages, their titles and share text, and the tournament page
  header show the Arabic name when there is one.
Co-Authored-By: 's avatarClaude Opus 5.5 <noreply@anthropic.com>
parent 76a7982f
......@@ -398,6 +398,10 @@ class LiveTournamentsController
return null;
}
// The public pages speak Arabic first: the Arabic name when there is
// one (the latin one stays as name_en).
$tournament['name_en'] = $tournament['name'] ?? '';
if (trim((string)($tournament['name_ar'] ?? '')) !== '') $tournament['name'] = $tournament['name_ar'];
return $tournament;
}
......
......@@ -118,7 +118,7 @@
].filter(([k]) => k === 'total' || s[k]).map(([k, l, b]) => `<span class="badge ${b}" data-sum="${k}">${l} <span class="tabular-nums">${num(s[k] || 0)}</span></span>`).join('');
body.innerHTML = (data.boards || []).length ? data.boards.map(row).join('') : '<tr><td colspan="8" class="text-muted text-sm">مفيش بوردات في الجولة دي.</td></tr>';
const c = data.counts || {};
document.querySelectorAll('#checkInPanel [data-count]').forEach((el) => { if (c[el.dataset.count] != null) el.textContent = num(c[el.dataset.count]); });
document.querySelectorAll('#checkInPanel [data-tally]').forEach((el) => { if (c[el.dataset.tally] != null) el.textContent = num(c[el.dataset.tally]); });
const od = document.querySelector('[data-open-disputes]');
if (od) od.textContent = `${num(data.open_disputes || 0)} مفتوح`;
if ((data.open_disputes || 0) > lastOpenDisputes) document.querySelector('[data-reload]')?.classList.remove('hidden');
......
......@@ -86,12 +86,12 @@ require MODULES_PATH . '/tournament-teams/views/_head.php';
<div class="card" id="checkInPanel">
<div class="card-header"><h3 class="card-title">الحضور</h3><?php if ($counts['required']): ?><span class="badge badge-sm badge-info">تأكيد الحضور مطلوب</span><?php endif; ?></div>
<div class="grid grid-3 arb-counts">
<div><div class="text-xs text-muted">مسجلين</div><div class="text-xl font-bold tabular-nums" data-count="registered"><?= (int)$counts['registered'] ?></div></div>
<div><div class="text-xs text-muted">أكدوا</div><div class="text-xl font-bold tabular-nums text-success" data-count="checked_in"><?= (int)$counts['checked_in'] ?></div></div>
<div><div class="text-xs text-muted">لسه</div><div class="text-xl font-bold tabular-nums" data-count="not_checked_in"><?= (int)$counts['not_checked_in'] ?></div></div>
<div><div class="text-xs text-muted">انتظار</div><div class="text-lg tabular-nums" data-count="waitlisted"><?= (int)$counts['waitlisted'] ?></div></div>
<div><div class="text-xs text-muted">مستني موافقة</div><div class="text-lg tabular-nums" data-count="pending"><?= (int)$counts['pending'] ?></div></div>
<div><div class="text-xs text-muted">غاب</div><div class="text-lg tabular-nums text-danger" data-count="no_show"><?= (int)$counts['no_show'] ?></div></div>
<div><div class="text-xs text-muted">مسجلين</div><div class="text-xl font-bold tabular-nums" data-tally="registered"><?= (int)$counts['registered'] ?></div></div>
<div><div class="text-xs text-muted">أكدوا</div><div class="text-xl font-bold tabular-nums text-success" data-tally="checked_in"><?= (int)$counts['checked_in'] ?></div></div>
<div><div class="text-xs text-muted">لسه</div><div class="text-xl font-bold tabular-nums" data-tally="not_checked_in"><?= (int)$counts['not_checked_in'] ?></div></div>
<div><div class="text-xs text-muted">انتظار</div><div class="text-lg tabular-nums" data-tally="waitlisted"><?= (int)$counts['waitlisted'] ?></div></div>
<div><div class="text-xs text-muted">مستني موافقة</div><div class="text-lg tabular-nums" data-tally="pending"><?= (int)$counts['pending'] ?></div></div>
<div><div class="text-xs text-muted">غاب</div><div class="text-lg tabular-nums text-danger" data-tally="no_show"><?= (int)$counts['no_show'] ?></div></div>
</div>
<form method="POST" action="/tournaments/<?= $tid ?>/console/check-in" class="flex gap-2 mt-4 items-end">
<input type="hidden" name="_csrf" value="<?= $csrf ?>">
......
......@@ -162,7 +162,7 @@ class TournamentsController
}
$plannedRounds = $this->plannedTotal($tournament, $phases);
$pageTitle = $tournament['name'];
$pageTitle = ($tournament['name_ar'] ?? '') ?: $tournament['name'];
$moduleCSS = 'tournaments';
$moduleJS = 'tournaments';
......
......@@ -71,7 +71,7 @@ foreach ([
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="9 18 15 12 9 6"/></svg>
</a>
<div>
<h1><?= View::e($tournament['name']) ?></h1>
<h1><?= View::e(($tournament['name_ar'] ?? '') ?: $tournament['name']) ?></h1>
<div class="flex gap-2 mt-1">
<span class="badge <?= $s[1] ?>"><?= $s[0] ?></span>
<?php if ($isMultiPhase || count($phases) > 1): ?>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment