<?php
    $alur_perkara_id = $perkara['0']['alur_perkara_id'];
?>
<div class="centering" style="width:600px;margin-top:1%;z-index:-100">
<div id="penunjukan_kembali_pp" style="border: 1px solid #ffffff;">
    <div class="detil" style="padding: 2px;background-color: white;">
        <div style="font-size:14px;">
			<form id="frm_panitera" class="removeformbottomspace" method="post" action="<?php echo base_url().'addPanitera_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="35%">
	                <col width="65%">
	                
                    <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>
						    	<?php
								print_r($perkara['0']['nomor_perkara']);
						    	?>
						    <input type="hidden" name='enc' value='<?php echo $enc;?>'>
                        </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>
						    <?php
							echo $this->tanggalhelper->convertDayDate($perkara['0']['tanggal_pendaftaran']);
						    ?>
                        </td>
                    </tr>
                    <tr>
                    	<td id="first-child">Tanggal Penetapan Majelis Hakim</td>
                        <td>
						    <?php
							echo $this->tanggalhelper->convertDayDate($perkara_penetapan['0']['penetapan_majelis_hakim']);
						    ?>
                        </td>
                    </tr>
                    <tr>
                    	<td id="first-child">Majelis Hakim/Hakim</td>
                        <td>
                        	<?php
							if (trim($perkara_penetapan['0']['majelis_hakim_text'])==''){
								echo 'Belum Penetapan Majelis Hakim';
							}else{
								echo $perkara_penetapan['0']['majelis_hakim_text'];
							} ?>
                        </td>
                    </tr>
                    <tr>
						<td colspan="2" class="divider">Penunjukan Panitera/Panitera Pengganti Sebelumnya</td>
				    </tr>
				    <tr>
				    	<td id="first-child">Tanggal Penunjukan Panitera Pengganti</td>
				    	<td>
				    		<?php 
				    			echo $this->tanggalhelper->convertDayDate($perkara_penetapan['0']['penetapan_panitera_pengganti']);
				    		?>
				    	</td>
				    </tr>
				    </tr>
					<tr>
						<td colspan="2" class="divider">Penunjukan Panitera/Panitera Pengganti</td>
				    </tr>
				    <tr>
                    	<td id="first-child">Tanggal Penunjukan Panitera Pengganti<font color=red>*</font></td>
                        <td>
                        	<input id="tgl_penunjukan_panitera" name="tgl_penunjukan_panitera" value="" class="datepicker" maxlength="10" placeholder="tgl/bln/tahun">
                        </td>
                    </tr>
                    <tr>
						<td id="first-child">Panitera Pengganti<font color=red>*</font></td>
						<td>
					    	<span class="custom-dropdown custom-dropdown--emerald" style="width:260px">
							<?php
						    $js = 'id="panitera1" class="nama_panitera custom-dropdown__select custom-dropdown__select--white" style="width:260px"';
						    echo form_dropdown('panitera1', $data_panitera, '', $js); ?>
					    	</span>
						</td>
				    </tr>
					<?php
					if($this->session->userdata('jenis_pengadilan')!=2){
					?>	   	
				    <tr>
						<td id="first-child">Panitera Pengganti 2</td>
						<td>
						    <span class="custom-dropdown custom-dropdown--emerald" style="width:260px">
							<?php
						    $js = 'id="panitera2" class="nama_panitera custom-dropdown__select custom-dropdown__select--white" style="width:260px"';
						    echo form_dropdown('panitera2', $data_panitera, '', $js); ?>
					    	</span>
						</td>
				    </tr>
				    <tr>
						<td id="first-child">Panitera Pengganti 3</td>
						<td>
					    	<span class="custom-dropdown custom-dropdown--emerald" style="width:260px">
							<?php
						    $js = 'id="panitera3" class="nama_panitera custom-dropdown__select custom-dropdown__select--white" style="width:260px"';
						    echo form_dropdown('panitera3', $data_panitera, '', $js); ?>
					    	</span>
						</td>
				    </tr>
				    <?php
				    	}
				    	if($cek_status>=1)
                    		$alasan = 'Alasan Penggantian Panitera Pengganti';
                    	else
                    		$alasan = 'Keterangan';
				    ?>
                    <tr>
                    	<td id="first-child"><?php echo $alasan; ?></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); ?>
					    </td>
                    </tr>
                    <tr>
                    	<td colspan="2" class="buttongroup">
                            <input type="hidden" id="curr_date" value="<?php echo $current_date;?>">
		                    <input type="hidden" id="refresh" class='detil_perkara_refresh' value="0">
                        	<input type="button" id="close_form_add_panitera" value="Kembali" class="btn">
							<input type="hidden" name="namahalaman" value="<?php echo $namahalaman;?>">
                            <input type="submit" id="simpan" value="Simpan" class="btn">
                        </td>
                    </tr>
                	</tbody>
            	</table>
        	</form>
    	</div>
	</div>
	</div>
</div>

<script type="text/javascript">

$('.nama_panitera').change(function(){
	if ($(this).val()!='0'){
		switch($(this).attr('id')) {
			case 'panitera1':
				if ($(this).val()==$('#panitera2').val() || $(this).val()==$('#panitera3').val()) {
					alert('Tidak bisa memilih panitera yang sama !');
					$(this).val('0');
				}
			break;
			case 'panitera2':
				if ($(this).val()==$('#panitera1').val() || $(this).val()==$('#panitera3').val()) {
					alert('Tidak bisa memilih panitera yang sama !');
					$(this).val('0');
				}
			break;
			case 'panitera3':
				if ($(this).val()==$('#panitera2').val() || $(this).val()==$('#panitera1').val()) {
					alert('Tidak bisa memilih panitera yang sama !');
					$(this).val('0');
				}
			break;
		}
	}
});
    $('#frm_panitera').SubmitHandling({
	refresh:'1',
	setRefresh:1,
	divRef:'#konten',
	clicked:1,
	btnClicked:'#close_form_add_majelis',
	whenStatus:1,
	next_step:1
    });

<?php 
if($this->session->userdata('jenis_pengadilan')==1){
?>
    $('#close_form_add_panitera').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_panitera').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_panitera').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_panitera').click(function(){
        window.open("<?php echo base_url('perkara_detil_agama/'.$enc.'/2');?>","_self");    
    });        
<?php
}else{
?>
    $('#close_form_add_panitera').closingFormWin();
<?php
}
?>     
    $('#tgl_penunjukan_panitera').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 date = $(this).datepicker('getDate');
            	var dayOfWeek = weekday[date.getDay()];
            	var error = 0;
            	var message ='';
            	if(dayOfWeek=='Sunday' || dayOfWeek=='Saturday'){
            		message ='Tidak Dapat Memilih diluar Hari Kerja.';
            		error = 1;
            	}

		    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>