<?php $this->load->view('templates/header'); ?>
<?php $this->load->view('templates/sidebar'); ?>
<?php $this->load->view('templates/topbar'); ?>

<div class="container-fluid">
  <h1 class="h3 mb-4 text-gray-800"><?= $title; ?></h1>

  <div class="card shadow mb-4">
    <div class="card-body">
      <div class="table-responsive">
        <table class="table table-bordered" width="100%" cellspacing="0">
  <thead>
    <tr>
      <th>User ID</th>
      <th>Nama Lengkap</th>
      <th>Email</th>
      <th>No HP</th>
      <th>LPK</th>
      <th>Tanggal Daftar</th>
      <th>Status</th>
      <th>Aksi</th>
    </tr>
  </thead>
  <tbody>
    <?php if (!empty($calon_siswa)): ?>
      <?php foreach ($calon_siswa as $s): ?>
      <tr>
        <td><?= $s->UserID; ?></td>
        <td><?= $s->NamaLengkap; ?></td>
        <td><?= $s->Email; ?></td>
        <td><?= $s->Phone; ?></td>
        <td><?= $s->NamaLPK; ?></td>
        <td><?= date('d-m-Y H:i', strtotime($s->CreatedAt)); ?></td>
        <td><span class="badge badge-warning"><?= $s->NamaStatus; ?></span></td>
        <td>
          <a href="<?= base_url('siswa/detail_calon_lain/'.$s->UserID); ?>" class="btn btn-sm btn-info">Detail</a>
          <a href="<?= base_url('siswa/approve/'.$s->UserID); ?>" class="btn btn-sm btn-success">Approve</a>
          <a href="<?= base_url('siswa/reject/'.$s->UserID); ?>" class="btn btn-sm btn-danger">Tolak</a>
        </td>
      </tr>
      <?php endforeach; ?>
    <?php else: ?>
      <tr><td colspan="8" class="text-center text-muted">Belum ada calon siswa dari LPK lain</td></tr>
    <?php endif; ?>
  </tbody>
</table>

      </div>
    </div>
  </div>
</div>

<?php $this->load->view('templates/footer'); ?>
