@if($model->exists)
<a href="#" onclick="document.getElementById('foto-{{$model->username}}').click()" title="Klik untuk ganti gambar"><img id="foto-user" class="profile-user-img img-responsive img-circle" src="<?php if($model->foto != NULL){ echo url('assets/files/profile/'.$model->foto); }else{ echo url('assets/frontend/img/no-picture.png'); } ?>" alt="User profile picture"></a>
<form method="post" action="{{ route('profile.update_foto') }}" enctype="multipart/form-data">
  <input type="hidden" value="{{$model->id}}" name="id" id="id">
  <input type="hidden" name="_token" id="_token" value="{{csrf_token()}}">
  <input style="display: none;" type="file" name="foto" id="foto-{{$model->username}}" data-username="{{$model->username}}" class="uploadfoto" accept="image/*">
</form>
@endif

{!! Form::model($model, [
	'route' => ['profile.update', $model->id],
	'method' => 'PUT',
	'enctype' => 'multipart/form-data',
  'id' => 'formProfile'
]) !!}

<div class="form-group">
    <label for="" class="label-control">Username</label>
    <input type="text" class="form-control" id="username" name="username" value="{{ $model->username }}" placeholder="Inputkan username disini!" <?php if($model->exists){ echo 'disabled'; } ?>>
</div>

<div class="form-group">
    <label for="" class="label-control">Name</label>
    {!! Form::text('name', null, ['class' => 'form-control', 'id' => 'name', 'placeholder' => 'Inputkan nama user!']) !!}
</div>

<div class="form-group">
    <label for="" class="label-control">Email</label>
    {!! Form::email('email', null, ['class' => 'form-control', 'id' => 'email', 'placeholder' => 'Inputkan Email user!']) !!}
</div>

<div class="form-group">
    <label for="" class="label-control">Password</label>
    <input type="password" name="password" id="password" class="form-control" <?php if($model->exists): ?> placeholder="Biarkan kosong jika tidak ingin mengganti password!" <?php else: ?> placeholder="Inputkan password user!" <?php endif; ?> >
</div>

<div class="form-group">
    <label for="" class="label-control">Password Confirmation</label>
    <input type="password" name="password_confirmation" id="password_confirmation" class="form-control" <?php if($model->exists): ?> placeholder="Biarkan kosong jika tidak ingin mengganti password!" <?php else: ?> placeholder="Ulangi password user!" <?php endif; ?> >
</div>

{!! Form::close() !!}