<div class="col-md-8 mt-xs-5">        
<h2 class="h4 p-3 bg-dark-light text-primary-light">Edit Profile </h2>

<div class="card bigbox-hvr-slow mt-4">
          <div class="card-body"> 
            {!! Form::model($user, ['url' => route('profile'), 'method' => 'post', 'class' => 'form-horizontal','id'=>'commentForm', 'enctype'=>'multipart/form-data','files'=> true]) !!}
            <input type="hidden" name="utm" value="{{encrypt($user->id)}}">
            
              <div class="form-row">

                <div class="form-group col-md-12 {{ $errors->first('display_name', 'has-error') }}">
                  <label for="display_name" class="control-label">Display Name *</label>
                  
                    <input id="display_name" name="display_name" type="text" placeholder="Display Name" class="form-control required" value="{!! old('display_name ', $user->display_name) !!}"/>
              
                  {!! $errors->first('display_name', '<span class="text-danger">:message</span>') !!} 
                </div>


                <div class="form-group col-md-6 {{ $errors->first('first_name', 'has-error') }}">
                  <label for="first_name" class="control-label">First Name *</label>
                  
                    <input id="first_name" name="first_name" type="text"
                                                                       placeholder="First Name" class="form-control required"
                                                                       value="{!! old('first_name', $user->first_name) !!}"/>
              
                  {!! $errors->first('first_name', '<span class="text-danger">:message</span>') !!} </div>
                <div class="form-group col-md-6 {{ $errors->first('last_name', 'has-error') }}">
                  <label for="last_name" class="control-label">Last Name *</label>
                  
                    <input id="last_name" name="last_name" type="text" placeholder="Last Name"
                                                                       class="form-control required"
                                                                       value="{!! old('last_name', $user->last_name) !!}"/>
             
                  {!! $errors->first('last_name', '<span class="text-danger">:message</span>') !!} </div>
              </div>
              <div class="form-row">
                <div class="form-group col-md-6 {{ $errors->first('name', 'has-error') }}">
                  <label for="name" class="control-label">User Name *</label>
                  
                    <input id="name" readonly name="name" type="text"
                                                                       placeholder="User Name" class="form-control required"
                                                                       value="{!! old('name', $user->name) !!}"/>
                  
                  </div>
                <div class="form-group col-md-6 {{ $errors->first('email', 'has-error') }}">
                  <label for="email" class="control-label">Email *</label>
                  
                    <input id="email" readonly name="email" placeholder="E-Mail" type="text"
                                                                       class="form-control required email"
                                                                       value="{!! old('email', $user->email) !!}"/>
                    {!! $errors->first('email', '<span class="text-danger">:message</span>') !!} 
                </div>
              </div>

      @if($user->change_password == 1)

      <div class="form-row">
			  
        <div class="col-md-12">
					<p class="text-info">If you don't want to change password... please leave them empty</p>
				</div>
				
                <div class="form-group col-md-6 {{ $errors->first('password', 'has-error') }}">
                  <label for="password" class="control-label">Password </label>
                  <input id="password" name="password" type="password" placeholder="Password" class="form-control" value="{!! old('password') !!}"/>
                  {!! $errors->first('password', '<span class="text-danger">:message</span>') !!} 
				</div>
				
                <div class="form-group col-md-6 {{ $errors->first('password_confirm', 'has-error') }}">
					<label for="password_confirm" class="control-label">Confirm Password </label>
                    <input id="password_confirm" name="password_confirm" type="password" placeholder="Confirm Password " class="form-control" value="{!! old('password_confirm') !!}"/>
                    {!! $errors->first('password_confirm', '<span class="text-danger">:message</span>') !!} 
				</div>
				
      </div>

      @endif
              <div class="form-row">
                <div class="form-group col-md-6 {{ $errors->first('dob', 'has-error') }}">
                  <label for="dob" class="control-label">Date of Birth</label>
                  
                    <input id="dob" name="dob" type="date" class="form-control"
                                                                       data-date-format="YYYY-MM-DD" value="{!! old('dob', $user->dob) !!}"
                                                                       placeholder="yyyy-mm-dd"/>
                  
                  {!! $errors->first('dob', '<span class="help-block">:message</span>') !!} </div>
                <div class="form-group col-md-6 {{ $errors->first('gender', 'has-error') }}">
                  <label for="email" class="control-label">Gender </label>
                 
                    <select class="form-control" title="Select Gender..." name="gender">
                      <option value="">Select</option>
                      <option value="male" @if($user->gender === 'male') selected="selected" @endif >Male</option>
                      <option value="female" @if($user->gender === 'female') selected="selected" @endif >Female</option>
                      <option value="other" @if($user->gender === 'other') selected="selected" @endif >Other</option>
                    </select>
             
                  {!! $errors->first('gender', '<span class="help-block">:message</span>') !!} </div>
              </div>
			  
			  <div class="form-row clearfix">
			  
              <div class="form-group col-md-6 {{ $errors->first('pic_file', 'has-error') }}">
                <label for="pic" class="control-label">Profile picture</label>
                
                  <div class="fileinput fileinput-new border pt-2 text-center col-md-12 h-100" data-provides="fileinput">
                    <div class="fileinput-new thumbnail" style="width: 200px; height: 200px;"> @if($user->pic) <img src="{!! url('/').'/uploads/users/'.$user->pic !!}" alt="img"
                                                                                 class="img-thumbnail"/> @elseif($user->gender === "male") <img src="{{ asset('assets/images/authors/avatar3.png') }}" alt="..."
                                                                                 class="img-thumbnail"/> @elseif($user->gender === "female") <img src="{{ asset('assets/images/authors/avatar5.png') }}" alt="..."
                                                                                 class="img-thumbnail"/> @else <img src="{{ asset('assets/images/authors/no_avatar.jpg') }}" alt="..."
                                                                                 class="img-thumbnail"/> @endif </div>
                    <div class="fileinput-preview fileinput-exists thumbnail" style="max-width: 200px; max-height: 200px;"></div>
                    <div> <span class="btn btn-primary btn-file btn-sm col-md-6 mb-1"> 
					<span class="fileinput-new">Select image</span> 
						<span class="fileinput-exists">Change</span>
                      <input id="pic" name="pic_file" type="file"
                                                                       class="form-control"/>
                      </span> <a href="#" class="btn btn-default btn-danger btn-sm fileinput-exists col-md-6" data-dismiss="fileinput">Remove</a> </div>
                      <p class="mb-0" >Use 200x200 image for better preview </p>
                  </div>
                  {!! $errors->first('pic_file', '<span class="help-block">:message</span>') !!} 
              </div>
			  
              <div class="form-group col-md-6  {{ $errors->first('pic', 'has-error') }}">
                <label for="bio" class="control-label">Bio <small>(brief intro)</small></label>                
                  <textarea name="bio" id="bio" class="form-control resize_vertical h-100" >{!! old('bio', $user->bio) !!}</textarea>
                
                {!! $errors->first('bio', '<span class="help-block">:message</span>') !!} 
			</div>
			</div>
              <br>
              <div class="form-row">
                <div class="form-group col-md-6  required {{ $errors->first('country', 'has-error') }}">
                  <label for="country" class="control-label">Country </label>
                   {!! Form::select('country', $countries,old('country',$user->country),array('class' => 'country_field form-control')) !!}
                  {!! $errors->first('country', '<span class="help-block">:message</span>') !!} </div>
                <div class="form-group col-md-6  {{ $errors->first('state', 'has-error') }}">
                  <label for="state" class="control-label">State </label>
                  
                    <input id="state" name="state" type="text" class="form-control"
                                                                       value="{!! old('state', $user->state) !!}"/>
                  
                  {!! $errors->first('state', '<span class="help-block">:message</span>') !!} </div>
              </div>
              <div class="form-row">
                <div class="form-group col-md-6  {{ $errors->first('city', 'has-error') }}">
                  <label for="city" class="control-label">City </label>
                  
                    <input id="city" name="city" type="text" class="form-control"
                                                                       value="{!! old('city', $user->city) !!}"/>
                  
                  {!! $errors->first('city', '<span class="help-block">:message</span>') !!} </div>
                <div class="form-group col-md-6  {{ $errors->first('address', 'has-error') }}">
                  <label for="address" class="control-label">Address </label>
                  
                    <input id="address" name="address" type="text" class="form-control"
                                                                       value="{!! old('address', $user->address) !!}"/>
                 
                  {!! $errors->first('address', '<span class="help-block">:message</span>') !!} </div>
              </div>
              <div class="form-row">
                <div class="form-group col-md-6  {{ $errors->first('postal', 'has-error') }}">
                  <label for="postal" class="control-label">Postal/zip</label>
                  
                    <input id="postal" name="postal" type="text" class="form-control"
                                                                       value="{!! old('postal', $user->postal) !!}"/>
             
                  {!! $errors->first('postal', '<span class="help-block">:message</span>') !!} </div>
              </div>
              <div class="form-row">
                <div class="col-md-12">
                  <button type="submit" class="btn bg-primary-light text-white" id="change-password">Update </button>

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