<div class="content-wrapper">
  <!-- Content Header (Page header) -->
  <div class="content-header">
    <div class="container-fluid">
      <?= $this->session->flashdata('msg') ?>
      <div class="row mb-2">
        <div class="col-sm-6">
          <h1 class="m-0">Perhitungan SAW</h1>
        </div><!-- /.col -->
        <div class="col-sm-6">
          <ol class="breadcrumb float-sm-right">
            <li class="breadcrumb-item"><a href="<?=base_url('dashboard')?>">Beranda</a></li>
            <li class="breadcrumb-item active">Perhitungan SAW</li>
          </ol>
        </div><!-- /.col -->
      </div><!-- /.row -->
    </div><!-- /.container-fluid -->
  </div>
  <!-- /.content-header -->

  <!-- Main content -->
  <div class="content">
    <div class="container-fluid">
      <form action="<?=site_url('balita/proses_perhitungan')?>" method="post">
        <input type="hidden" class="form-control" name="id_balita" value="<?= $data_balita->id_balita ?>">
        <div class="card">
          <!-- /.card-header -->
          <div class="card-body">
            <h3>Rating Kecocokan atau Tahap Analisa</h3>
            <div class="row mb-3">
              <div class="col-md-4">
                <select class="form-control" name="periode" required>
                  <option value="">-- Pilih Periode --</option>
                  <?php
                                    $currentYear = date('Y');
                                    for ($i = $currentYear; $i >= $currentYear - 5; $i--) {
                                        echo "<option value=\"$i\">$i</option>";
                                    }
                                    ?>
                </select>
              </div>
            </div>

            <div class="container row">
              <div class="table-responsive">
                <table id="example1" class="table table-bordered table-striped">
                  <thead>
                    <tr>
                      <th>Alternatif </th>

                      <?php $i = 1; foreach ($list_kriteria as $row): ?>
                      <th><?=$row->nama_kriteria?></th>
                      <?php endforeach; ?>
                    </tr>
                  </thead>
                  <tbody>
                    <?php $i = 1; foreach ($list_alternatif as $row): ?>
                    <tr>
                      <td><?=$row->nama_alternatif?> </td>
                      <?php foreach ($list_kriteria as $kriteria): ?>
                      <td>
                        <select class="form-control"
                          name="bobot[<?=$row->id_alternatif?>][<?=$kriteria->id_kriteria?>]" required>
                          <option value="">-- Pilih --</option>
                          <?php foreach ($list_bobotpreferensi as $bobot): ?>>
                          <option value="<?=$bobot->id_bobot?>"><?=$bobot->keterangan?>(<?=$bobot->nilai?>)
                          </option>
                          <?php endforeach; ?>
                        </select>
                      </td>
                      <?php endforeach; ?>
                    </tr>
                    <?php endforeach; ?>
                  </tbody>
                </table>

              </div>
            </div>

            <hr>
            <div class="row">
              <div class="col-md-4">
                <input type="submit" class="btn bg-blue text-white" value="Proses Hitung">
              </div>
            </div>
          </div>
        </div>
      </form>
      <!-- /.container-fluid -->
    </div>
    <!-- /.content -->
  </div>
</div>