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

if($employee->id){
	$option = ['method' => 'put' ,
	 'url' => action('EmployeesController@update',$employee),
	 'files' => true,
	  'id'   =>  'defaultForm',
	 'class' => 'form-horizontal'];
	 $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();
} else{
	$option = ['method' => 'employee' ,
	'url' => action('EmployeesController@store'),
	'files' => true ,
	 'id'   =>  'defaultForm',
	'class' => 'form-horizontal'];
}

?>
<?php echo $__env->make('errors.errors', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
<div class="row">
    <div class="col-xs-12 col-sm-12">
        <div class="box">
            <div class="box-header">
                <div class="box-name">
                    <i class="fa fa-user"></i>
                	<span>Employee informations</span>
                </div>
            </div>
            <div class="box-content">
                <?php echo Form::model($employee, $option); ?>

                <input type="hidden" name="id" value="<?php echo e($employee->id); ?>">
                <fieldset>
                	    <legend>Personal informations</legend>
                		<div class="form-group">
                            <label class="col-sm-3 control-label">CIN</label>
                            <div class="col-sm-2">
                            <?php echo Form::text("cin" , null, ['class' => 'form-control']); ?>

                            </div>
                        </div>
                		<div class="form-group">
                		    <label class="col-sm-3 control-label">First name</label>
                			<div class="col-sm-4">
                			    <?php echo Form::text("first_name" , null, ['class' => 'form-control']); ?>

                			</div>
                		</div>
                		<div class="form-group">
                            <label class="col-sm-3 control-label">Last name</label>
                            <div class="col-sm-4">
                               <?php echo Form::text("last_name" , null, ['class' => 'form-control']); ?>

                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">Birth Date</label>
                            <div class="col-sm-2">
                            <?php echo Form::text("date_birth" , $date_birth, ['class' => 'form-control',
                                                        			    'id'  =>  'input_date_birth']); ?>

                            </div>
                        </div>
                	</fieldset>
                	<fieldset>
                	    <legend>Password</legend>
                		    <div class="form-group">
                			    <label class="col-sm-3 control-label">Password</label>
                				    <div class="col-sm-4">
                				        <input type="password" class="form-control" name="password" />
                					</div>
                			</div>
                			<div class="form-group">
                			    <label class="col-sm-3 control-label">Retype password</label>
                				<div class="col-sm-4">
                				    <input type="password" class="form-control" name="password_confirmation" />
                				</div>
                			</div>
                	</fieldset>
                	<fieldset>
                        <legend>Contact</legend>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">Email address</label>
                            <div class="col-sm-4">
                                <input type="text" class="form-control" name="email" />
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">Phone number</label>
                            <div class="col-sm-4">
                            <?php echo Form::text("mobile" , null, ['class' => 'form-control']); ?>

                            </div>
                        </div>
                    </fieldset>
                    <fieldset>
                        <legend>Other informations</legend>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">State</label>
                            <div class="col-sm-4">
                            <?php echo Form::text("state" , null, ['class' => 'form-control']); ?>

                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">Recrutment Date</label>
                            <div class="col-sm-2">
                            <?php echo Form::text("date_recrutment" , $date_recrutment, ['class' => 'form-control',
                                            			                                      'id'  =>  'input_date_recrutment']); ?>

                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">Resignation Date</label>
                            <div class="col-sm-2">
                            <?php echo Form::text("date_resignation" ,$date_resignation , ['class' => 'form-control',
                                                    			                    'id'  =>  'input_date_resignation']); ?>

                            </div>
                        </div>
                    </fieldset>
                    <fieldset>
                            <legend>Photo</legend>
                            <div class="form-group">
                                <?php /*<label class="col-sm-3 control-label">Photo</label>*/ ?>
                                <div class="container col-sm-3">
                                <input  type="file" name="image">
                                </div>
                            </div>
                    </fieldset>
                	    <div class="form-group">
                            <div class="col-sm-9 col-sm-offset-3">
                                    <button type="submit" class="btn btn-primary">Submit</button>
                		    </div>
                	    </div>
                <?php echo Form::close(); ?>

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