<?php
defined('BASEPATH') OR exit('No direct script access allowed');

function value_array($key)
{
  $array = "";

  foreach ($key as $column => $value){ $array .= ", ".$column.": "."'".$value."'"; };

  return $array;
}
?>

<div class="table-responsive">
	<table class="table table-sm table-bordered table-striped table-hover">
		<thead>
			<tr>
				<th style="text-align: center; width: 50px">No</th>
				<th style="text-align: center;">Kode</th>
				<th style="text-align: center;">Nama</th>
				<th style="text-align: center;">NIK</th>
				<th style="text-align: center;">ID <span class="badge bg-primary">Satusehat</span></th>
				<th style="text-align: center;">Status</th>
				<th style="text-align: center; width: 30px">Aksi</th>
			</tr>
		</thead>
		<tbody>
			<?php $urut = 0; foreach ($data as $key){ if($key->satusehat_id != ''){ $urut++; ?>
				<tr>
					<td style="text-align: center;"><?php echo $urut ?></td> 
					<td style="text-align: center;"><?php echo $key->id ?></td> 
					<td style="text-align: center;"><?php echo $key->nama ?></td>  
					<td style="text-align: center;"><?php echo $key->nik ?></td> 
					<td style="text-align: center;"><?php echo $key->satusehat_id ?></td>   
					<td style="text-align: center;"><?php echo $key->status ?></td>
					<td style="text-align: center;">
						<button class="btn btn-danger btn-rounded btn-xs" data-placement="bottom" title="Hapus data" onclick="hapus_data({table_name: 'mapping_praktisi'<?php echo value_array($key) ?>})"><i class="fas fa-times"></i></button>
					</td>
				</tr> 
			<?php } } ?>
		</tbody>
	</table>
</div>