<div class="card-block">
	<table class="table table-striped table-mailcard">
		<thead>
			<tr>
				<th class="w-1 text-center">No</th>
				<th class="w-10">satuan</th>
				<th class="w-25">Nama satuan</th>
				<th class="w-10">Jumlah satuan</th>
				<th class="w-10 text-center">Status | Aksi</th>
			</tr>
		</thead>
		<tbody>
			<?php if(!empty($result)){
				$no=$this->uri->segment(3)+1;
				foreach ($result as $row){
					if ($row->pub == 0){ 
						$aktif ='<i class="fa fa-check-circle"></i>'; 
						$text ='text-white'; 
						}else{ 
						$aktif = '<i class="fa fa-minus-circle"></i>'; 
						$text ='text-white-50'; 
					}
					
					$hapus = '<button type="button" class="btn btn-danger btn-sm text-white"  data-id="'.$row->id.'" data-toggle="modal" data-target="#confirm-delete" href="#"><i class="fa fa-trash "></i> Hapus</button>';
					echo "<tr><td class='text-center'>$no</td>
					<td class='pl-1'><a class='btn-sm add_satuan text-info' title='Edit Data' data-id='$row->id' href='#'>{$row->satuan}</a></td>
					<td class='text-left'>{$row->nama_satuan}</td>
					<td class='text-left'>{$row->jumlah}</td>
					<td class='text-right'>
					<div class='btn-group btn-group-sm' role='group'>
					<button type='button' class='btn btn-info btn-sm satuan-status-btn' data-id='".$row->id."'><span class='icon $text'>$aktif</span></button>
					<button type='button' class='btn btn-info btn-sm add_satuan' data-id='".$row->id."'><i class='fa fa-edit'></i> Edit</button>
					$hapus
					</div>
					</td>
					</tr>";
					$no++;
				} }else{ ?>
				<tr>
					<td colspan="5">Data belum ada</td>
				</tr>
			<?php } ?>
		</tbody>
	</table>
	<?php
		$satuan_jumlah_data = !empty($result) ? count($result) : 0;
		$satuan_offset_data = (int) $this->uri->segment(3);
		$satuan_offset_data = $satuan_offset_data > 0 ? $satuan_offset_data : 0;
		$satuan_total_data = isset($total_rows) ? (int)$total_rows : (isset($totalRec) ? (int)$totalRec : ($satuan_offset_data + $satuan_jumlah_data));
		$satuan_start_data = $satuan_jumlah_data > 0 ? ($satuan_offset_data + 1) : 0;
		$satuan_end_data = $satuan_jumlah_data > 0 ? min(($satuan_start_data + $satuan_jumlah_data - 1), $satuan_total_data) : 0;
	?>
	<div class="satuan-paginationbar">
		<span class="satuan-pageinfo">Menampilkan <?php echo $satuan_start_data; ?> - <?php echo $satuan_end_data; ?> dari <?php echo $satuan_total_data; ?></span>
		<nav aria-label="Page navigation" class="mt-2">
			<?php 
				echo $this->ajax_pagination->create_links(); 
			?>
		</nav>
	</div>
</div><!-- /.card-body -->