                <!-- Content Header (Page header) -->
                <section class="content-header">
                    <h1>
                      Aktivitas Mahasiswa
                    </h1>
                    <ol class="breadcrumb">
                        <li><a href="<?=base_index();?>"><i class="fa fa-dashboard"></i> Home</a></li>
                        <li><a href="<?=base_index();?>aktivitas-mahasiswa">Aktivitas Mahasiswa</a></li>
                        <li class="active">Edit Aktivitas Mahasiswa</li>
                    </ol>
                </section>

                <!-- Main content -->
                <section class="content">
<div class="row">
    <div class="col-lg-12">
        <div class="box box-solid box-primary">
                                   <div class="box-header">
                                    <h3 class="box-title">Edit Aktivitas Mahasiswa</h3>
                                    <div class="box-tools pull-right">
                                        <button class="btn btn-info btn-sm" data-widget="collapse"><i class="fa fa-minus"></i></button>
                                        <button class="btn btn-info btn-sm" data-widget="remove"><i class="fa fa-times"></i></button>
                                    </div>
                                </div>

                  <div class="box-body">
                     <form id="update" method="post" class="form-horizontal" action="<?=base_admin();?>modul/aktivitas_mahasiswa/aktivitas_mahasiswa_action.php?act=up">
                      <div class="form-group">
                        <label for="Semester" class="control-label col-lg-2">Semester</label>
                        <div class="col-lg-10">
                          <input type="text" name="semester" value="<?=$data_edit->semester;?>" class="form-control" required> 
                        </div>
                      </div><!-- /.form-group -->
<div class="form-group">
                        <label for="Judul" class="control-label col-lg-2">Judul</label>
                        <div class="col-lg-10">
                          <textarea  rows="6" class="form-control" name="judul" required><?=$data_edit->judul;?> </textarea>
                        </div>
                      </div><!-- /.form-group -->
<div class="form-group">
                        <label for="Lokasi" class="control-label col-lg-2">Lokasi</label>
                        <div class="col-lg-10">
                          <input type="text" name="lokasi" value="<?=$data_edit->lokasi;?>" class="form-control" > 
                        </div>
                      </div><!-- /.form-group -->
<div class="form-group">
                        <label for="Nomor SK Tugas" class="control-label col-lg-2">Nomor SK Tugas</label>
                        <div class="col-lg-10">
                          <input type="text" name="nomor_sk" value="<?=$data_edit->nomor_sk;?>" class="form-control" > 
                        </div>
                      </div><!-- /.form-group -->
<div class="form-group">
                        <label for="Tanggal SK Tugas" class="control-label col-lg-2">Tanggal SK Tugas</label>
                        <div class="col-lg-10">
                          <input type="text" name="tanggal_sk" id="tgl1" value="<?=$data_edit->tanggal_sk;?>" class="form-control" > 
                        </div>
                      </div><!-- /.form-group -->

<div class="form-group">
                        <label for="ID AKTIVITAS" class="control-label col-lg-2">Jenis Anggota</label>
<div class="col-lg-10">

  <div class="radio radio-success radio-inline">
                  <input type="radio" name="jenis_anggota"  id="radio11" value="0" <?=($data_edit->jenis_anggota=="0")?"checked":"";?>>
                    <label for="radio11" style="padding-left: 5px;">
                      Personal
                    </label>
                </div>

                
  <div class="radio radio-success radio-inline">
                  <input type="radio" name="jenis_anggota"  id="radio22" value="1" <?=($data_edit->jenis_anggota=="1")?"checked":"";?>>
                    <label for="radio22" style="padding-left: 5px;">
                      Kelompok
                    </label>
                </div>
                  </div>
                      </div><!-- /.form-group -->


<div class="form-group">
                        <label for="Jenis Anggota" class="control-label col-lg-2">Jenis Aktivitas</label>
                        <div class="col-lg-10">
                          <select name="id_jenis_akt" id="id_jenis_akt" data-placeholder="Pilih Jenis Aktivitas..." class="form-control chzn-select" tabindex="2" required>
               <option value=""></option>
               <?php foreach ($db->fetch_all("jenis_akt_mhs") as $isi) {
                $is_km = '';
                $data_jenis = '';
                if ($isi->a_kegiatan_kampus_merdeka=='1') {
                  $is_km = '(Kampus Merdeka)';
                  $data_jenis = 'km';
                }

                  if ($data_edit->id_jenis_akt==$isi->id_jns_akt_mhs) {
                    echo "<option value='$isi->id_jns_akt_mhs' data-jenis='$data_jenis' selected>$isi->nm_jns_akt_mhs $is_km</option>";
                  } else {
                  echo "<option value='$isi->id_jns_akt_mhs' data-jenis='$data_jenis'>$isi->nm_jns_akt_mhs  $is_km</option>";
                    }
               } ?>
              </select>
                        </div>
                      </div><!-- /.form-group -->


<?php
$jenis_km = $db->fetch_single_row("jenis_akt_mhs","id_jns_akt_mhs",$data_edit->id_jenis_akt);
?>
<div class="form-group show-mbkm" <?=($jenis_km->a_kegiatan_kampus_merdeka=='0')?'style="display:none"':'';?>>
                        <label for="ID AKTIVITAS" class="control-label col-lg-2">Program MBKM</label>
<div class="col-lg-10">

  <div class="radio radio-success radio-inline">
                  <input type="radio" name="program_mbkm"  id="radio1" value="1" <?=($data_edit->program_mbkm=="1")?"checked":"";?>>
                    <label for="radio1" style="padding-left: 5px;">
                      Flagship
                    </label>
                </div>

                
  <div class="radio radio-success radio-inline">
                  <input type="radio" name="program_mbkm"  id="radio2" value="0" <?=($data_edit->program_mbkm=="0")?"checked":"";?>>
                    <label for="radio2" style="padding-left: 5px;">
                      Mandiri
                    </label>
                </div>
                  </div>
                      </div><!-- /.form-group -->

<div class="form-group">
                        <label for="Judul" class="control-label col-lg-2">Ket/ID AKTIVITAS</label>
                        <div class="col-lg-10">
                         <input type="text" name="ket" value="<?= htmlspecialchars($data_edit->ket, ENT_QUOTES, 'UTF-8'); ?>" class="form-control">
                        </div>
                      </div><!-- /.form-group -->

<div class="form-group">
                        <label for="Jurusan" class="control-label col-lg-2">Prodi</label>
                        <div class="col-lg-10">
                          <select name="jurusan" data-placeholder="Pilih Jurusan..." class="form-control chzn-select" tabindex="2" required>

               <?php 
if ($_SESSION['level']==1) {
  $jur = $db->fetch_custom("select * from jurusan");
} else {
  $jur = $db->fetch_custom("select * from jurusan where kode_jurusan='".$_SESSION['jurusan']."'");
}
foreach ($jur as $isi) {

                  if ($data_edit->kode_jurusan==$isi->kode_jurusan) {
                    echo "<option value='$isi->kode_jurusan' selected>$isi->jenjang $isi->nama_jurusan</option>";
                  } else {
                    echo "<option value='$isi->kode_jurusan'>$isi->jenjang $isi->nama_jurusan</option>";
                  }
               } ?>
              </select>
                        </div>
 </div><!-- /.form-group -->


<div class="form-group">
                        <label for="Tanggal SK Tugas" class="control-label col-lg-2">Tanggal Mulai</label>
                        <div class="col-lg-10">
                          <input type="text" name="tanggal_mulai" id="tgl2" value="<?=$data_edit->tanggal_mulai;?>" class="form-control" > 
                        </div>
                      </div><!-- /.form-group -->

<div class="form-group">
                        <label for="Tanggal SK Tugas" class="control-label col-lg-2">Tanggal Selesai</label>
                        <div class="col-lg-10">
                          <input type="text" name="tanggal_selesai" id="tgl3" value="<?=$data_edit->tanggal_selesai;?>" class="form-control" > 
                        </div>
                      </div><!-- /.form-group -->
                     
                      <input type="hidden" name="id" value="<?=$data_edit->id;?>">
                      <div class="form-group">
                        <label for="tags" class="control-label col-lg-2">&nbsp;</label>
                        <div class="col-lg-10">
                          <input type="submit" class="btn btn-primary btn-flat" value="submit">
                        </div>
                      </div><!-- /.form-group -->
                    </form>
                    <a href="<?=base_index();?>aktivitas-mahasiswa" class="btn btn-success btn-flat"><i class="fa fa-step-backward"></i> Kembali</a>
          
                  </div>
                  </div>
              </div>
</div>
                </section><!-- /.content -->
<script type="text/javascript">
 $(document).ready(function() {

$('#id_jenis_akt').on('change', function() {
      var selectedOption = $(this).find('option:selected');
      var jenis = selectedOption.data('jenis');
       if (jenis=='km') {
        $('.show-mbkm').show();
      } else {
        $('.show-mbkm').hide();
      }
});
});
</script>