@extends('layout')
@section('judul')
Edit Data Identitas
@endsection
@section('konten')
<div class="row">
	<h3>Edit Data Identitas</h3>
	<form action="{{ url('identity/'.$data->id) }}" method="post" class="form-horizontal">
		<input type="hidden" name="_method" value="put">
		{{csrf_field()}}
		<div class="form-group">
			<label class="col-md-4 control-label" for="image">Image</label>
			<div class="col-md-5">
				<div class="input-group">
					<span class="input-group-btn">
						<label class="btn btn-default btn-file">
							Browse&hellip;<input type="file" style="display: none;" name="image" id="browse">
						</label>
					</span>
					<input type="text" class="form-control input-md" id="i" name="i" value="{{$data->image}}" placeholder="not file selected" disabled="true">
				</div>
			</div>
		</div>
		<div class="form-group">
			<label class="col-md-4 control-label" for="name">Nama Lengkap</label>
			<div class="col-md-5">
				<input type="text" name="fullnames" placeholder="Nama Lengkap" class="form-control input-md" value="{{$data->name}}" required="">
			</div>
		</div>
		<div class="form-group">
			<label class="col-md-4 control-label" for="sex">Jenis Kelamin</label>
			<div class="col-md-4">
				<label class="radio-inline" for="sex-0">
					<input type="radio" name="sex" id="sex-0" value="Male">
					Male
				</label>
				<label class="radio-inline" for="sex-1">
					<input type="radio" name="sex" id="sex-1" value="Female">
					Female
				</label>
			</div>
		</div>
		<div class="form-group">
			<label class="col-md-4 control-label" for="idcard">Nomor Kartu Identitas</label>
			<div class="col-md-5">
				<input type="text" name="idcard" placeholder="Nomor Kartu Identitas" class="form-control input-md" value="{{$data->idcard}}" required="">
			</div>
		</div>
		<div class="form-group">
			<label class="col-md-4 control-label" for="birthdate">Tanggal Lahir</label>
			<div class="col-md-5">
				<input type="text" name="birthdate" id="birthdate" placeholder="Tanggal Lahir" class="form-control input-md" value="{{$data->birthdate}}" required="">
			</div>
		</div>
		<div class="form-group">
			<label class="col-md-4 control-label" for="province">Provinsi</label>
			<div class="col-md-5">
				<input type="text" name="province" placeholder="Provinsi" class="form-control input-md" value="{{$data->province}}" required="">
			</div>
		</div>
		<div class="form-group">
			<label class="col-md-4 control-label" for="district">Distrik</label>
			<div class="col-md-5">
				<input type="text" name="district" placeholder="Distrik" class="form-control input-md" value="{{$data->district}}" required="">
			</div>
		</div>
		<div class="form-group">
			<label class="col-md-4 control-label" for="sector">Kecamatan</label>
			<div class="col-md-5">
				<input type="text" name="sector" placeholder="Kecamatan" class="form-control input-md" value="{{$data->sector}}" required="">
			</div>
		</div>
		<div class="form-group">
			<label class="col-md-4 control-label" for="cellar">Kelurahan</label>
			<div class="col-md-5">
				<input type="text" name="cellar" placeholder="Kelurahan" class="form-control input-md" value="{{$data->cellar}}" required="">
			</div>
		</div>
		<div class="form-group">
			<label class="col-md-4 control-label" for="submit"></label>
			<div class="col-md-4">
			<button id="submit" name="submit" class="btn btn-success">Simpan</button>
			</div>
		</div>

	</form>
</div>


</section>
@endsection
@section('script')
<script>
	$(document).ready(function(){
		$('#birthdate').datepicker({
			format: "dd/mm/yyyy"
		});
	});
	$(function() {

  // We can attach the `fileselect` event to all file inputs on the page
  $(document).on('change', ':file', function() {
  	var input = $(this),
  	numFiles = input.get(0).files ? input.get(0).files.length : 1,
  	label = input.val().replace(/\\/g, '/').replace(/.*\//, '');
  	input.trigger('fileselect', [numFiles, label]);
  });

		  // We can watch for our custom `fileselect` event like this
		  $(document).ready( function() {
		  	$(':file').on('fileselect', function(event, numFiles, label) {

		  		var input = $(this).parents('.input-group').find(':text'),
		  		log = numFiles > 1 ? numFiles + ' files selected' : label;

		  		if( input.length ) {
		  			input.val(log);
		  		} else {
		  			if( log ) alert(log);
		  		}

		  	});
		  });

		});
	</script>
	@endsection
