<?php
    $alur_perkara_id = $perkara['0']['alur_perkara_id'];
?>
<div class="centering" style="width:600px;margin-top: 1%;z-index:-100">
    <div id='jurusita' style="border: 1px solid #ffffff;">
    <div class="detil" style="padding: 2px;background-color: white;">
           <div style="font-size:14px;">
				<form id="frm_penunjukan_kembali_jurusita" class="removeformbottomspace" method="post" action="<?php echo base_url().'addJuruSita_c/f_validate_input_penunjukan_kembali';?>">
                    <table id='tableDetilPerkara' style="font-size:14px;margin-top:25px;width:100%;margin: 0 auto;border-color: #FFFFFF;">
                    	<col width="30%">
                        <col width="70%">
                        <tbody>
	                    	<tr>
	                        	<td style="padding:4px;background:white;font-size:16px;color:#111;" align="center" colspan="2"><strong><?php echo $namahalaman;?></strong></td>
	                        </tr> 
                        	<tr>
                            	<td id="first-child">Nomor Perkara</td>
                                <td>
                                	<span>
									    <?php
											print_r($perkara['0']['nomor_perkara']);
									    ?>
									    <input type="hidden" name='enc' value='<?php echo $enc;?>'>
									</span>
                                </td>
                            </tr>
                            <tr>
                                <?php
					    		if (intval($perkara['0']['alur_perkara_id'])>100){
									echo "<td id='first-child'>Tanggal Pelimpahan</td>";
					    		}else{
									echo "<td id='first-child'>Tanggal Pendaftaran</td>";
					    		} ?>
                                <td>
                                	<span>
									    <?php
										echo $this->tanggalhelper->convertDayDate($perkara['0']['tanggal_pendaftaran']);
									    ?>
									</span>
                                </td>
                            </tr>
                    		<tr>
								<td colspan="2" class="divider">Penunjukan Jurusita Sebelumnya</td>
						    </tr>
						    <tr>
		                        <td id="first-child">Tanggal Penunjukan Jurusita</td>
		                        <td>
		                        	<?php
									echo $this->tanggalhelper->convertDayDate($perkara_penetapan['0']['penetapan_jurusita']);
								    ?>
		                        </td>
		                    </tr>
						    <tr>
							<td id="first-child">Jurusita Sebelumnya</td>
							<td>
							    <?php
									echo ($perkara_penetapan['0']['jurusita_text']);
								?>
							</td>
						    </tr>
		                    <tr>
								<td colspan="2" class="divider">Penunjukan Kembali Jurusita</td>
						    </tr>
						    <tr>
		                    	<td id="first-child">Tanggal Penunjukan Jurusita <font color=red>*</font></td>
		                        <td>
		                        	<input id="tgl_penunjukan_juru_sita" name="tgl_penunjukan_juru_sita" value="" class="datepicker" maxlength="10" placeholder="tgl/bln/tahun">
		                        </td>
		                    </tr>
						    <tr>
								<td id="first-child">Jurusita <font color=red>*</font></td>
								<td>
							    	<span class="custom-dropdown custom-dropdown--emerald" style="width:250px">
									<?php
								    $js = 'id="juru_sita1" class="nama_jurusita custom-dropdown__select custom-dropdown__select--white" style="width:250px"';
								    echo form_dropdown('juru_sita1', $data_juru_sita, '', $js); ?>
							    	</span>
								</td>
						    </tr>
						    <tr>
								<td id="first-child">Jurusita 2</td>
								<td>
								    <span class="custom-dropdown custom-dropdown--emerald" style="width:250px">
									<?php
								    $js = 'id="juru_sita2" class="nama_jurusita custom-dropdown__select custom-dropdown__select--white" style="width:250px"';
								    echo form_dropdown('juru_sita2', $data_juru_sita, '', $js); ?>
							    	</span>
								</td>
						    </tr>
						    <tr>
								<td id="first-child">Jurusita 3</td>
								<td>
							    	<span class="custom-dropdown custom-dropdown--emerald" style="width:250px">
									<?php
								    $js = 'id="juru_sita3" class="nama_jurusita custom-dropdown__select custom-dropdown__select--white" style="width:250px"';
								    echo form_dropdown('juru_sita3', $data_juru_sita, '', $js); ?>
							    	</span>
								</td>
						    </tr>
		                    <tr>
		                    	<td id="first-child">Keterangan</td>
		                        <td>
									<?php
									    $js="{datatype: 'text', maxLength: 500, allowedChars: '', lettersCase: '', enterTab: false, enterSubmit: false, autoTab: true, selectOnFocus: true, watermark: '', watermarkClass: 'scFormObjectOddWm', maskChars: '(){}[].,;:-+/ '}
										cols='100' rows='2' id='keterangan' name='keterangan' style='width: 99%; height: 100px; resize: none;' maxlength='500'";
									    echo form_textarea('keterangan', '', $js); ?>
									<input type="hidden" name="diatis" value="<?php echo base64_encode($this->encrypt->encode($perkara_penetapan['0']['jurusita_id'])); ?>">
									<input type="hidden" name="lgtatis" value="<?php echo base64_encode($this->encrypt->encode($perkara_penetapan['0']['penetapan_jurusita'])); ?>">
							    </td>
		                    </tr>
		                    <tr>
		                    	<td colspan="2" class="buttongroup">
		                        	<input type="button" id='close_form_add_jurusita' value="Kembali" class="btn">
		                            <input type="submit" id="simpan" value="Simpan" class="btn">
		                            <input type="hidden" id="curr_date" value="<?php echo $current_date;?>">
									<input type="hidden" name="namahalaman" value="<?php echo $namahalaman;?>">
		                        </td>
		                    </tr>
                            <input type="hidden" id="refresh" class='detil_perkara_refresh' value="0">
                        </tbody>
                    </table>
                </form>
            </div>
        </div>
    </div>
</div>

<script type="text/javascript">
$('.nama_jurusita').change(function(){
	if ($(this).val()!='0'){
		switch($(this).attr('id')) {
			case 'juru_sita1':
				if ($(this).val()==$('#juru_sita2').val() || $(this).val()==$('#juru_sita3').val()) {
					alert('Tidak bisa memilih juru sita yang sama !');
					$(this).val('0');
				}
			break;
			case 'juru_sita2':
				if ($(this).val()==$('#juru_sita1').val() || $(this).val()==$('#juru_sita3').val()) {
					alert('Tidak bisa memilih juru sita yang sama !');
					$(this).val('0');
				}
			break;
			case 'juru_sita3':
				if ($(this).val()==$('#juru_sita2').val() || $(this).val()==$('#juru_sita1').val()) {
					alert('Tidak bisa memilih juru sita yang sama !');
					$(this).val('0');
				}
			break;
		}
	}
});
    $('#frm_penunjukan_kembali_jurusita').SubmitHandling({
	refresh:'1',
	setRefresh:1,
	divRef:'#konten',
	clicked:1,
	btnClicked:'#close_form_add_jurusita',
	whenStatus:1,
	next_step:1
    });

<?php 
if($this->session->userdata('jenis_pengadilan')==1){
?>
    $('#close_form_add_jurusita').click(function(){
        window.open("<?php echo base_url('perkara_detil/'.$enc.'/2');?>","_self");    
    });
<?php
}else if($this->session->userdata('jenis_pengadilan')==2){
?>
    $('#close_form_add_jurusita').click(function(){
        window.open("<?php echo base_url('perkara_detil_mil/'.$enc.'/2');?>","_self");    
    });    
<?php
}else if($this->session->userdata('jenis_pengadilan')==3){
?>
    $('#close_form_add_jurusita').click(function(){
        window.open("<?php echo base_url('perkara_detil_tun/'.$enc.'/2');?>","_self");    
    });
<?php
}else if($this->session->userdata('jenis_pengadilan')==4){
?>
    $('#close_form_add_jurusita').click(function(){
        window.open("<?php echo base_url('perkara_detil_agama/'.$enc.'/2');?>","_self");    
    });        
<?php
}else{
?>
    $('#close_form_add_jurusita').closingFormWin();
<?php
}
?>     
    $('#tgl_penunjukan_juru_sita').datepicker({
            inline: true,
            showOtherMonths: true,
            dateFormat: 'dd/mm/yy',
            dayNamesMin: ['Ming', 'Sen', 'Sel', 'Rab', 'Kam', 'Jum', 'Sab'],
            onSelect: function(dateText, inst) {
            	var error = 0;
				
		    var tmp = $(this).val().split("/");
				var tmp2 = $('#curr_date').val().split("/");
				if((new Date(tmp[2]+"-"+tmp[1]+"-"+tmp[0]+"T00:00:00").getTime() > new Date(tmp2[2]+"-"+tmp2[1]+"-"+tmp2[0]+"T00:00:00").getTime())){
					message = 'Tidak Dapat Memilih Melebihi Hari ini. Sekarang Tanggal '+$('#curr_date').val();
					error = 1
				}

				if(error==1){
					message_error_show(message);
					$(this).css("background-color", "red");
				}else{
					$(this).css("background-color", "#dedbdb");
				}
				error = 0;
        	}
      	});
    $('.datepicker').ValidateDateInput();
</script>