@extends('layout')
@section('judul')
Data Diri Laravel

@endsection
@section('konten')
<br/>
<body style="body">
	<div class="row">
		<div class="col-md-6 col-md-offset-3">
			<a href="{{ url('identity/create') }}" class="btn btn-success"><i class="glyphicon glyphicon-plus"></i> Tambah Data </a>
			<a href="{{ url('identity') }}" class="btn btn-primary"><i class="glyphicon glyphicon-list"></i> Daftar Identitas </a>
		</div>
		<div>
			<form method="get">
				<input required type="text" name="name" placeholder="Search By Name"/>
				<input required type="hidden" name="controller" value="Search"/>
				<input required type="hidden" name="action" value="search"/>
				<button type="submit" class="btn btn-success"><i class="glyphicon glyphicon-search"></i> Search</button>
			</form>
		</div>
	</div>
	<br/>

	<section class="panel panel-default">
		<header class="panel-heading">
			<h3>Data Diri</h3>
		</header>
		<div class="table-responsive">
			<table class="table table-striped table-bordered">
				<thead>
					<tr>
						<!--	<th>ID</th> -->
						<th>Foto</th>
						<th>Nama</th>
						<th>Jenis_Kelamin</th>
						<th>IdCard</th>
						<th>BirthDate</th>
						<th>Provinsi</th>
						<th>Distrik</th>
						<th>Kecamatan</th>
						<th>Kelurahan</th>
						<th>Opsi</th>
					</tr>
				</thead>

				<tbody>
					@foreach($data as $a)
					<tr>
						<!--<td>{{$a->id}}</td> <!--ID-->
						<td><img src="images/<?php echo $a->image; ?>" style="max-width: 10em; max-height: 10em;"></td> <!--Foto-->
						<td>{{$a->fullnames}}</td> <!--Nama-->
						<td>{{$a->sex}}</td> <!--Gender-->
						<td>{{$a->idcard}}</td> <!--IDCard-->
						<td>{{$a->birthdate}}</td> <!--BirthDate-->
						<td>{{$a->province}}</td> <!--Province-->
						<td>{{$a->district}}</td> <!--Distrik-->
						<td>{{$a->sector}}</td> <!--Kecamatan-->
						<td>{{$a->cellar}}</td> <!--Kelurahan-->
						<td>  <!--Untuk Kolom OPSI-->
							<div>
								<a href="{{url('identity/'.$a->id.'/edit')}}" class="btn btn-primary" title="edit {{$a->fullnames}}"><i class="glyphicon glyphicon-edit"></i></a>

								<form action="{{ url('identity/'.$a->id) }}" method="post">
									{{csrf_field()}}
									<br/>
									<input type="hidden" name="_method" value="DELETE">
									<button type="submit" class="btn btn-danger" title="delete {{$a->fullnames}}"><i class="glyphicon glyphicon-trash"></i></button>
								</form>
							</div>
						</td>
					</tr>
					@endforeach
				</tbody>
			</table>
		</div>
		@endsection
		@section('script')
		<script type="text/javascript">
		$(document).ready(function(){
			$('#search').on('keyup',function(){
				$value = $(this).val();
				$.ajax({
					type : 'get',
					url : '{{URL::to('search')}}',
					data : {'search':$value},
					success:function(data){
						$('tbody').html(data);
					}
				});
			});
		});
		</script>
		@endsection
