<?php
$_page_title = "User List";
$_main_root = '../';
require_once $_main_root . 'db/model.php';

$db = new Model();
if (isset($_POST['type']) && $_POST['type'] == "list") {
    $userList = $db->GetUser();
    header('Content-Type: application/json');
    echo json_encode($userList);
    exit;
}

include($_main_root . 'content/shared/header.php');
?>

<!-- modal -->
<div id="userModalDiv"></div>

<div class="container container-fluid">
    <div class="my-4 d-flex justify-content-between align-items-center">
        <h2 style="color:var(--s-text-color);">USER LIST</h2>
        
        <?php if ($sa) { ?>
            <button class="btn btn-sm btn-outline-success ms-3" onclick="UserDetail(0)">
                <i class="bi bi-plus-circle me-2"></i> NEW USER
            </button>
        <?php } ?>
    </div>
    
    <div class="row my-4">

            <div class="table-responsive-lg">
                <table id="sTableUserList" class="table table-sm table-dark table-hover table-bordered" style="width: 100%;">

                    <thead style="color:var(--s-text-color);" class="mt-3">
                        <!-- <th>#</th> -->
                        <th class="w-50">Full Name</th>
                        <th>User Name</th>
                        <th>Role</th>
                        <th>Status</th>
                        <th  class="">Action</th>
                    </thead>
                    <tbody>
                    </tbody>
                </table>

            </div>
    </div>
</div>

<?php $s_scripts = ['user']; ?>

<?php include($_main_root . 'content/shared/footer.php'); ?>