@extends('admins.admin_home')

@section('content')
<div class="container">
	<div class="row">
        <div class="col-md-12 col-md-offset-0">
        @if (Session::has('pesan_sukses'))
			<div class="alert alert-success">
				<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
				{{ Session::get('pesan_sukses') }}
			</div>
		@elseif (Session::has('pesan_gagal'))
			<div class="alert alert-danger">
				<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
				{{ Session::get('pesan_gagal') }}
			</div>
		@endif
            <div class="panel panel-default">
            <div class="panel-heading">Data Karyawan</div>
                <div class="table-responsive">
                    <table class="table table-striped">
                        <thead>
                            <?php  $count = 1; ?>
                            <tr>
                                <th>No.</th>
                                <th>Nama</th>
								<th>Pekerjaan</th>
								<th>No Tlp</th>
                            </tr>
                        </thead>
                        <tbody>
                        @foreach($karyawans as $karyawans)
                            <tr>
                                <td>{!! $count++ !!}</td>
                                <td>{!! $karyawans->nama !!}</td>
								<td>{!! $karyawans->pekerjaan !!}</td>
								<td>{!! $karyawans->notlp !!}</td>
                                <td>
                                    <form method="POST" action="{!! route('karyawan.destroy', $karyawans->id) !!}" accept-charset="UTF-8">
                                        <input name="_method" type="hidden" value="DELETE">
                                        <input name="_token" type="hidden" value="{!! csrf_token() !!}">
                                        <a href="{!! route('karyawan.edit', $karyawans->id) !!}" type="button" class="btn btn-primary btn-sm">Edit</a>
                                        <input onclick="return confirm('Anda yakin akan menghapus data ?');" type="submit" class="btn btn-danger btn-sm" value="Hapus" />
                                    </form>
                                </td>
                            </tr>
                        @endforeach
                        </tbody>
                    </table>
                    <a href="{!! route('karyawan.create') !!}" type="button" class="btn btn-primary">Tambah</a>
                    </div>
                </div>
            </div>
        </div>
	</div>
</div>
@endsection
