<?php 
	//open form
	echo form_open(base_url('user'),' class="form-horizontal"'); 
?>
<p>
	<button type="button" class="btn btn-info" data-toggle="modal" data-target="#modal-default">
		  <i class="fa fa-plus"></i> Tambah User
	</button>
	<a href="<?php echo base_url('dashboard') ?>" class="btn btn-secondary" data-dismiss="modal"><i class="fa fa-times"></i> Kembali</a>	
</p>

<?php
//panggil form tambah
include('tambah.php');
//closing form
echo form_close();
?>
<table class="table table-bordered table-striped table-sm" id="example1">
	<thead>
		<tr>
			<th width="5%">NO.</th>
			<th width="20%">NAMA</th>
			<th width="25%">EMAIL</th>
			<th width="17%">USER ID</th>
			<th width="13%">LEVEL</th>
			<th>ACTION</th>

		</tr>
	</thead>
	<tbody>
		<?php foreach ($user as $key => $user) { ?>
			
		
		<tr>
			<td><?php echo $key+1; ?></td>
			<td><?php echo $user->nama ?></td>
			<td><?php echo $user->email ?></td>
			<td><?php echo $user->userid ?></td>
			<td><?php echo $user->level ?></td>
			<td>
				<div class="btn-group">
					<a href="<?php echo base_url('user/edit/'.$user->id) ?>" class="btn btn-warning btn-sm">
						<i class="fa fa-edit"></i> Edit
						
					</a>
					<a href="<?php echo base_url('user/delete/'.$user->id) ?>" class="btn btn-danger btn-sm" onclick="return confirm('Yakin ingin menghapus data user <?php echo $user->nama ?> ?')">
						<i class="fa fa-trash"></i> Hapus
						
					</a>
				</div>
			</td>

		</tr>

	<?php } ?>
	</tbody>
</table>