<?php
$date_birth = "";
$date_recrutment = "";
$date_resignation = "";

if($employee->id){
	 $date_birth = $employee->date_birth->toDateString();

	 if(strcmp($employee->date_recrutment->toDateString(),'-0001-11-30') != 0)
	    $date_recrutment = $employee->date_recrutment->toDateString();

	 if($employee->date_resignation&&strcmp($employee->date_resignation->toDateString(),"-0001-11-30") != 0)
	    $date_resignation = $employee->date_resignation->toDateString();

}

?>

@extends('../shared/default')

@section('content')

<div class="row">
            	<div id="breadcrumb" class="col-xs-12">
            		<a href="#" class="show-sidebar">
            			<i class="fa fa-bars"></i>
            		</a>
            		<ol class="breadcrumb pull-left">
            			<li><a href="{{ route('employee.index')  }}">Employees</a></li>
            			<li><a href="#">Profile</a></li>
            		</ol>
            	</div>
            </div>




<div class="row-fluid">
			<h4 class="page-header">{{ $employee->first_name ."   "}}{{ $employee->last_name }}</h4>
			<div class="row">

			<div class="col-lg-3 col-lg-10">
				<div class="box">
					<div class="thumbnail">
						<img src="{{ asset('/img/profiles/'. $employee->image) }}" alt="">
						<div class=" caption">
						{!! Form::open(array('method' => 'DELETE', 'route' => array('employee.destroy' , $employee))) !!}
                            <a href="{{ route('employee.edit' , $employee)  }}" class="btn btn-default">Edit</a>
                            {!! Form::submit('Delete', array('class' => 'btn btn-danger')) !!}
                        {!! Form::close() !!}
						</div>
					</div>
				</div>
			</div>
			<div class="col-xs-6 col-sm-6 col-md-8">
				<br>
				<br>
				<div class="form-group ">
						<label class="col-sm-2 control-label">ID</label>
						<div class="col-md-4">
							<label class="form-control">{{ $employee->id  }}</label>
						</div>
						<label class="col-sm-2 control-label">CIN</label>
						<div class="col-sm-4">
							<label class="form-control">{{ $employee->cin  }}</label>
						</div>
				</div>
				<br>
                <br>
					<div class="form-group  ">
						<label class="col-sm-2 control-label">Mobile</label>
						<div class="col-sm-4">
							<label class="form-control">{{ $employee->mobile  }}</label>
						</div>
						<label class="col-sm-2 control-label">Email</label>
						<div class="col-sm-4">
							<label type="password" class="form-control">{{ $employee->email  }}</label>
						</div>
					</div>
					<br>
                    <br>
					<div class="form-group ">
						<label class="col-sm-2 control-label">Birth Date</label>
						<div class="col-md-4">
							<label class="form-control">{{ $date_birth  }}</label>
						</div>
						<label class="col-sm-2 control-label">State</label>
						<div class="col-sm-4">
							<label class="form-control">{{ $employee->state  }}</label>
						</div>
					</div>
                    <br>
                    <br>
					<div class="form-group ">
						<label class="col-sm-2 control-label">Recrutment Date</label>
						<div class="col-sm-4">
							<label class="form-control">{{ $date_recrutment   }}</label>
						</div>
						<label class="col-sm-2 control-label">Resignation Date</label>
						<div class="col-sm-4">
							<label class="form-control">{{ $date_resignation   }}</label>
						</div>
					</div>
			</div>



<div class="row form-group col-sm-12">
        <div class="row col-xs-12">

            <div class="col-xs-12 col-sm-6">
            		<div class="box">
            			<div class="box-header">
            				<div class="box-name">
            					<i class="fa fa-bullseye"></i>
            					<span>StatisicLogOutPerMonth</span>
            				</div>
            				<div class="no-move"></div>
            			</div>
            			<div class="box-content">
            				<div id="statisticLogOutPerMonth" style="height: 200px; width: 100%;"></div>
            			</div>
            		</div>
            	</div>


<div class="col-xs-12 col-sm-6">
		<div class="box">
			<div class="box-header">
				<div class="box-name">
					<i class="fa fa-bullseye"></i>
					<span>StatisicLogInPerMonth</span>
				</div>
				<div class="no-move"></div>
			</div>
			<div class="box-content">
				<div id="statisticLogInPerMonth" style="height: 200px; width: 100%;"></div>
			</div>
		</div>

</div>

                        	<div class="col-xs-12">
                        		<div class="box">
                        			<div class="box-header">
                        				<div class="box-name">
                        					<i class="fa fa-table"></i>
                        					<span>Logs</span>
                        				</div>
                        				<div class="no-move"></div>
                        			</div>
                        			<div class="box-content no-padding table-responsive">
                        				<table class="table table-bordered table-striped table-hover table-heading table-datatable" id="datatable-2">
                        					<thead>
                        						<tr>
                        						    <th><label><input type="text" name="search_guard" value="Guard" class="search_init" /></label></th>
                        							<th><label><input type="text" name="search_date_log" value="Date" class="search_init" /></label></th>
                        							<th><label><input type="text" name="search_time_log" value="Time" class="search_init" /></label></th>
                        							<th class="col-md-2"><label><input type="text" name="search_in_out" value="IN/OUT" class="search_init" /></label></th>
                        						    <th id="delete"/>
                        						</tr>
                        					</thead>
                        					<tbody>
                        					@foreach($employee->logs as $log)
                                                    <tr>
                                                        <td>{{ $log->guardian->first_name}} {{ $log->guardian->last_name }}</td>
                                                        <td>{{ $log->date_log->toDateString() }}</td>
                                                        <td>{{ $log->date_log->toTimeString() }}</td>
                                                        @if($log->in_out == 0)
                                                            <td style="text-align:center" class="success">IN</td>
                                                            @else
                                                            <td style="text-align:center" class="danger">OUT</td>
                                                        @endif
                                                        <td style="text-align:center; display: block;  padding-bottom: 6%;">
                                                            {!! Form::open(array('method' => 'DELETE', 'route' => array('log.destroy' , $log))) !!}
                                                                <button type="submit" class="btn btn-default btn-app-sm"><i class="fa fa-trash"></i></button>
                                                            {!! Form::close() !!}
                                                        </td>
                                                </tr>
                                            @endforeach

                        					</tbody>
                        					<tfoot>
                        						<tr>
                        							<th>Guard</th>
                        							<th>Date</th>
                        							<th>Time</th>
                        							<th>IN/OUT</th>
                        							<th>Delete</th>
                        						</tr>
                        					</tfoot>
                        				</table>
                        			</div>
                        		</div>
                        	</div>
                        </div>
                   </div>
		      </div>
	</div>

</div>
@stop