<?php require __DIR__ . '/../../layouts/header.php'; $page_title = trans('suggest_reviewers'); ?>

<div class="d-flex justify-content-between align-items-center flex-wrap gap-2 mb-3">
  <h3 class="mb-0"><i class="fa-solid fa-wand-magic-sparkles me-2"></i><?= e(trans('suggest_reviewers')) ?></h3>
  <a class="btn btn-outline-secondary btn-rounded" href="<?= e(base_path('admin/decision-board?conference_id='.(int)$sub['conference_id'].'&round_no='.(int)$round_no)) ?>">
    <i class="fa-solid fa-arrow-left me-2"></i><?= e(trans('back')) ?>
  </a>
</div>

<div class="card shadow-sm border-0 mb-3">
  <div class="card-body">
    <div class="fw-bold"><?= e((string)($sub['submission_no']??'')) ?> — <?= e((string)($sub['title']??'')) ?></div>
    <div class="small text-muted mt-1">
      KW: <?= e((string)($sub['keywords']??'')) ?> <?= !empty($sub['keywords_ar']) ? ' | '.e((string)$sub['keywords_ar']) : '' ?>
    </div>
  </div>
</div>

<div class="card shadow-sm border-0">
  <div class="card-body">
    <div class="table-responsive">
      <table class="table table-hover align-middle mb-0">
        <thead><tr><th>#</th><th>Reviewer</th><th>Rating</th><th>Expertise</th><th>Assigned?</th></tr></thead>
        <tbody>
          <?php foreach ($rows as $r): ?>
            <tr>
              <td><?= e((string)$r['id']) ?></td>
              <td><?= e(trim((string)$r['first_name'].' '.(string)$r['last_name'])) ?><div class="small text-muted"><?= e((string)$r['email']) ?></div></td>
              <td><span class="badge bg-secondary"><?= e((string)$r['admin_rating']) ?></span></td>
              <td class="small text-muted"><?= e((string)$r['expertise_keywords']) ?></td>
              <td>
                <?php if (in_array((int)$r['id'], $assigned, true)): ?>
                  <span class="badge bg-success">YES</span>
                <?php else: ?>
                  <span class="badge bg-warning">NO</span>
                <?php endif; ?>
              </td>
            </tr>
          <?php endforeach; ?>
          <?php if (empty($rows)): ?><tr><td colspan="5" class="text-center text-muted py-4"><?= e(trans('no_data')) ?></td></tr><?php endif; ?>
        </tbody>
      </table>
    </div>
  </div>
</div>

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