<?php 
$tahun_sekarang = date("Y",time());
$bulan_sekarang = (int) date("m",time());
?>

<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>resources/css/date-css.css" />
<div class="centering" style="width:400px;margin-top: 10%;">
	<div id='popup_cetak_register_mediasi' style="border: 1px solid #ffffff;">
    <div class="detil" style="padding: 2px;background-color: white;">
		<form method="post" id="frm_cetak_reg_mediasi" action="<?php //echo base_url().'cetak_register_mediasi/cetak_register'; ?>">
		<table id="tableDetilPerkara" style="background: #dedbdb;">
			<col width="97%">
			<tbody>
				<tr>
					<td style="font-size:15px;text-align:center;"><font color="#fff">Pilih Register</font></td>
				</tr>
				<tr>
					<td style="background:white;color:#111;" align="center">Periode :
					<span class="custom-dropdown custom-dropdown--emerald" style="width:150px">
						<select style="width:150px" name="bulan" id="bulan" class="custom-dropdown__select custom-dropdown__select--white">
								<option value="01" <?php if($bulan_sekarang=='1'){echo 'selected';}?>>Januari</option>
								<option value="02" <?php if($bulan_sekarang=='2'){echo 'selected';}?>>Februari</option>
								<option value="03" <?php if($bulan_sekarang=='3'){echo 'selected';}?>>Maret</option>
								<option value="04" <?php if($bulan_sekarang=='4'){echo 'selected';}?>>April</option>
								<option value="05" <?php if($bulan_sekarang=='5'){echo 'selected';}?>>Mei</option>
								<option value="06" <?php if($bulan_sekarang=='6'){echo 'selected';}?>>Juni</option>
								<option value="07" <?php if($bulan_sekarang=='7'){echo 'selected';}?>>Juli</option>
								<option value="08" <?php if($bulan_sekarang=='8'){echo 'selected';}?>>Agustus</option>
								<option value="09" <?php if($bulan_sekarang=='9'){echo 'selected';}?>>September</option>
								<option value="10" <?php if($bulan_sekarang=='10'){echo 'selected';}?>>Oktober</option>
								<option value="11" <?php if($bulan_sekarang=='11'){echo 'selected';}?>>Nopember</option>
								<option value="12" <?php if($bulan_sekarang=='12'){echo 'selected';}?>>Desember</option>
						</select>
					</span>	


						<span class="custom-dropdown custom-dropdown--emerald" style="width:80px;color:#111">
							<select style="width:80px;color:#111" name="tahun" id="tahun" class="custom-dropdown__select custom-dropdown__select--white">
								<?php
								foreach ($tahun->result() as $row) {
									if($row->years==$tahun_sekarang){
										echo '<option value='.$row->years.' selected>'.$row->years.'</option>';
									}else{
										echo '<option value='.$row->years.'>'.$row->years.'</option>';
									}
								}
								
								?>
							</select>
						</span>	
					</td>
				</tr>
			
					<td style="line-height:20px;background:white;padding:0px;padding-left:5px;color:#111">
					  <br>					  
					  <input type="radio" name="jenis_reg" class="reg_mediasi" value="mediasi_pengadilan" checked> Register Mediasi <br>
					  <input type="radio" name="jenis_reg" class="reg_mediasi" value="mediasi_diluar_pengadilan"> Register Mediasi di Luar Pengadilan<br>
					  <input type="radio" name="jenis_reg" class="reg_mediasi" value="mediator"> Register Mediator<br><br>
					</td>
				</tr>
				<tr>
					<td style="background:white;" align="center">
					<input type="button" id='close_form_register_mediasi' value="Kembali" class="btn">
					<input type="button" id='cetak_register' value="Cetak" class="btn">						
					</td>
				</tr>
			</tbody>
		</table>
	</form>
	</div>
	</div>
</div>

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

$(document).ready(function() {
  $(window).keydown(function(event){
    if(event.keyCode == 13) {
      event.preventDefault();
      return false;
    }
  });
});
	
$('#cetak_register').click(function(event){
		var tahun = $("#tahun").val();
		var bulan = $("#bulan").val();
		var jenis_register = $(".reg_mediasi:checked").val();	
		var w = window.open('', 'view_laporan');
		var xls = 0;
		$.post('<?php echo base_url()?>cetak_register_mediasi/cetak_register', {
			bulan:bulan,
			tahun:tahun,
			jenis_register:jenis_register,
			xls:xls
		}, function(response){
			var json = jQuery.parseJSON(response);
			events = '';
			if(json.st==1){
				w.location.href ='<?php echo base_url()?>register_mediasi';
			}else{
				message_show(json.msg)
			}
		});
	});

</script>