{!! Form::model($model, [
	'route' => $model->exists ? ['sekolah.update', $model->id] : 'sekolah.store',
	'method' => $model->exists ? 'PUT' : 'POST',
	'enctype' => 'multipart/form-data',
  'id' => 'formSubmit'
]) !!}
<input type="hidden" name="_token" id="_token" value="{{csrf_token()}}">
<div class="form-group">
	<label for="" class="label-control">Nama Guru</label>
	{!! Form::text('nama', null, ['class' => 'form-control', 'id' => 'nama', 'placeholder' => 'Inputkan nama guru...']) !!}
</div>

<div class="form-group">
	<label for="" class="label-control">Jabatan</label>
	{!! Form::text('jabatan', null, ['class' => 'form-control', 'id' => 'jabatan', 'placeholder' => 'Inputkan Jabatan Guru...']) !!}
</div>

<div class="form-group">
	<label for="" class="label-control">Facebook</label>
	{!! Form::text('facebook', null, ['class' => 'form-control', 'id' => 'facebook', 'placeholder' => 'Inputkan alamat facebook jika ada... (https://facebook.com/username)']) !!}
</div>

<div class="form-group">
	<label for="" class="label-control">Twitter</label>
	{!! Form::text('twitter', null, ['class' => 'form-control', 'id' => 'twitter', 'placeholder' => 'Inputkan alamat twitter jika ada... (https://twitter.com/username)']) !!}
</div>

<div class="form-group">
	<label for="" class="label-control">Instagram</label>
	{!! Form::text('instagram', null, ['class' => 'form-control', 'id' => 'instagram', 'placeholder' => 'Inputkan alamat instagram jika ada... (https://instagram.com/username)']) !!}
</div>

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

@if($model->exists)
<a href="#" onclick="document.getElementById('foto-{{$model->id}}').click()" title="Klik untuk ganti foto"><img src="<?php if($model->foto != NULL){ echo url('assets/files/sekolah').'/'.$model->foto; }else{ echo url('assets/frontend/img/no-picture.png'); } ?>" width="100px"></a>
<input type="hidden" name="_token" id="_token" value="{{csrf_token()}}">
<input type="hidden" name="id" value="{{ $model->id }}">
<input style="display: none;" type="file" name="foto" id="foto-{{$model->id}}" data-id="{{$model->id}}" class="uploadfoto" accept="image/*">
<br>
@if($model->foto != NULL)
<button class="btn btn-xs btn-warning" id="hapusGambar" data-id="{{$model->id}}"><i class="fa fa-close"> Hapus Gambar</i></button>
<p style="font-size: 10px; color:red;">Size gambar max: 500kb!</p>
@endif
@endif
