<?php
$this->db->select('*');
$this->db->from('web_management');
$this->db->join('web_style_2', 'web_management.style_web = web_style_2.id_web_style');
$wb_style = $this->db->get();
foreach ($wb_style->result() as $data) {
    $web_name = $data->nama_web;
    $web_description = $data->deskripsi;
    $web_meta_color = $data->meta_color;
    $web_navbar_color = $data->navbar_color;
    $web_box_color = $data->box_color;
    $web_box_bottom = $data->box_bottom;
}
?>
<div id="content" class='content'>
    <div class='row'>
        <div class="col-xs-12">
            <div class="pull-right">
                <?php echo anchor('auth/create_user', '<i class="fa fa-plus"></i> Tambah User', array('class' => 'btn btn-success btn-sm')); ?>
            </div>
        </div>
    </div>
    <br>
    <div class='row'>
        <div class='col-lg-12'>
            <div class='panel <?= $web_box_color ?>'>
                <div class='panel-heading'>
                    <h3 class='panel-title bold'>Data <?php echo lang('index_heading'); ?></h3>
                </div>
                <div class='panel-body'>
                    <table class="table table-striped" id="mytable" style="width: 100%;">
                        <thead>
                            <tr>
                                <th style="width: 10px;">No</th>
                                <th style="text-align: center;">Nama</th>
                                <th style="text-align: center;">Email</th>
                                <th style="text-align: center;">Level User</th>
                                <th style="text-align: center;"><span><i class="fa fa-cogs"></i></span></th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php
                            $start = 0;
                            foreach ($users as $user) :
                                if ($user->id == '2') {
                                } else { ?>
                                    <tr>
                                        <td class="text-center">
                                            <?= ++$start; ?>
                                        </td>
                                        <td>
                                            <?= htmlspecialchars($user->first_name, ENT_QUOTES, 'UTF-8'); ?>
                                        </td>
                                        <td>
                                            <?= htmlspecialchars($user->email, ENT_QUOTES, 'UTF-8'); ?>
                                        </td>
                                        <td class="text-center" style="text-transform: capitalize;">

                                            <?php foreach ($user->groups as $group) : ?>
                                                <?php
                                                if ($group->name == 'superadmin') {
                                                } else {
                                                    echo "<button style='font-size: 12px; font-weight: bold; width: 80px; text-transform: capitalize;' class='btn btn-xs btn-default'>";
                                                    echo $group->name;
                                                    echo "</button>";
                                                }
                                                ?>
                                            <?php endforeach ?>

                                        </td>
                                        <td style="text-align: center;">
                                            <?php
                                            echo '  ';
                                            echo anchor(site_url('auth/edit_user/' . encrypt_url($user->id)), '<i class="fa fa-pencil-alt"></i>', array('class' => 'btn btn-primary btn-icon btn-circle', 'data-toggle' => 'tooltip', 'data-placement' => 'left', 'title' => 'Edit'));
                                            echo '  ';
                                            echo anchor(site_url('auth/delete/' . encrypt_url($user->id)), '<i class="fa fa-trash-alt"></i>', array('class' => 'btn btn-danger btn-icon btn-circle tombol-hapus', 'data-toggle' => 'tooltip', 'data-placement' => 'left', 'title' => 'Hapus'));
                                            ?>
                                        </td>
                                    </tr>
                            <?php }
                            endforeach; ?>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>