<table class="table table-sm table-bordered table-striped">
    <thead>
        <th width="40px">#</th>
        <th width="150px">ID</th>
        <th width="550px">User</th>
        <th width="200px">Jabatan</th>
        <th width="125px">Lokasi Kerja</th>
        <th width="35px">Akses</th>
    </thead>
    <tbody>
        <?php
        $i = 1;
        foreach ($datauser as $d) {
            $lokasi = $this->db->get_where('tb_emp_unit', ['emp_id' => $d['emp_id']])->result_array();
            echo "<tr>";
            echo "<td>" . $i . "</td>";
            echo "<td>" . $d['emp_id'] . "</td>";
            echo "<td>" . $d['FullName'] . "</td>";
            echo "<td>" . $d['strJobPosition'] . "</td>";
            echo "<td style='cursor:pointer;' ondblclick='tambahunit(\"" . $d['emp_id'] . "\")'>";
            foreach ($lokasi as $l) {
                echo "<span class='badge bg-secondary'>" . $l['unit'] . "&nbsp;<i class='bi bi-x-lg' style='cursor:pointer;' onclick='hapuslokasi(" . $l['id_emp_unit'] . ")'></i></span>&nbsp;";
            }
            echo "</td>";
            echo "<td><button type='button' onclick='tbakses(\"" . $d['emp_id'] . "\")' class='btn btn-primary btn-sm' data-bs-toggle='modal' data-bs-target='#f_akses'>Setup&nbsp;<i class='bi bi-key'></i></button></td>";
            echo "</tr>";
            $i++;
        }
        ?>
    </tbody>
</table>