@extends('layout')

@section('js_script')
	<script src="{{ url("js/plugins/tables/datatables/extensions/buttons.min.js")}}"></script>
	<script src="{{ url("js/plugins/tables/datatables/extensions/pdfmake/pdfmake.min.js")}}"></script>
	<script src="{{ url("js/plugins/tables/datatables/extensions/pdfmake/vfs_fonts.min.min.js")}}"></script>
@endsection

@section('content')

<div class="page-header page-header-default">
	<div class="breadcrumb-line">
		<ul class="breadcrumb">
			<li><a href="index.html"><i class="icon-home2 position-left"></i> Laporan</a></li>
			<li class="active">Jurnal</li>
		</ul>
	</div>
</div>

<div class="content">
	<div class="panel panel-flat">
		<div class="panel-heading">
			<h5 class="panel-title">Jurnal</h5>
	    </div>
	    <div class="panel-body">
			    	<form class="form" method="get" action="{{ url('laporan/perkategoriCetak') }}" >
			    	<!-- <input type="hidden" name="_token" value="{{ csrf_token() }}">	 -->
	    			<div class="col-sm-12 col-md-12">
			    		<div class="row col-sm-6 col-md-6">
				    		<div class="form-group">
				    			{{ Form::label("Lokasi", "", ['class'=>'control-label col-sm-4']) }}
				    			<div class="col-sm-8">
				    				<select name="lokasi" class="form-control set_selected">				    					
				    					<option value="">--- Pilih Lokasi ---</option>
				    					@foreach($lokasi AS $key => $value)
				    					<option value="{{ $value->id_lokasi }}" {{ ($lokasiTerpilih == $value->id_lokasi) ? "selected=''" : "" }}>{{ $value->nama_lokasi }}</option>
				    					@endforeach
				    				</select>
				    			</div>
				    		</div>
				    	</div>
				    </div>
				    
	    			<div class="col-sm-12 col-md-12">
				    	<div class="row col-sm-6 col-md-6">
				    		<div class="form-group">
				    			{{ Form::label("Label CV", "", ['class'=>'control-label col-sm-4']) }}
				    			<div class="col-sm-8">
				    				<select name="cv" class="form-control set_selected">				    					
				    					<option value="">--- Pilih ---</option>
				    					@foreach($label AS $key => $value)
				    					<option value="{{ $key }}" >{{ $value }}</option>
				    					@endforeach
				    				</select>
				    			</div>
				    		</div>
				    	</div>
				    </div>
				    <div class="col-sm-12 col-md-12">
				    	<div class="row col-sm-6 col-md-6">
				    		<div class="form-group">
				    			{{ Form::label("Kategori", "", ['class'=>'control-label col-sm-4']) }}
				    			<div class="col-sm-8">
				    				<select name="kategori" class="form-control set_selected" id="kategori" onchange="get_sub_kategori(this.options[this.selectedIndex].value)">
				    					<option value="">--- Pilih Sub Kategori ---</option>
				    					@foreach($kategori AS $key => $value)
				    					<option value="{{ $value->id_kb }}" {{ ($kategoriTerpilih == $value->id_kb) ? "selected=''" : "" }}>{{ $value->nama }}</option>
				    					@endforeach
				    				</select>
				    			</div>
				    		</div>
				    	</div>
				    </div>
				    <div class="col-sm-12 col-md-12">
				    	<div class="row col-sm-6 col-md-6">
				    		<div class="form-group">
				    			{{ Form::label("Sub Kategori", "", ['class'=>'control-label col-sm-4']) }}
				    			<div class="col-sm-8">
				    				<select name="sub_kategori" class="form-control set_selected" id="sub_kategori">
				    					
				    				</select>
				    			</div>
				    		</div>
				    	</div>
				    </div>


	    			<div class="col-sm-12 col-md-12">	    				
				    	<div class="row col-sm-12 col-md-12">
			    		<div class="form-group">
			    			{{ Form::label("Tanggal", "", ['class'=>'control-label col-sm-2 col-md-2']) }}
			    			<div class="col-sm-3 col-md-3" >
				    			{{ Form::text("tanggal_awal", date("d-m-Y"), ['class'=>'form-control set_datepicker']) }}
				    		</div>
			    			<div class="col-sm-3 col-md-3" >
				    			{{ Form::text("tanggal_akhir", date("d-m-Y"), ['class'=>'form-control set_datepicker']) }}
				    		</div>
			    			<div class="col-sm-2 col-md-2" >
				    			{{ Form::submit("Cetak", ['class'=>'btn btn-sm btn-info']) }}
				    			<!-- <a type="button" class="btn btn-sm btn-info" target="_blank">Cetak</a> -->
				    		</div>
				    	</div>
			    		</div>
			    	</div>
			    	</form>	
	    		

	    		<div class="col-sm-4 col-md-4">
			    	<form class="form" action="#">
			    		<div class="form-group">
			    			<div class="col-sm-12 col-md-12 text-right">
							
							</div>
						</div>
					</form>
	    		</div>
	    		

	    	</div> <!-- end : row -->

	    </div>
	</div>
</div>

<script type="text/javascript">
$(document).ready(function(){
	$(".set_datepicker").datepicker({
		format : "dd-mm-yyyy",
		autoclose : true,
      	zIndexOffset : 9999,
	});

	$('#tabel-jurnal').DataTable({
		filter : false,
		ordering : false,
		paging : false,
	});
});
function get_sub_kategori($id){
		$.ajax({
			url: "{{ url('laporan/getdataSK') }}"+'/'+$id,
			type: 'get',
			dataType: 'json',
			success: function(result){
				// alert('success');
				$("[name=sub_kategori]").html('');
					$("[name=sub_kategori]").append('<option value="" kode="">--- Pilih proses ---</option>');
					for(i in result.data){
						$("[name=sub_kategori]").append('<option value="'+result.data[i].id_kb+'" nama="'+result.data[i].nama+'">'+result.data[i].nama+'</option>');
					}
			
			}
		})
	}

</script>

@endsection