@extends(Auth::check() && Auth::user()->role->layout == 1 ? 'layouts.admin' : 'layouts.employee')

@section('content')

<div class="content-wrapper">

	<section class="content-header">

		<h1>

		{{trans('general.credit')}}

		</h1>
		<div class="row" style="margin:15px;">
			<select id="anyo">
				<option value="">Seleccione un año</option>
				<option value="2017">2017</option>
				<option value="2018">2018</option>
				<option value="2019">2019</option>
			</select>

			<select id="barco">
			    <option value="">Seleccione una embarcación</option>
			    <option value="10">10</option>
			    <option value="14">14</option>
			</select>

			<a href="#" class="btn btn-xs disabled" style="background-color:#605ca8;color:#fff;">Laborable</a>
			<a href="#" class="btn btn-xs disabled" style="background-color:#ff851b;color:#fff;">Fin de semana</a>
		</div>
	</section>


	<section class="content">
		<div id="contenedor"></div>
	</section>

</div>


@endsection


@section('foot')

<script src="{{ asset('/plugins/select2/select2.min.js') }}"></script>

<script src="{{ asset('plugins/jQueryUI/jquery-ui.min.js') }}"></script>

<script type="text/javascript">

	$("#anyo").change( function() {
		opcion =  $('#anyo option:selected').val();
		barco = $('#barco option:selected').val();
		$.ajax({
		  url: "https://skipper.komunica.es/getcreditosstats.php",
		  method: "GET",
		  data: { usuario : {{ Auth::user()->id }} , anyo : opcion, boat : barco },
		  dataType: "html"
		}).done(function(data) {
		  $('#contenedor').html(data);
		});

	});

</script>

@endsection
