<div class="main-content">
  <div class="container-fluid" style="margin-top: 50px;">

<h2><i class="bi bi-bar-chart-line"></i> Template 3: Progress Tracker</h2>

<form method="post" action="<?= base_url("dialog_kinerja/save/{$pegawai_id}/3") ?>">
  <div class="card mb-4">
    <div class="card-body">
      <p><strong>Nama:</strong> <?= htmlspecialchars($pegawai->nama) ?></p>
      <p><strong>NIP:</strong> <?= htmlspecialchars($pegawai->nip) ?></p>
    </div>
  </div>

  <div class="card mb-4">
    <div class="card-header bg-success text-white">Progress Realisasi RHK</div>
    <div class="card-body">
      <div class="table-responsive">
        <table class="table table-bordered">
          <thead>
            <tr>
              <th>Bulan</th>
              <th>RHK 1 (%)</th>
              <th>RHK 2 (%)</th>
              <th>RHK 3 (%)</th>
              <th>Catatan</th>
            </tr>
          </thead>
          <tbody>
            <?php
            $months = ['Januari', 'Februari', 'Maret', 'April', 'Mei', 'Juni',
                       'Juli', 'Agustus', 'September', 'Oktober', 'November', 'Desember'];
            foreach ($months as $i => $month):
                $idx = $i + 1;
            ?>
            <tr>
              <td><?= $month ?></td>
              <td><input type="number" min="0" max="100" name="progress_rhk1_<?= $idx ?>" class="form-control" value="<?= htmlspecialchars($form_data["progress_rhk1_{$idx}"] ?? '') ?>"></td>
              <td><input type="number" min="0" max="100" name="progress_rhk2_<?= $idx ?>" class="form-control" value="<?= htmlspecialchars($form_data["progress_rhk2_{$idx}"] ?? '') ?>"></td>
              <td><input type="number" min="0" max="100" name="progress_rhk3_<?= $idx ?>" class="form-control" value="<?= htmlspecialchars($form_data["progress_rhk3_{$idx}"] ?? '') ?>"></td>
              <td><input type="text" name="progress_catatan_<?= $idx ?>" class="form-control" value="<?= htmlspecialchars($form_data["progress_catatan_{$idx}"] ?? '') ?>"></td>
            </tr>
            <?php endforeach; ?>
          </tbody>
        </table>
      </div>
    </div>
  </div>

  <div class="d-flex gap-2 mt-3">
    <a href="<?= base_url("dialog_kinerja/template/{$pegawai_id}/2") ?>" class="btn btn-secondary">Back</a>
    <button type="submit" class="btn btn-primary">Simpan & Lanjut</button>
  </div>
</form>