<?php
$date_birth = "";

if($guardian->id){
	$option = ['method' => 'put' ,
	 'url' => action('GuardiansController@update' , $guardian),
	 'id'   =>  'defaultForm',
	 'class' => 'form-horizontal'];
	 $date_birth = $guardian->date_birth->toDateString();
} else{
	$option = ['method' => 'guardian' ,
	'url' => action('GuardiansController@store'),
	'id'   =>  'defaultForm',
	'class' => 'form-horizontal'];
}

?>

@include('errors.errors')
<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>Guardian informations</span>
                </div>
            </div>
            <div class="box-content">
                {!! Form::model($guardian, $option) !!}
                <input type="hidden" name="id" value="{{ $guardian->id }}">
                <fieldset>
                	    <legend>Personal informations</legend>
                		<div class="form-group">
                            <label class="col-sm-3 control-label">CIN</label>
                            <div class="col-sm-2">
                            {!! Form::text("cin" , null, ['class' => 'form-control ',
                                        			     'name' => 'cin',
                                        			     'data-toggle' => 'CIN']) !!}
                            </div>
                        </div>
                		<div class="form-group">
                		    <label class="col-sm-3 control-label">First name</label>
                			<div class="col-sm-4">
                			    {!! Form::text("first_name" , null, ['class' => 'form-control',
                                                                    'name' => 'first_name',
                                			                        'data-toggle' => 'First name']) !!}
                			</div>
                		</div>
                		<div class="form-group">
                            <label class="col-sm-3 control-label">Last name</label>
                            <div class="col-sm-4">
                               {!! Form::text("last_name" , null, ['class' => 'form-control',
                                                                    'name' => 'last_name',
                                                               		'data-toggle' => 'Last name']) !!}
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">Birth Date</label>
                            <div class="col-sm-2">
                            {!! Form::text("date_birth" , $date_birth, ['class' => 'form-control',
                                                        			    'name' => 'date_birth',
                                                        			    'data-toggle' => 'Birth Date',
                                                        			    '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">Phone number</label>
                            <div class="col-sm-4">
                            {!! Form::text("mobile" , null, ['class' => 'form-control',
                                    			             'name' => 'mobile',
                                    			             'data-toggle' => 'Phone number']) !!}
                            </div>
                        </div>
                    </fieldset>
                	    <div class="form-group">
                			<div class="col-sm-9 col-sm-offset-3">
                                    <button type="submit" class="btn btn-default">Submit</button>
                		    </div>
                	    </div>
                {!! Form::close() !!}
            </div>
        </div>
    </div>
</div>






