<?php require __DIR__ . '/../../layouts/header.php'; $lang=current_lang(); ?>
<?php $t=fn($ar,$en)=>($lang==='ar'?$ar:$en); $rows=$rows??[]; $table=$table??''; ?>

<div class="container py-3">
  <div class="d-flex justify-content-between align-items-center mb-3">
    <h4 class="mb-0"><i class="fa-solid fa-users-gear"></i> <?= e($t('إدارة الرؤساء/المنسقين','Chairs Management')) ?></h4>
    <span class="badge bg-secondary"><?= e($t('المصدر','Source')) ?>: <?= e($table) ?></span>
  </div>

  <div class="card border-0 shadow-sm">
    <div class="table-responsive">
      <table class="table table-hover mb-0">
        <thead class="table-light">
          <tr>
            <th>#</th>
            <th><?= e($t('المؤتمر','Conference')) ?></th>
            <th><?= e($t('الاسم','Name')) ?></th>
            <th><?= e($t('الدور','Role')) ?></th>
          </tr>
        </thead>
        <tbody>
          <?php foreach($rows as $r): ?>
            <tr>
              <td class="text-muted"><?= e((string)($r['id'] ?? '')) ?></td>
              <td><?= e((string)($lang==='ar' ? ($r['conf_title_ar'] ?? '') : ($r['conf_title_en'] ?? ''))) ?></td>
              <td><?= e((string)($r['name'] ?? $r['full_name'] ?? $r['member_name'] ?? $r['person_name'] ?? '—')) ?></td>
              <td><?= e((string)($r['role'] ?? $r['role_name'] ?? $r['position'] ?? '—')) ?></td>
            </tr>
          <?php endforeach; ?>
          <?php if(empty($rows)): ?><tr><td colspan="4" class="text-center text-muted py-4">—</td></tr><?php endif; ?>
        </tbody>
      </table>
    </div>
  </div>
</div>

<?php require __DIR__ . '/../../layouts/footer.php'; ?>
