<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>resources/css/date-css.css" />
<?php
$option_tgl = array('1' => 'Sama Dengan', 
					'2' => 'Lebih Besar Dari', 
					'3' => 'Lebih Besar Sama Dengan', 
					'4' => 'Kurang Dari',
					'5' => 'Kurang Dari Sama Dengan',
					'6' => 'Antara'
					);
$option_text = array('1' => 'Sama Dengan', 
					'8' => 'Berisi'
					);
$col1width="185px";
$col2width="245px";
?>
<div class="centering" style="width:740px;margin-top: 1%;">
<div id='tunda_jadwal_sidang' style="border: 1px solid #ffffff;">
    <div class="detil" style="padding: 2px;background-color: white;">
		<form method="post" id="frm_search_detil" action="<?php echo ($ht)?base_url().'perkara_eksekusi_list_ht/search_detail/'.$enc:base_url().'perkara_eksekusi_list/search_detail/'.$enc; ?>">
		<table id="tableDetilPerkara" style="background: #dedbdb;">
			<col width="275px">
			<col width="100px">
			<col width="">
			<tbody>
				<tr>
					<td colspan="3" style='text-align:center;background:#5fb85c;color:#fff;border:2px solid #fff;margin-bottom:10px;font-size: 20px;'>PENCARIAN DETIL - PERMOHONAN EKSEKUSI</td>
				</tr>
				<tr>
					<td>Nomor Perkara</td>
					<td style="padding:0px;padding-left:5px;">
						<span class="custom-dropdown custom-dropdown--emerald" style="width:<?php echo $col1width;?>">
							<?php
								$js="id='no_perkara_select' class='custom-dropdown__select custom-dropdown__select--white' style='width:100%;' ";
								echo form_dropdown('no_perkara_select', $option_text, '8', $js);
							?>
						</span>
					</td>
					<td style="padding:0px;padding-left:5px;"><input id='no_perkara' name='no_perkara' class="standard-input">
					</td>
				</tr>
				<tr>
					<td>Pemohon Eksekusi</td>
					<td style="padding:0px;padding-left:5px;">
						<span class="custom-dropdown custom-dropdown--emerald" style="width:<?php echo $col1width;?>">
							<?php
								$js="id='pemohon_eksekusi_select' class='custom-dropdown__select custom-dropdown__select--white' style='width:100%;' ";
								echo form_dropdown('pemohon_eksekusi_select', $option_text, '8', $js);
							?>
						</span>
					</td>
					<td style="padding:0px;padding-left:5px;"><input id='pemohon_eksekusi' name='pemohon_eksekusi' class="standard-input">
					</td>
				</tr>
				<tr>
					<td>Tanggal Penetapan Teguran</td>
					<td style="padding:0px;padding-left:5px;">
						<span class="custom-dropdown custom-dropdown--emerald" style="width:<?php echo $col1width;?>">
							<?php
								$js="id='tgl_penetapan_teguran_select' class='custom-dropdown__select custom-dropdown__select--white' style='width:100%' ";
								echo form_dropdown('tgl_penetapan_teguran_select', $option_tgl, '1', $js);
							?>
						</span>
					</td>
					<td style="padding:0px;padding-left:5px;">
					<input id="from_tgl_penetapan_teguran" name="from_tgl_penetapan_teguran" class="datepicker" maxlength="10" placeholder="tgl/bln/tahun" style="color: #000;background: #fff;"><input id= "a_tgl_penetapan_teguran" class='antara tgl_penetapan_teguran_select' value="s/d" disabled="true" style="width:30px"><input id="to_tgl_penetapan_teguran" name="to_tgl_penetapan_teguran" class="datepicker a_date tgl_penetapan_teguran_select" maxlength="10" placeholder="tgl/bln/tahun" style="color: #000;background: #fff;">
					</td>
				</tr>
				<tr>
					<td>Nomor Penetapan Teguran</td>
					<td style="padding:0px;padding-left:5px;">
						<span class="custom-dropdown custom-dropdown--emerald" style="width:<?php echo $col1width;?>">
							<?php
								$js="id='no_penetapan_teguran_select' class='custom-dropdown__select custom-dropdown__select--white' style='width:100%;' ";
								echo form_dropdown('no_penetapan_teguran_select', $option_text, '8', $js);
							?>
						</span>
					</td>
					<td style="padding:0px;padding-left:5px;"><input id='no_penetapan_teguran' name='no_penetapan_teguran' class="standard-input">
					</td>
				</tr>
				<tr>
					<td>Tanggal Pelaksanaan Teguran</td>
					<td style="padding:0px;padding-left:5px;">
						<span class="custom-dropdown custom-dropdown--emerald" style="width:<?php echo $col1width;?>">
							<?php
								$js="id='tgl_pelaksanaan_teguran_select' class='custom-dropdown__select custom-dropdown__select--white' style='width:100%' ";
								echo form_dropdown('tgl_pelaksanaan_teguran_select', $option_tgl, '1', $js);
							?>
						</span>
					</td>
					<td style="padding:0px;padding-left:5px;">
					<input id="from_tgl_pelaksanaan_teguran" name="from_tgl_pelaksanaan_teguran" class="datepicker" maxlength="10" placeholder="tgl/bln/tahun" style="color: #000;background: #fff;"><input id= "a_tgl_pelaksanaan_teguran" class='antara tgl_pelaksanaan_teguran_select' value="s/d" disabled="true" style="width:30px"><input id="to_tgl_pelaksanaan_teguran" name="to_tgl_pelaksanaan_teguran" class="datepicker a_date tgl_pelaksanaan_teguran_select" maxlength="10" placeholder="tgl/bln/tahun" style="color: #000;background: #fff;">
					</td>
				</tr>
				<tr>
					<td>Tanggal Penetapan Sita</td>
					<td style="padding:0px;padding-left:5px;">
						<span class="custom-dropdown custom-dropdown--emerald" style="width:<?php echo $col1width;?>">
							<?php
								$js="id='tgl_penetapan_sita_select' class='custom-dropdown__select custom-dropdown__select--white' style='width:100%' ";
								echo form_dropdown('tgl_penetapan_sita_select', $option_tgl, '1', $js);
							?>
						</span>
					</td>
					<td style="padding:0px;padding-left:5px;">
					<input id="from_tgl_penetapan_sita" name="from_tgl_penetapan_sita" class="datepicker" maxlength="10" placeholder="tgl/bln/tahun" style="color: #000;background: #fff;"><input id= "a_tgl_penetapan_sita" class='antara tgl_penetapan_sita_select' value="s/d" disabled="true" style="width:30px"><input id="to_tgl_penetapan_sita" name="to_tgl_penetapan_sita" class="datepicker a_date tgl_penetapan_sita_select" maxlength="10" placeholder="tgl/bln/tahun" style="color: #000;background: #fff;">
					</td>
				</tr>
				<tr>
					<td>Nomor Penetapan Sita</td>
					<td style="padding:0px;padding-left:5px;">
						<span class="custom-dropdown custom-dropdown--emerald" style="width:<?php echo $col1width;?>">
							<?php
								$js="id='no_penetapan_sita_select' class='custom-dropdown__select custom-dropdown__select--white' style='width:100%;' ";
								echo form_dropdown('no_penetapan_sita_select', $option_text, '8', $js);
							?>
						</span>
					</td>
					<td style="padding:0px;padding-left:5px;"><input id='no_penetapan_sita' name='no_penetapan_sita' class="standard-input">
					</td>
				</tr>
				<tr>
					<td>Tanggal Sita Eksekusi</td>
					<td style="padding:0px;padding-left:5px;">
						<span class="custom-dropdown custom-dropdown--emerald" style="width:<?php echo $col1width;?>">
							<?php
								$js="id='tgl_sita_eksekusi_select' class='custom-dropdown__select custom-dropdown__select--white' style='width:100%' ";
								echo form_dropdown('tgl_sita_eksekusi_select', $option_tgl, '1', $js);
							?>
						</span>
					</td>
					<td style="padding:0px;padding-left:5px;">
					<input id="from_tgl_sita_eksekusi" name="from_tgl_sita_eksekusi" class="datepicker" maxlength="10" placeholder="tgl/bln/tahun" style="color: #000;background: #fff;"><input id= "a_tgl_sita_eksekusi" class='antara tgl_sita_eksekusi_select' value="s/d" disabled="true" style="width:30px"><input id="to_tgl_sita_eksekusi" name="to_tgl_sita_eksekusi" class="datepicker a_date tgl_sita_eksekusi_select" maxlength="10" placeholder="tgl/bln/tahun" style="color: #000;background: #fff;">
					</td>
				</tr>
				<tr>
					<td colspan="3" style='text-align:center;background:#5fb85c;color:#fff;border:2px solid #fff;margin-bottom:10px;font-size: 20px;'></td>
				</tr>
				<input type="hidden" value="<?php echo $enc;?>" name ="enc" id ="enc" class='btn'>
				<tr>
					<td colspan="3" style="background:white;" align="center">
						<input type="submit" onClick='clearAll()' value="Bersihkan" class="btn"></input>
						<input type="submit" value="Cari" class="btn"></input>
						<input type="button" id='close_form_search_detail' value="Kembali" class="btn">
					</td>
				</tr>
			</tbody>
		</table>
	</form>
	</div>
	</div>
</div>

<script type="text/javascript">
	$('#close_form_search_detail').closingFormWin();

    $( function() {
        $('#from_tgl_penetapan_teguran').datepicker({
            inline: true,
            showOtherMonths: true,
            dateFormat: 'dd/mm/yy',
            dayNamesMin: ['Ming', 'Sen', 'Sel', 'Rab', 'Kam', 'Jum', 'Sab'],
        });
        $('#to_tgl_penetapan_teguran').datepicker({
            inline: true,
            showOtherMonths: true,
            dateFormat: 'dd/mm/yy',
            dayNamesMin: ['Ming', 'Sen', 'Sel', 'Rab', 'Kam', 'Jum', 'Sab'],
        });

        $('#from_tgl_pelaksanaan_teguran').datepicker({
            inline: true,
            showOtherMonths: true,
            dateFormat: 'dd/mm/yy',
            dayNamesMin: ['Ming', 'Sen', 'Sel', 'Rab', 'Kam', 'Jum', 'Sab'],
        });
        $('#to_tgl_pelaksanaan_teguran').datepicker({
            inline: true,
            showOtherMonths: true,
            dateFormat: 'dd/mm/yy',
            dayNamesMin: ['Ming', 'Sen', 'Sel', 'Rab', 'Kam', 'Jum', 'Sab'],
        });

        $('#from_tgl_penetapan_sita').datepicker({
            inline: true,
            showOtherMonths: true,
            dateFormat: 'dd/mm/yy',
            dayNamesMin: ['Ming', 'Sen', 'Sel', 'Rab', 'Kam', 'Jum', 'Sab'],
        });
        $('#to_tgl_penetapan_sita').datepicker({
            inline: true,
            showOtherMonths: true,
            dateFormat: 'dd/mm/yy',
            dayNamesMin: ['Ming', 'Sen', 'Sel', 'Rab', 'Kam', 'Jum', 'Sab'],
        });

        $('#from_tgl_sita_eksekusi').datepicker({
            inline: true,
            showOtherMonths: true,
            dateFormat: 'dd/mm/yy',
            dayNamesMin: ['Ming', 'Sen', 'Sel', 'Rab', 'Kam', 'Jum', 'Sab'],
        });
        $('#to_tgl_sita_eksekusi').datepicker({
            inline: true,
            showOtherMonths: true,
            dateFormat: 'dd/mm/yy',
            dayNamesMin: ['Ming', 'Sen', 'Sel', 'Rab', 'Kam', 'Jum', 'Sab'],
        });
    });
    
$('.datepicker').keyup(function(e){
	if( (e.keyCode<8 || e.keyCode>57)){
		return;
	}

    if(e.keyCode != '8'){
    	if(e.target.value.length == 1){
    		if(e.target.value>3){
    			alert('Input Tidak Benar Format, Tanggal tidak boleh lebih dari 30')
    			e.target.value = '';
    		}
    	}

    	if(e.target.value.length == 4 && e.keyCode!='13'){
    		if(e.keyCode!=49 && e.keyCode!=48){
    			alert('Input Tidak Benar Format, Bulan Tidak Boleh dari 12')
    			var val = e.target.value;
    			val = val.substring(0, val.length - 1);
    			e.target.value = val;
    		}
    	}

    	if(e.target.value.length == 5){
    		var val = e.target.value;
    		var bln = val.substr(val.length -2);
    		if(bln>12){
    			alert('Input Tidak Benar Format, Bulan Tidak Boleh dari 12')
    			val = val.substring(0, val.length - 1);
    			e.target.value = val;
    		}
    	}
    	if(e.target.value.length == 7 && e.keyCode!='13'){
    		if( e.keyCode>50 && e.keyCode!=48){
    			alert('Anda Yakin dengan Tahun yang anda masukan?')
    			var val = e.target.value;
    			val = val.substring(0, val.length - 1);
    			e.target.value = val;
    		}
    	}
    	if(e.target.value.length == 10){
			if(isDateValid(e.target.value)==false){
				var val = e.target.value;
    			val = val.substring(0, val.length - 1);
    			e.target.value = val;
			}
		}
        if (e.target.value.length == 2) e.target.value = e.target.value + "/";
        if (e.target.value.length == 5) e.target.value = e.target.value + "/";
    }
})

$('.antara').hide()
$('.a_date').hide()

$('.custom-dropdown__select').change(function(e) {
    var val = $('#'+e.target.id).val();
    if(val==6){
    	$('.'+e.target.id).show();
    }else{
    	$('.'+e.target.id).hide();
    }

    if(e.target.id=='id_tahapan'){
    	var tahapan_id = $('#id_tahapan').val()
    	$('.pros').show();
    	$('.pros').not('#'+tahapan_id).hide();
    }
   
    if(e.target.id=='id_alur_perkara'){
    	var enc = $('#id_alur_perkara').val()
    	if(enc!=-1){
    		window.open('<?php echo base_url();?>search/'+enc,'_self')
    	}
    	
    }
});

function clearAll(){
	$(':input').not('.btn').val('');
}

$(document).ready(function() {
  $(window).keydown(function(event){
    if(event.keyCode == 13) {
      event.preventDefault();
      return false;
    }
  });
});
	
</script>