<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='search_detil' style="border: 1px solid #ffffff;">
	<?php echo $this->nativesession->get_flash_session('where'); ?>
    <div class="detil" style="padding: 2px;background-color: white;">
		<form method="post" id="frm_search_detil" action="<?php echo base_url().'list_arsip/search_detail/'; ?>">
		<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 ARSIP</td>
				</tr>
				<tr>
					<td>Nomor Arsip</td>
					<td style="padding:0px;padding-left:11px;">Berisi</td>
					<td style="padding:0px;padding-left:5px;"><input id='nomor_arsip' name='nomor_arsip' class="standard-input"></td>
				</tr>
				<tr>
					<td>Nomor Ruang</td>
					<td style="padding:0px;padding-left:11px;">Berisi</td>
					<td style="padding:0px;padding-left:5px;"><input id='no_ruang' name='no_ruang' class="standard-input"></td>
				</tr>
				<tr>
					<td>Nomor Lemari</td>
					<td style="padding:0px;padding-left:11px;">Berisi</td>
					<td style="padding:0px;padding-left:5px;"><input id='no_lemari' name='no_lemari' class="standard-input"></td>
				</tr>
				<tr>
					<td>Nomor Rak</td>
					<td style="padding:0px;padding-left:11px;">Berisi</td>
					<td style="padding:0px;padding-left:5px;"><input id='no_rak' name='no_rak' class="standard-input"></td>
				</tr>
				<tr>
					<td>Nomor Boks</td>
					<td style="padding:0px;padding-left:11px;">Berisi</td>
					<td style="padding:0px;padding-left:5px;"><input id='no_berkas' name='no_berkas' class="standard-input"></td>
				</tr>
				<tr>
					<td>Nomor Perkara</td>
					<td style="padding:0px;padding-left:11px;">Berisi</td>
					<td style="padding:0px;padding-left:5px;"><input id='nomor_perkara' name='nomor_perkara' class="standard-input"></td>
				</tr>
				<tr>
					<td>Tanggal Masuk Berkas</td>
					<td style="padding:0px;padding-left:5px;">
						<span class="custom-dropdown custom-dropdown--emerald" style="width:<?php echo $col1width;?>">
							<?php
								$js="id='tgl_masuk_berkas_select' class='custom-dropdown__select custom-dropdown__select--white' style='width:100%' ";
								echo form_dropdown('tgl_masuk_berkas_select', $option_tgl, '1', $js);
							?>
						</span>
					</td>
					<td style="padding:0px;padding-left:5px;">
					<input id="from_tgl_masuk_berkas" name="from_tgl_masuk_berkas" class="datepicker" maxlength="10" placeholder="tgl/bln/tahun" style="color: #000;background: #fff;"><input id= "a_tgl_masuk_berkas" class='antara tgl_masuk_berkas_select' value="s/d" disabled="true" style="width:30px"><input id="to_tgl_masuk_berkas" name="to_tgl_masuk_berkas" class="datepicker a_date tgl_masuk_berkas_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>
					<tr>
						<td colspan="3" style="background:white;" align="center">
							<input type="button" onClick='clearAll()' value="Bersihkan" class="btn"></input>
							<input type="submit" value="Cari" class="btn"></input>
							<input type="button" id='close_form_search_arsip_detail' value="Kembali" class="btn">
						</td>
					</tr>
			</tbody>
		</table>
	</form>
	</div>
	</div>
</div>

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

    $( function() {
        $('#from_tgl_masuk_berkas').datepicker({
            inline: true,
            showOtherMonths: true,
            dateFormat: 'dd/mm/yy',
            dayNamesMin: ['Ming', 'Sen', 'Sel', 'Rab', 'Kam', 'Jum', 'Sab'],
            });
        $('#to_tgl_masuk_berkas').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(){
	$('#search_detil :input').not('.btn').val('');
}

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