<script>
    var baseurl = "<?php echo base_url("index.php/"); ?>"; // Buat variabel baseurl
</script>
<script src="<?php echo base_url("js/jquery.min.js"); ?>"></script> <!-- Load library jquery -->
<script src="<?php echo base_url("js/config.js"); ?>"></script> <!-- Load file process.js --> 

<SCRIPT LANGUAGE="JavaScript">
<!--  
function enable_text(status)
{
//alert(status);
status=!status; 
document.f1.btq_membaca.disabled = status;
}
//  End -->
</script>

<div class="row">  
  <div class="col-md-6">
    <?php echo form_open_multipart(base_url('form'),'id="tambah"') ?>
    <h4 class="alert alert-info">Nilai BTQ [ diinput 0 - 100, jika kosong 0 ]</h4>    
    <div class="form-group row">
      <label class="col-sm-3 control-label text-right">No. Pendaftaran <span class="text-danger">*</span></label>
      <!-- <div class="col-sm-9">
        <input type="text" name="no_pendaftaran" id="no_pendaftaran" class="form-control" placeholder="Masukkan No. Pendaftaran Lalu Klik Tombol Cari di Bawah" required oninvalid="this.setCustomValidity('data tidak boleh kosong, diisi No. Pendaftaran')" oninput="setCustomValidity('')"> <button type="button" name="btn-search" class="btn btn-warning btn-lg" id="btn-search"><i class="fa fa-search"></i> </button> <span id="loading">LOADING...</span>
      </div> -->
      <div class="col-sm-9">
          <?php 
            //$siswa = $this->db->get("data_siswa")->result();
            $siswa = $this->siswamodel->get_siswa();
          ?>
          <select name="no_pendaftaran" id="no_pendaftaran" class="form-control select2" required>
            <option value="">Pilih No. Pendaftaran</option>
              <?php foreach ($siswa as $value) { ?>
                  <option value="<?= $value->no_pendaftaran ?>"><?= $value->no_pendaftaran ?></option>
              <?php } ?>
          </select><br>
      <oninvalid="this.setCustomValidity('data tidak boleh kosong, diisi No. Pendaftaran ')' 
        oninput="setCustomValidity('')"> <button type="button" name="btn-search" class="btn btn-warning btn-lg"
        id="btn-search"><i class="fa fa-search"></i> </button> <span id="loading">LOADING...</span>
      </div>
    </div>    

    <div class="form-group row">
      <label class="col-sm-3 control-label text-right">Nama Lengkap <span class="text-danger"></span></label>
      <div class="col-sm-9">
        <input type="text" name="nama_lengkap" id="nama_lengkap"  class="form-control" placeholder="Nama Lengkap" readonly required>
      </div>
    </div>

    <div class="form-group row">
      <label class="col-sm-3 control-label text-right">Sekolah Asal <span class="text-danger"></span></label>
      <div class="col-sm-9">
        <input type="text" name="sekolah_asal" id="sekolah_asal" class="form-control" placeholder="Sekolah Asal" readonly disabled>
      </div>
    </div>

    <div class="form-group row">
      <label class="col-sm-3 control-label text-right">Prog. Keahlian <span class="text-danger"></span></label>
      <div class="col-sm-9">
        <input type="text" name="kompetensi" id="kompetensi" class="form-control" placeholder="Komp. Keahlian" readonly disabled>
      </div>
    </div>

    <div class="form-group row">
      <label class="col-sm-3 control-label text-right">No. HP Siswa<span class="text-danger"></span></label>
      <div class="col-sm-9">
        <input type="text" name="no_hp" id="no_hp" class="form-control" placeholder="No. Handphone Siswa" readonly disabled>
      </div>
    </div>

    <div class="form-group row">
      <label class="col-sm-3 control-label text-right">Nama Ayah <span class="text-danger"></span></label>
      <div class="col-sm-9">
        <input type="text" name="nama_ayah" id="nama_ayah" class="form-control" placeholder="Nama Ayah" readonly disabled>
      </div>
    </div>

    <div class="form-group row">
      <label class="col-sm-3 control-label text-right">No. HP Ayah<span class="text-danger"></span></label>
      <div class="col-sm-9">
        <input type="text" name="tlp_ayah" id="tlp_ayah" class="form-control" placeholder="No. Handphone Ayah" readonly disabled>
      </div>
    </div>

     <div class="form-group row">
      <label class="col-sm-3 control-label text-right">Nama Ibu <span class="text-danger"></span></label>
      <div class="col-sm-9">
        <input type="text" name="nama_ibu" id="nama_ibu" class="form-control" placeholder="Nama Ibu" readonly disabled>
      </div>
    </div>

     <div class="form-group row">
      <label class="col-sm-3 control-label text-right">No. HP Ibu<span class="text-danger"></span></label>
      <div class="col-sm-9">
        <input type="text" name="tlp_ibu" id="tlp_ibu" class="form-control" placeholder="No. Handphone Ibu" readonly disabled>
      </div>
    </div>

    
    <div class="form-group row" name=f1 method=post>
      <label class="col-sm-3 control-label text-right">Membaca <span class="text-danger">*</span></label>
      <div class="col-sm-9">
        <input type="text" name="btq_membaca" id="btq_membaca" class="form-control" placeholder="Nilai Membaca" value="<?php echo set_value(' btq_membaca') ?>" required oninvalid="this.setCustomValidity('data tidak boleh kosong, diisi angka 0 - 100')" oninput="setCustomValidity('')">
      </div>
    </div>

     <div class="form-group row">
      <label class="col-sm-3 control-label text-right">Makhrojul <span class="text-danger">*</span></label>
      <div class="col-sm-9">
        <input type="text" name="btq_makhrojul" id="btq_makhrojul" class="form-control" placeholder="Nilai Makhrojul" value="<?php echo set_value(' btq_makhrojul') ?>" required oninvalid="this.setCustomValidity('data tidak boleh kosong, diisi angka 0 - 100')" oninput="setCustomValidity('')">
      </div>
    </div>

     <div class="form-group row">
      <label class="col-sm-3 control-label text-right">Tajwid <span class="text-danger">*</span></label>
      <div class="col-sm-9">
        <input type="text" name="btq_tajwid" id="btq_tajwid" class="form-control" placeholder="Nilai Tajwid" value="<?php echo set_value(' btq_tajwid') ?>" required oninvalid="this.setCustomValidity('data tidak boleh kosong, diisi angka 0 - 100')" oninput="setCustomValidity('')">
      </div>
    </div>

    <div class="form-group row">
      <label class="col-sm-3 control-label text-right">Huruf Tunggal <span class="text-danger">*</span></label>
      <div class="col-sm-9">
        <input type="text" name="btq_huruftunggal" id="btq_huruftunggal" class="form-control" placeholder="Nilai Huruf Tunggal" value="<?php echo set_value(' btq_huruftunggal') ?>" required oninvalid="this.setCustomValidity('data tidak boleh kosong, diisi angka 0 - 100')" oninput="setCustomValidity('')">
      </div>
    </div>

    <div class="form-group row">
      <label class="col-sm-3 control-label text-right">Merangkai Huruf <span class="text-danger">*</span></label>
      <div class="col-sm-9">
        <input type="text" name="btq_merangkaihuruf" id="btq_merangkaihuruf" class="form-control" placeholder="Nilai Merangkai Huruf" value="<?php echo set_value(' btq_merangkaihuruf') ?>" required oninvalid="this.setCustomValidity('data tidak boleh kosong, diisi angka 0 - 100')" oninput="setCustomValidity('')">
      </div>
    </div>

    <div class="form-group row">
      <label class="col-sm-3 control-label text-right">Kerapihan <span class="text-danger">*</span></label>
      <div class="col-sm-9">
        <input type="text" name="btq_kerapihan" id="btq_kerapihan" class="form-control" placeholder="Nilai Kerapihan" value="<?php echo set_value(' btq_kerapihan') ?>" required oninvalid="this.setCustomValidity('data tidak boleh kosong, diisi angka 0 - 100')" oninput="setCustomValidity('')">
      </div>
    </div>

    <div class="form-group row">
      <label class="col-sm-3 control-label text-right">Akhlak <span class="text-danger">*</span></label>
      <div class="col-sm-9">
        <input type="text" name="btq_akhlak" id="btq_akhlak" class="form-control" placeholder="Nilai Akhlak" value="<?php echo set_value(' btq_akhlak') ?>" required oninvalid="this.setCustomValidity('data tidak boleh kosong, diisi angka 0 - 100')" oninput="setCustomValidity('')">
      </div>
    </div>    
  </div>

 <!--tab 2-->
  <div class="col-md-6">
    <h4 class="alert alert-info">Nilai Wawancara [ diinput 0 - 100, jika kosong 0 ]</h4>
    
    <div class="form-group row">
      <label class="col-sm-4 control-label text-right">Alasan Memilih MTD <span class="text-danger">*</span></label>
      <div class="col-sm-8">
        <input type="text" name="w2n_alasan" id="w2n_alasan" class="form-control" placeholder="Nilai Alasan Memilih SMK Al-Muhtadin" value="<?php echo set_value(' w2n_alasan') ?>" required oninvalid="this.setCustomValidity('data tidak boleh kosong, diisi angka 0 - 100')" oninput="setCustomValidity('')">
      </div>
    </div>  

    <div class="form-group row">
      <label class="col-sm-4 control-label text-right">Besarnya Kepercayaan <span class="text-danger">*</span></label>
      <div class="col-sm-8">
        <input type="text" name="w2n_kepercayaan" id="w2n_kepercayaan" class="form-control" placeholder="Nilai Besarnya Kepercayaan Terhadap Sekolah" value="<?php echo set_value(' w2n_kepercayaan') ?>" required oninvalid="this.setCustomValidity('data tidak boleh kosong, diisi angka 0 - 100')" oninput="setCustomValidity('')">
      </div>
    </div>  

    <div class="form-group row">
      <label class="col-sm-4 control-label text-right">Penanganan Masalah <span class="text-danger">*</span></label>
      <div class="col-sm-8">
        <input type="text" name="w2n_penanganan" id="w2n_penanganan" class="form-control" placeholder="Nilai Penanganan Masalah Disekolah" value="<?php echo set_value(' w2n_penanganan') ?>" required oninvalid="this.setCustomValidity('data tidak boleh kosong, diisi angka 0 - 100')" oninput="setCustomValidity('')">
      </div>
    </div>  
   
    <div class="form-group row">
      <label class="col-sm-4 control-label text-right">Kebiasaan Belajar Anak <span class="text-danger">*</span></label>
      <div class="col-sm-8">
        <input type="text" name="w2n_kebiasaan" id="w2n_kebiasaan" class="form-control" placeholder="Nilai Kebiasaan Belajar Anak" value="<?php echo set_value(' w2n_kebiasaan') ?>" required oninvalid="this.setCustomValidity('data tidak boleh kosong, diisi angka 0 - 100')" oninput="setCustomValidity('')">
      </div>
    </div>  
    
    <div class="form-group row">
      <label class="col-sm-4 control-label text-right">Psikologi Anak <span class="text-danger">*</span></label>
      <div class="col-sm-8">
        <input type="text" name="w2n_psikologi" id="w2n_psikologi" class="form-control" placeholder="Nilai Psikologi Anak" value="<?php echo set_value(' w2n_psikologi') ?>" required oninvalid="this.setCustomValidity('data tidak boleh kosong, diisi angka 0 - 100')" oninput="setCustomValidity('')">
      </div>
    </div>  
   
    <div class="form-group row">
      <label class="col-sm-4 control-label text-right">Pelaksanaan Sholat <span class="text-danger">*</span></label>
      <div class="col-sm-8">
        <input type="text" name="w2n_sholat" id="w2n_sholat" class="form-control" placeholder="Nilai Pelaksanaan Sholat 5 Waktu" value="<?php echo set_value(' w2n_sholat') ?>" required oninvalid="this.setCustomValidity('data tidak boleh kosong, diisi angka 0 - 100')" oninput="setCustomValidity('')">
      </div>
    </div>  

    <div class="form-group row">
      <label class="col-sm-4 control-label text-right">Keikutsertaan Ortu <span class="text-danger">*</span></label>
      <div class="col-sm-8">
        <input type="text" name="w2n_keikutsertaan" id="w2n_keikutsertaan" class="form-control" placeholder="Nilai Keikutsertaan Ortu dlm Meningkatkan Kualitas" value="<?php echo set_value(' w2n_keikutsertaan') ?>" required oninvalid="this.setCustomValidity('data tidak boleh kosong, diisi angka 0 - 100')" oninput="setCustomValidity('')">
      </div>
    </div>  

    <div class="form-group row">
      <label class="col-sm-4 control-label text-right">Kewajiban Administrasi <span class="text-danger">*</span></label>
      <div class="col-sm-8">
        <input type="text" name="w2n_kesediaan" id="w2n_kesediaan" class="form-control" placeholder="Nilai Kesediaan Memenuhi Kewajiban Administrasi" value="<?php echo set_value(' w2n_kesediaan') ?>" required oninvalid="this.setCustomValidity('data tidak boleh kosong, diisi angka 0 - 100')" oninput="setCustomValidity('')">
      </div>
    </div>  

    <div class="form-group row">
      <label class="col-sm-4 control-label text-right">Catatan Khusus <span class="text-danger">*</span></label>
      <div class="col-sm-8">
        <textarea name="catatan" id="catatan" class="form-control" placeholder="Catatan Untuk Peserta, Jika Kosong Strip ( - )" value="<?php echo set_value(' catatan') ?>" required oninvalid="this.setCustomValidity('data tidak boleh kosong, jika kosong diisi strip')" oninput="setCustomValidity('')"></textarea>
      </div>
    </div>     
    <!--
    <?php echo form_open_multipart(base_url('form'),'id="edit"') ?>
    <div class="form-group row">
      <label class="col-sm-4 control-label text-right">Status <span class="text-danger">*</span></label>
      <div class="col-sm-8">
        <a href="https://api.whatsapp.com/send?phone=6285921778565&text=Hallo%20Agan%20Baik"><img src="tombol.png"></a>
      </div>
    </div>  -->
    <!--
  </div>
     <div class="col-md-6">
        <div class="card mb-4">
            <div class="card-body">
                <i class="mdi mdi-account-convert"></i> Foto <br>
                <small>*Klik foto untuk mengganti foto.</small>
                <hr>
                <div class="form-group text-center">
                    <img class="img-thumbnail" onclick="fotosiswa('<?= $no_pendaftaran ?>')" src="<?= site_url('assets/img/ppdb/' . $foto_siswa) ?>" width="65%" alt="Foto Peserta PPDB">
                </div>
            </div>
        </div>
        <div class="card mb-4">
            <div class="card-body">
                <i class="mdi mdi-wallpaper"></i> Scan Ijazah <br>
                <small>*Klik foto untuk meng-upload scan ijazah.</small>
                <hr>
                <div class="form-group text-center">
                    <img class="img-thumbnail" onclick="fotoijazah('<?= $no_pendaftaran ?>')" src="<?= site_url('assets/img/ppdb/ijazah/'  . $foto_ijazah) ?>" width="65%" alt="Scan Ijazah">
                </div>
            </div>
        </div>
    </div>

    <script>
    $('.formedit').submit(function(e) {
        e.preventDefault();
    

    function fotosiswa(no_pendaftaran) {
        $.ajax({
            type: "post",
            url: "<?= site_url('ppdb/formuploadfoto') ?>",
            data: {
                no_pendaftaran: no_pendaftaran
            },
            dataType: "json",
            success: function(response) {
                if (response.sukses) {
                    $('.viewmodal').html(response.sukses).show();
                    $('#modalupload').modal('show');

                }
            }
        });
    }

    function fotoijazah(no_pendaftaran) {
        $.ajax({
            type: "post",
            url: "<?= site_url('ppdb/formuploadijazah') ?>",
            data: {
                no_pendaftaran: no_pendaftaran
            },
            dataType: "json",
            success: function(response) {
                if (response.sukses) {
                    $('.viewmodal').html(response.sukses).show();
                    $('#modalupload').modal('show');

                }
            }
        });
    }

</script>-->

     <div class="form-group row">
      <label class="col-sm-3 control-label text-right"></label>
      <div class="col-sm-9">               
          <button type="submit" name="submit" class="btn btn-success btn-lg"><i class="fa fa-save"></i> Simpan</button>
          <button type="reset" name="reset" class="btn btn-info btn-lg"><i class="fa fa-cut"></i> Batal</button>
          <a href="<?php echo base_url('nilai') ?>" class="btn btn-secondary btn-lg" data-dismiss="modal"><i class="fa fa-times"></i> Kembali</a>        
      </div>
      <label class="col-sm-12 control-label text-right"><span class="text-danger">*</span> <small>Wajib diisi</small></label> 
    </div>     

    <?php echo form_close(); ?>  
       
</div>


