<div style="padding:10px;"></div>
<div class="detil" style="padding: 4px;font-size:14px;margin-top:25px;width: 85%;margin: 0 auto;border-color: #FFFFFF;">
	<form id="frm_putusan" style="padding: 4px;background:white;margin:0;" method="post" action="<?php echo base_url().'saveputusanbanding';?>">
		<table id="tableDetilPerkara" style="font-size:14px;">
			<col width="40%">
			<col width="60%">
			<tbody>	
				<tr id="tr_pihak">
					<td colspan="2" class="divider">Edit - Putusan Banding</td>
				</tr>
				<tr>
					<td>Nomor Perkara</td>
					<td style="padding:0px;padding-left:5px;"><?php echo (!empty($noperkarapn) ? $noperkarapn : '');?></td>
				</tr>
				<tr>
					<td>Tanggal Permohonan</td>
					<td style="padding:0px;padding-left:5px;"><?php echo (!empty($tglpermohonan) ? $tglpermohonan : '');?></td>
				</tr>
				<tr id="tr_pihak">
					<input type="hidden" id="date_put" value="<?php echo (!empty($tglputusan))? $tglputusan:'';?>">
					<input type="hidden" id="enc" name="enc" value="<?php echo (!empty($idperkara))? $idperkara:'';?>">
				</tr>
				<tr>
					<td>Tanggal Putusan Banding<font color="red">*</font></td>
					<td style="padding:0px;padding-left:5px;">
						<input id="tanggal" name="tanggal" value="<?php echo (!empty($tanggal) ? $tanggal : '');?>" class="datepicker" maxlength="10" placeholder="tgl/bln/tahun">
					</td>
				</tr>
				<tr>
					<td>Nomor Putusan Banding<font color="red">*</font></td>
					<td style="padding:0px;padding-left:5px;">
						<input type="text" id='input_area' name='input_area' value="<?php echo (!empty($input_area) ? $input_area : '');?>" class="standard-input" maxlength="255">
						<input type="hidden" id="curr_date" value="<?php echo $current_date;?>">
						<input type="hidden" id="jenis_form" value="<?php echo $jenis_form;?>">
					</td>
				</tr>
				<tr>
					<td >Status Putusan<font color="red">*</font></td>
					<td style="padding:0px;padding-left:5px;" colspan="2">
						<span class="custom-dropdown custom-dropdown--emerald" style='width:150px;'>
							<select name="st_putusan" id="st_putusan" style="width:150px;" class="custom-dropdown__select custom-dropdown__select--white">
								<option value="">Pilih Status Putusan</option>
								<option value="3" <?php echo ($statusputusan==3)? 'selected':'' ?>>Dibatalkan</option>
								<option value="2" <?php echo ($statusputusan==2)? 'selected':'' ?>>Dikuatkan</option>
								<option value="1" <?php echo ($statusputusan==1)? 'selected':'' ?>>Diperbaiki</option>
								<option value="5" <?php echo ($statusputusan==5)? 'selected':'' ?>>Dicabut</option>
								<option value="4" <?php echo ($statusputusan==4)? 'selected':'' ?>>Tidak Diterima</option>								
							</select>
						</span>
					</td>
				</tr>
				<tr>
					<td valign="top" style="vertical-align:top;">Amar Putusan Banding<font color="red">*</font></td>
					<td style="background:white;" id="amar_text">
						<?php echo $this->ckeditor->editor("amar",$amar);?>
					</td>
				</tr>
				<?php
				$idalurperkara = $this->tanggalhelper->getIDAlurPerkara($perkaraid);
				if($idalurperkara==118){
					$majelis = "/Hakim Tunggal";				
				}else{
					$majelis = "";
				}
				?>
				<tr>
					<td id="first-child">Hakim Ketua<?php echo $majelis; ?><font color="red">*</font></td>
					<td style="padding:0px;padding-left:5px;">
						<span class="custom-dropdown custom-dropdown--emerald" style='width:200px;'>
							<select name="hakim_ketua" id="hakim_ketua" style='width:200px;' class="custom-dropdown__select custom-dropdown__select--white">
								<option value="">Pilih Hakim Ketua</option>
								<?php
								if($listHakim !=''){
									if($listHakim->num_rows>0){
										foreach ($listHakim->result() as $row) {
											$status = '';
											if($row->id==$hakim1){
												$status = 'selected';
											}
											echo '<option value="'.base64_encode($this->encrypt->encode($row->id)).'" '.$status.'>'.$row->nama_gelar.'</option>';
										}
									}
								}
								?>
							</select>
						</span>
					</td>
				</tr>
				<tr>
					<td id="first-child">Hakim Anggota 1</td>
					<td style="padding:0px;padding-left:5px;">
						<span class="custom-dropdown custom-dropdown--emerald" style='width:200px;'>
							<select name="hakim_anggota_1" id="hakim_anggota_1" style='width:200px;' class="custom-dropdown__select custom-dropdown__select--white">
								<option value="">Pilih Hakim Anggota 1</option>
								<?php
								if($listHakim !=''){
									if($listHakim->num_rows>0){
										foreach ($listHakim->result() as $row) {
											$status = '';
											if($row->id==$hakim2){
												$status = 'selected';
											}
											echo '<option value="'.base64_encode($this->encrypt->encode($row->id)).'" '.$status.'>'.$row->nama_gelar.'</option>';
										}
									}
								}
								?>
							</select>
						</span>
					</td>
				</tr>
				<tr>
					<td id="first-child">Hakim Anggota 2</td>
					<td style="padding:0px;padding-left:5px;">
						<span class="custom-dropdown custom-dropdown--emerald" style='width:200px;'>
							<select name="hakim_anggota_2" id="hakim_anggota_2" style='width:200px;' class="custom-dropdown__select custom-dropdown__select--white">
								<option value="">Pilih Hakim Anggota 2</option>
								<?php
								if($listHakim !=''){
									if($listHakim->num_rows>0){
										foreach ($listHakim->result() as $row) {
											$status = '';
											if($row->id==$hakim3){
												$status = 'selected';
											}
											echo '<option value="'.base64_encode($this->encrypt->encode($row->id)).'" '.$status.'>'.$row->nama_gelar.'</option>';
										}
									}
								}
								?>
							</select>
						</span>
					</td>
				</tr>
				<tr>
					<td id="first-child">Hakim Anggota 3</td>
					<td style="padding:0px;padding-left:5px;">
						<span class="custom-dropdown custom-dropdown--emerald" style='width:200px;'>
							<select name="hakim_anggota_3" id="hakim_anggota_3" style='width:200px;' class="custom-dropdown__select custom-dropdown__select--white">
								<option value="">Pilih Hakim Anggota 3</option>
								<?php
								if($listHakim !=''){
									if($listHakim->num_rows>0){
										foreach ($listHakim->result() as $row) {
											$status = '';
											if($row->id==$hakim4){
												$status = 'selected';
											}
											echo '<option value="'.base64_encode($this->encrypt->encode($row->id)).'" '.$status.'>'.$row->nama_gelar.'</option>';
										}
									}
								}
								?>
							</select>
						</span>
					</td>
				</tr>
				<tr>
					<td id="first-child">Hakim Anggota 4</td>
					<td style="padding:0px;padding-left:5px;">
						<span class="custom-dropdown custom-dropdown--emerald" style='width:200px;'>
							<select name="hakim_anggota_4" id="hakim_anggota_4" style='width:200px;' class="custom-dropdown__select custom-dropdown__select--white">
								<option value="">Pilih Hakim Anggota 4</option>
								<?php
								if($listHakim !=''){
									if($listHakim->num_rows>0){
										foreach ($listHakim->result() as $row) {
											$status = '';
											if($row->id==$hakim5){
												$status = 'selected';
											}
											echo '<option value="'.base64_encode($this->encrypt->encode($row->id)).'" '.$status.'>'.$row->nama_gelar.'</option>';
										}
									}
								}
								?>
							</select>
						</span>
					</td>
				</tr>				
				<tr>
					<td id="first-child">Panitera Pengganti<font color="red">*</font></td>
					<td style="padding:0px;padding-left:5px;">
						<span class="custom-dropdown custom-dropdown--emerald" style='width:200px;'>
							<select name="panitera" id="panitera" style='width:200px;' class="custom-dropdown__select custom-dropdown__select--white">
								<option value="">Pilih Panitera Pengganti</option>
								<?php
								if($listPanitera !=''){
									if($listPanitera->num_rows>0){
										foreach ($listPanitera->result() as $row) {
											$status = '';
											if($row->id==$panitera){
												$status = 'selected';
											}
											echo '<option value="'.base64_encode($this->encrypt->encode($row->id)).'" '.$status.'>'.$row->nama_gelar.'</option>';
										}
									}
								}
								?>
							</select>
						</span>
					</td>
				</tr>
				<tr>
					<td id="first-child">Tanggal Pengarsipan Berkas Banding</td>
					<td style="padding:0px;padding-left:5px;">
						<input id="tgl_arsip" name="tgl_arsip" value="<?php echo (!empty($tgl_arsip) ? $tgl_arsip : '');?>" class="datepicker" maxlength="10" placeholder="tgl/bln/tahun">
					</td>
				</tr>
				<tr>
					<td id="first-child">Tanggal Penerimaan Kembali Berkas Banding</td>
					<td style="padding:0px;padding-left:5px;">
						<input id="tgl_berkas" name="tgl_berkas" value="<?php echo (!empty($tgl_berkas) ? $tgl_berkas : '');?>" class="datepicker" maxlength="10" placeholder="tgl/bln/tahun">
					</td>
				</tr>
				<tr>
					<td colspan="2" style="background:white;" align="center">
						<input type="button" value="Kembali" id="kembali" class="btn">
						<?php
						if (!empty($statusputusan)) 
						{ 
							echo '<input type="button" id="hapus" value="Hapus" style="text-decoration:none" class="btn btn-danger">';
						}	
						?>
						<input type="submit" id="simpan" value="Simpan" class="btn">
					</td>
				</tr>
			</tbody>
		</table>
	</form>
</div>
<div style="padding:10px;"></div>
<script type="text/javascript">
$('#kembali').closingFormWin();
$('#frm_putusan').SubmitHandling({
	refresh:'1',
	setRefresh:1,
	divRef:'#konten',
	clicked:1,
	btnClicked:'.close_form',
	whenStatus:1,
	isCKEdit:1,
	tdID:'amar_text',
	textID:'amar',
});
$('#hapus').ButtonClickHandling({
	refresh:'1',
	setRefresh:1,
	divRef:'#konten',
	clicked:1,
	btnClicked:'.close_form',
	whenStatus:1,
	actions:'<?php echo base_url()?>detil_banding/hapus_putusan_banding/',
	formName:'#frm_putusan',
	actionName:'Hapus Data'
});
$( document ).ready(function() {
	$('.datepicker').ValidateDateInput();
    $( function() {
        $('#tanggal').datepicker({
            inline: true,
            showOtherMonths: true,
            dateFormat: 'dd/mm/yy',
            dayNamesMin: ['Ming', 'Sen', 'Sel', 'Rab', 'Kam', 'Jum', 'Sab'],
            beforeShowDay: $.datepicker.noWeekends,
            onSelect: function(dateText, inst) {
            	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 (Sabtu & Minggu).';
            		message_error_show_parent(message);
            		return;
            	}
				
				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();
					message_error_show_parent(message);
					$(this).css("background-color", "red");
				}else{
					$(this).css("background-color", "#dedbdb");
				}
			}
        });
		$('#tgl_arsip').datepicker({
            inline: true,
            showOtherMonths: true,
            dateFormat: 'dd/mm/yy',
            dayNamesMin: ['Ming', 'Sen', 'Sel', 'Rab', 'Kam', 'Jum', 'Sab'],
            beforeShowDay: $.datepicker.noWeekends,
            onSelect: function(dateText, inst) {
            	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.';
            		message_error_show_parent(message);
            		return;
            	}
				
				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();
					message_error_show_parent(message);
					$(this).css("background-color", "red");
				}else{
					$(this).css("background-color", "#dedbdb");
				}
			}
        });
		$('#tgl_berkas').datepicker({
            inline: true,
            showOtherMonths: true,
            dateFormat: 'dd/mm/yy',
            dayNamesMin: ['Ming', 'Sen', 'Sel', 'Rab', 'Kam', 'Jum', 'Sab'],
            beforeShowDay: $.datepicker.noWeekends,
            onSelect: function(dateText, inst) {
            	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.';
            		message_error_show_parent(message);
            		return;
            	}
				
				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();
					message_error_show_parent(message);
					$(this).css("background-color", "red");
				}else{
					$(this).css("background-color", "#dedbdb");
				}
			}
        });
    });
});
</script>
