@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>

	</section>

	<section class="content">

		<div class="row">

			<div class="col-md-12">
				@include('alert.success')
				{!! Form::open(['url' => 'users/'.$user->id.'/credits']) !!}
				{{ method_field('POST') }}
					<div class="form-group">
					{{ Form::label('m', 'Modalidad') }}
					{{ Form::select('m', [
					   '3' => '3 salidas',
					   '7' => '7 salidas',]
					), array('id' => 'modalidad', 'class' => 'form-control') }}
					</div>
					<div class="form-group">
					{{ Form::label('startDate', 'Fecha inicio') }}
						{{ Form::date('startDate', \Carbon\Carbon::now(), null, array('id' => 'startDate', 'class' => 'form-control')) }}
					</div>
					<div class="form-group">
					{{ Form::label('endDate', 'Fecha final') }}
						{{ Form::date('endDate', \Carbon\Carbon::now(), null, array('id' => 'endDate', 'class' => 'form-control')) }}
					</div>

					<div class="form-group">
					    {{ Form::label('boat_id', 'Barco') }}
					    {{ Form::select('boat_id', $boats, array('id' => 'b', 'class' => 'form-control')) }}
					</div>

					{{ Form::hidden('customer_id', $user->id) }}

					{!! Form::submit(trans('Cargar Salidas'), ['class' => 'btn btn-success btn-flat']) !!}
				{!! Form::close() !!}

			</div>
			

		</div>
	</section>

	<div id="contenedor"></div>

</div>

@endsection


@section('foot')

<script type="text/javascript">
	const url_to_request_get = "http://localhost:8000";
	function cargarSalidas() {
		console.log('hola');
		$.ajax({
		  url: url_to_request_get+"/generarcreditos.php",
		  method: "GET",
			data: $('#generateCredits').serialize(),
		  dataType: "html"
		}).done(function(data) {
		  $('#contenedor').html(data);
			console.log('Data: '.data);
		});
		return false;
	}

</script>

@endsection
