<style type="text/css">
   input {font-weight:bold;}
</style>

<script>
  $(function() {
	$(document).ready(function() {
    $('#tgl_lahir').datepicker({
		dateFormat : 'yy/mm/dd',
	});	
		});		
  } );
</script>

<?php
//form edit open
$gel = $this->pendaftar_model->gelombang();
echo form_open(base_url('formdaftar/tambah/'));
?>
<script src="<?php echo base_url("js/jquery.min.js"); ?>"></script>
<script src="<?php echo base_url("js/jquery-1.11.2.min"); ?>"></script>


<!-- Main content -->
<section class="content">
	<div class="container-fluid">
		<div class="row">
			<div class="col-12">
				<!-- Default box -->
				<div class="card">
					<div class="card-header">
						<h3 class="card-title"><b><span class="text-blue">IDENTITAS CALON PESERTA DIDIK</span><span class="text-red"> [ <?php echo $gel->gelombang ?> ]</span> </b></h3>
						<div class="card-tools">
							<button type="button" class="btn btn-tool" data-card-widget="collapse" title="Collapse">
								<i class="fas fa-minus"></i>
							</button>
						</div>
					</div>

					<div class="card-body">
						<div class="form-group row">
							<label for="no_pendaftaran" class="col-sm-2 col-form-label">No. Pendaftaran</label>:
							<div class="col-sm-3">
								<input type="text" name="no_pendaftarans" class="font-weight-bold form-control" value="<?= $nodaftar ?>"
									placeholder="No. Pendaftaran"
									onkeypress=" return event.charCode>= 48 && event.charCode <=57" disabled>
                                    <input type="hidden" name="no_pendaftaran" value="<?= $nodaftar ?>">
							</div>
						</div>
						<div class="form-group row">
							<label for="nisn" class="col-sm-2 col-form-label">NISN</label>:
							<div class="col-sm-3">
								<input type="text" name="nisn" class="form-control" placeholder="NISN - Jika tidak ada isi 0"
									onkeypress="return event.charCode >= 48 && event.charCode <=57" required>
							</div>
						</div>

						<div class="form-group row">
							<label for="nama_lengkap" class="col-sm-2 col-form-label">Nama Lengkap</label>:
							<div class="col-sm-9">
								<input type="text" name="nama_lengkap" class="form-control" placeholder="Nama Lengkap"
									onkeyup="this.value = this.value.toUpperCase()" required>
							</div>
						</div>

						<div class="form-group row">
							<label for="jkelamin" class="col-sm-2 col-form-label">Jenis Kelamin</label>:
							<div class="col-sm-3">
								<select name="jkelamin" class="form-control" required>
									<option value="Laki-laki">
										Laki-laki</option>
									<option value="Perempuan">
										Perempuan</option>
								</select>
							</div>
							<label for="agama" class="col-sm-2 col-form-label">Agama</label>:
							<div class="col-sm-3">
								<select name="agama" class="form-control" required>
									<option value="-">
										-</option>
									<option value="Islam">
										Islam</option>
									<option value="Kristen">
										Kristen</option>
									<option value="Katolik">
										Katolik</option>
									<option value="Hindu">
										Hindu</option>
									<option value="Budha">
										Budha</option>
									<option value="Konghucu">
										Konghucu</option>
								</select>
							</div>
						</div>
						<div class="form-group row">
							<label for="kemeja" class="col-sm-2 col-form-label">Ukuran Kemeja</label>:
							<div class="col-sm-3">
								<select name="kemeja" class="form-control" required>
									<option value="-">
										-</option>
									<option value="S">
										S</option>
									<option value="M">
										M</option>
									<option value="L">
										L</option>
									<option value="XL">
										XL</option>
									<option value="XXL">
										XXL</option>
									<option value="XXXL">
										XXXL</option>
									<option value="XXXXL">
										XXXXL</option>
									<option value="5L">
										5L</option>
									<option value="6L">
										6L</option>
								</select>
							</div>
							<label for="celana" class="col-sm-2 col-form-label">Ukuran Celana/Rok</label>:
							<div class="col-sm-3">
								<select name="celana" class="form-control" required>
									<option value="-">
										-</option>
									<option value="S">
										S</option>
									<option value="M">
										M</option>
									<option value="L">
										L</option>
									<option value="XL">
										XL</option>
									<option value="XXL">
										XXL</option>
									<option value="XXXL">
										XXXL</option>
									<option value="XXXXL">
										XXXXL</option>
									<option value="5L">
										5L</option>
									<option value="6L">
										6L</option>
								</select>
							</div>
						</div>
						<div class="form-group row">
							<label for="tempat_lahir" class="col-sm-2 col-form-label">Tempat Lahir</label>:
							<div class="col-sm-3">
								<input type="text" name="tempat_lahir" class="form-control" placeholder="Tempat Lahir" required>
							</div>
							<label for="tgl_lahir" class="col-sm-2 col-form-label">Tanggal Lahir<small>
									[Hari-Bulan-Tahun]</small></label>:
							<div class="col-sm-3">
								<input type="date" name="tgl_lahir" id="tgl_lahir" value="<?php echo date('Y-m-d',strtotime('tgl_lahir')); ?>" class="form-control"
									placeholder="Tanggal Lahir" maxlength="10" required>
							</div>
						</div>
						<div class="form-group row">
							<label for="no_hp" class="col-sm-2 col-form-label">Nomor HP Siswa</label>:
							<div class="col-sm-3">
								<input type="text" name="no_hp" class="form-control" placeholder="Nomor HP Siswa"
									onkeypress="return event.charCode >= 48 && event.charCode <=57" required>
							</div>
                            <label for="no_hp" class="col-sm-2 col-form-label">Nomor Sepatu Siswa</label>:
							<div class="col-sm-3">
								<input type="text" name="sepatu" class="form-control" placeholder="Nomor Sepatu Siswa"
									onkeypress="return event.charCode >= 48 && event.charCode <=57" required>
							</div>

						</div>
						<div class="form-group row">
    						<label for="sekolah_asal" class="col-sm-2 col-form-label">Sekolah Asal</label>:
    						<div class="col-sm-9">
        					<?php 
        						$sekolah = $this->db->get("sekolah")->result();
        					?>
        					<select name="sekolah_asal" id="sekolah_asal" class="form-control select2" required>
            				<option value="">Pilih Sekolah Asal Terdata</option>
            					<?php foreach ($sekolah as $value) { ?>
                					<option value="<?= $value->nm_sekolah ?>"><?= $value->nm_sekolah ?></option>
            					<?php } ?>
        					</select>
    					</div>    					
					</div>

						<div class="form-group row">
							<div class="col-sm-2 col-form-label"><div class="form-check">
            					<input class="form-check-input" type="checkbox" id="sekolah_lain_checkbox">
            					<label class="form-check-label" for="sekolah_lain_checkbox">
                					Sekolah Lain
            					</label>
        					</div></div>:
    						<div class="col-sm-9">
        						<input type="text" name="sekolah_lain" id="sekolah_lain" class="form-control" placeholder="Sekolah Lain" required disabled>
    						</div>
						</div>

						<div class="form-group row">
							<label for="nama_ayah" class="col-sm-2 col-form-label">Nama Ayah</label>:
							<div class="col-sm-9">
								<input type="text" name="nama_ayah" class="form-control" placeholder="Nama Ayah"
									onkeyup="this.value = this.value.toUpperCase()" required>
							</div>
						</div>
						<div class="form-group row">

							<label for="tlp_ayah" class="col-sm-2 col-form-label">Nomor HP Ayah</label>:
							<div class="col-sm-3">
								<input type="text" name="tlp_ayah" class="form-control" placeholder="Nomor HP Ayah"
									onkeypress="return event.charCode >= 48 && event.charCode <=57" required>
							</div>
						</div>

						<div class="form-group row">
							<label for="nama_ibu" class="col-sm-2 col-form-label">Nama Ibu</label>:
							<div class="col-sm-9">
								<input type="text" name="nama_ibu" class="form-control" placeholder="Nama Ibu"
									onkeyup="this.value = this.value.toUpperCase()" required>
							</div>
						</div>
						<div class="form-group row">

							<label for="tlp_ibu" class="col-sm-2 col-form-label">Nomor HP Ibu</label>:
							<div class="col-sm-3">
								<input type="text" name="tlp_ibu" class="form-control" placeholder="Nomor HP Ibu"
									onkeypress="return event.charCode >= 48 && event.charCode <=57" required>
							</div>
						</div>
						<div class="form-group row">
							<label for="alamat_ayah" class="col-sm-2 col-form-label">Alamat Rumah</label>:
							<div class="col-sm-9">
								<input type="text" name="alamat_ayah" class="form-control" placeholder="Alamat Rumah" required>
								<small class="form-text text-muted"><i>Silahkan diketik Lengkap, Cth : Jl. Raya Cipayung
										Jembatan Serong No. 33 RT.06/02 Kel. Cipayung Kec. Cipayung - Depok</i></small>
							</div>
						</div>

						<div class="form-group row">
							<label for="kd_kompetensi" class="col-sm-2 col-form-label">Program Keahlian</label>:
							<div class="col-sm-9">
								<select name="kd_kompetensi" class="form-control" required>
									<option value="MPLB">
										Manajemen Perkantoran dan Layanan Bisnis</option>
									<option value="TJKT">
										Teknik Jaringan Komputer & Telekomunikasi</option>
									<option value="ANIMASI">
										Animasi</option>
									<option value="KULINER">
										Kuliner</option>
								</select>
							</div>
						</div>

						<div class="form-group row">
							<label for="ok" class="col-sm-2 col-form-label"></label>
							<div class="col-sm-9">
								<button type="submit" class="btn btn-primary">
									<i class="fa fa-save"></i> Simpan Data
								</button>
								<button type="reset" class="btn btn-info">
									<i class="fa fa-times"></i> Reset
								</button>
								<a href="<?php echo base_url('dashboard') ?>" class="btn btn-default" data-dismiss="modal"><i
											class="fa fa-backward"></i> Kembali</a>

							</div>
						</div>
					</div><!-- /.card -->
				</div>
			</div>
		</div>

</section><!-- /.content -->




<?php
//form close
echo form_close();
?>

<script>
$(document).ready(function(){
    $('#sekolah_lain_checkbox').change(function(){
        if($(this).is(':checked')) {
            // Jika checkbox di-check, disable select sekolah dan enable input sekolah lain
            $('select[name="sekolah_asal"]').prop('disabled', true);
            $('#sekolah_lain').prop('disabled', false);
			console.log("kocak")
        } else {
            // Jika checkbox tidak di-check, enable select sekolah dan disable input sekolah lain
            $('select[name="sekolah_asal"]').prop('disabled', false);
            $('#sekolah_lain').prop('disabled', true);
        }
    });
});
</script>