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

@section('content')
<div class="content-wrapper">

	<section class="content">
		<?php /* <a class="btn btn-app btn-flat bg-green" href="{{ asset('/users/'.$user->id.'/edit') }}"><i class="fa fa-edit"></i> Edit</a>
		<a class="btn btn-app btn-flat bg-green" href="{{ asset('/users/'.$user->id.'/absences/create') }}"><i class="fa fa-user-times"></i> Absence</a>
		<a class="btn btn-app btn-flat bg-green" href="{{ asset('/users/'.$user->id.'/awards/create') }}"><i class="fa fa-trophy"></i> Award</a>
		<a class="btn btn-app btn-flat bg-green" href="{{ asset('/users/'.$user->id.'/documents/create') }}"><i class="fa fa-file"></i> Document</a>
		<a class="btn btn-app btn-flat bg-green" href="{{ asset('/users/'.$user->id.'/expenses/create') }}"><i class="fa fa-money"></i> Expense</a>
		<a class="btn btn-app btn-flat bg-green" href="{{ asset('/users/'.$user->id.'/leaves/create') }}"><i class="fa fa-rocket"></i> Leave</a>
		<a class="btn btn-app btn-flat bg-green" href="{{ asset('/users/'.$user->id.'/bank-account/create') }}"><i class="fa fa-bank"></i> Bank Account</a> */ ?>
		<div class="row">
			<div class="col-md-3">
				<div class="box box-success">
					<div class="box-body box-profile">
						<img class="profile-user-img img-responsive img-circle" src="{{ asset('/dist/img/users/'.Auth::user()->profile_picture) }}" alt="User profile picture">
						<h3 class="profile-username text-center">{{ Auth::user()->first_name.' '.Auth::user()->last_name }} </h3>
						<p class="text-center no-margin">{{ Auth::user()->designation_item ? Auth::user()->designation_item->designation_item : '' }}</p>
						<p class="small text-center no-margin"><span class="text-muted">{{trans('general.categoria')}}:</span> {{ Auth::user()->department ? Auth::user()->department->department : '' }}</p>
						<p class="small text-center no-margin"><span class="text-muted">{{trans('general.usuario')}} ID:</span> {{ Auth::user()->employee_id }}</p>
					</div>
					<div class="box-footer">
						<div class="row">
							<!--<div class="col-sm-4 border-right">
								<div class="description-block">
								<h5 class="description-header">8/11</h5>
								<span class="description-text small">Attendance</span>
								</div>
							</div>-->
							<div class="col-sm-6 border-right">
								<div class="description-block">
								<h5 class="description-header">{{ Auth::user()->documents->count() }}</h5>
								<span class="description-text small">{{trans('general.documentos')}}</span>
								</div>
							</div>

							<!-- div class="col-sm-6">
								<div class="description-block">
								<h5 class="description-header">{# Auth::user()->customer() #}</h5>
								<span class="description-text small">{{trans('general.boats')}}</span>
								</div>
							</div -->

						</div>
					</div>
				</div>
				<div class="small-box bg-black">
					<div class="inner datebar" align="center">
						<p><?php setlocale(LC_ALL,"es_ES"); echo date('l'). ", " .date('jS \of F, Y'); ?></p>
						<h3 id="clock"></h3>
						<br />
					</div>
				</div>
			</div>
			<div class="col-md-9">
				<div class="row">
					<div class="col-md-6">
						<div class="box box-success">
							<div class="box-header">
								<h3 class="box-title">{{trans('general.usuario')}}</h3>
							</div>
							<div class="box-body no-padding">
								<table class="table">
									<tbody>
									<tr>
										<td style="width: 10px" class="text-center"><i class="fa fa-envelope-o"></i></td>
										<td><strong>Email</strong></td>
										<td>{{ Auth::user()->email }}</td>
									</tr>
									<tr>
										<td style="width: 10px" class="text-center"><i class="fa fa-phone"></i></td>
										<td><strong>{{trans('general.movil')}}</strong></td>
										<td>{{ Auth::user()->telephone }}</td>
									</tr>
									<tr>
										<td style="width: 10px" class="text-center"><i class="fa fa-map-marker"></i></td>
										<td><strong>{{trans('general.direccion')}}</strong></td>
										<td>{{ Auth::user()->local_address }}</td>
									</tr>
									<tr>
										<td style="width: 10px" class="text-center"><i class="fa fa-user-secret"></i></td>
										<td><strong>{{trans('general.cif')}}</strong></td>
										<td>{{ Auth::user()->cif }}</td>
									</tr>
									<tr>
										<td style="width: 10px" class="text-center"><i class="fa fa-birthday-cake"></i></td>
										<td><strong>{{trans('general.birthday')}}</strong></td>
										<td>{{ Auth::user()->birthday }}</td>
									</tr>
									<tr>
										<td style="width: 10px" class="text-center"><i class="fa fa-genderless"></i></td>
										<td><strong>{{trans('general.usuariogenero')}}</strong></td>
										<td>{{ Auth::user()->gender_text() }}</td>
									</tr>
									</tbody>
								</table>
							</div>
						</div>


						 <div class="box box-success">
							<div class="box-header">
								<h3 class="box-title">{{trans('general.boat')}} asignada</h3>
							</div>
							<div class="box-body no-padding">
								<table class="table">
									<tbody>
									<tr>
										<td style="width: 10px" class="text-center"><i class="fa fa-key"></i></td>
										<td><strong>Cliente ID</strong></td>
										<td>{{ $customer->id }} - {{ $customer->fiscal_reason }}</td>
									</tr>

									@if(count($boats) > 0)
									@foreach ($boats as $boat)
									<tr>
										<td class="text-center"><i class="fa fa-briefcase"></i></td>
										<td><strong>{{trans('general.nombre')}}</strong></td>
										<td>
										{{ $boat->name }} {{ $boat->model }} ({{ $boat->number }})
										</td>
									</tr>
									@endforeach
									@endif
									</tbody>
								</table>
							</div>
						</div>
					</div>
					<div class="col-md-6">
						@if(Auth::user()->role->layout != 1)
						<div class="box box-success">
							<div class="box-header">
								<h3 class="box-title">Reservas pendientes</h3>
							</div>
							<div class="box-body no-padding">
								<table class="table">
									<tbody>
									<tr>
										<td style="width:10px" class="text-center"><strong>Fecha</strong></td>
										<td style="width:10px" class="text-center"><strong>Horario</strong></td>
									</tr>
									@foreach($reservations as $reservation)
									<tr>
										<td style="width: 10px" class="text-center">{{ $reservation->date_start }}</td>
										<td style="width: 10px" class="text-center">{{ $reservation->schedule->name }}</td>
									</tr>
									@endforeach
									</tbody>
								</table>
							</div>
						</div>
						@endif

						<div class="box box-success">
							<div class="box-header with-border">
								<h3 class="box-title"><i class="fa fa-bell-o"></i> {{trans('general.noticias')}}</h3>
							</div>
							<div class="box-body">
								<ul class="products-list product-list-in-box">
									@foreach($notices as $notice)
									<li class="item">
										<div class="product-img">
											<img src="{{ asset($notice->image) }}" alt="Product Image">
										</div>
										<div class="product-info">
											<a href="{{ asset('notices/'.$notice->id) }}" class="product-title">{{ $notice->title }}
											<span class="label label-success pull-right">{{ $notice->created_at }}</span></a>
											<span class="product-description">
											{{ $notice->description }}
											</span>
										</div>
									</li>
									@endforeach
								</ul>
							</div>
							<div class="box-footer text-center">
								<a href="{{ asset('notices') }}" class="uppercase">{{trans('general.vertodos')}}</a>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</section>
</div>
@endsection

@section('foot')
	<script type="text/javascript">
		function startTime() {
			var today=new Date(),
			curr_hour=today.getHours(),
			curr_min=today.getMinutes(),
			curr_sec=today.getSeconds();
			curr_hour=checkTime(curr_hour);
			curr_min=checkTime(curr_min);
			curr_sec=checkTime(curr_sec);
			document.getElementById('clock').innerHTML=curr_hour+":"+curr_min+":"+curr_sec;
		}
		function checkTime(i) {
			if (i<10) {
				i="0" + i;
			}
			return i;
		}
		setInterval(startTime, 500);
	</script>
@endsection
