<?php
include "../config/koneksi.php";
include "../middleware/auth.php";
include "../config/komplain_workflow.php";

sikompro_require_role('pelaksana');

$userId = (int) $_SESSION['user_id'];
$profileUser = komplain_user_profile($conn, $userId);
$userRow = mysqli_fetch_assoc(mysqli_query($conn, "SELECT username, email, role, gaji_harian, foto_profil FROM users WHERE id='{$userId}' LIMIT 1"));
?>
<!DOCTYPE html>
<html lang="id">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Akses User Pelaksana | PT. ALVINDO</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/admin-lte@3.2/dist/css/adminlte.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/css/bootstrap.min.css" integrity="sha384-sRIl4kxILFvY47J16cr9ZwB07vP4J8+LH7qKQnuqkuIAvNWLzeN8tE5YBujZqJLB" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
.user-page .bg-light{
    background:var(--sikompro-surface-alt, rgba(15,23,42,.82)) !important;
    color:var(--sikompro-ink, #eef5ff) !important;
    border-color:var(--sikompro-line, rgba(148,163,184,.2)) !important;
}
.sidebar-profile{text-align:center;padding:14px 8px;color:#fff;border-bottom:1px solid rgba(255,255,255,.12)}
.sidebar-profile img{width:76px;height:76px;object-fit:cover;border-radius:50%;border:3px solid rgba(255,255,255,.45)}
@media (max-width:576px){.content-wrapper{padding:12px!important}}
</style>
<link rel="stylesheet" href="../assets/sikompro-ux.css?v=20260722.11">
</head>
<body class="hold-transition sidebar-mini dashboard-shell user-page">
<div class="wrapper">
<aside class="main-sidebar sidebar-dark-primary elevation-4">
    <a href="dashboard.php" class="brand-link text-center">PT. ALVINDO</a>
    <div class="sidebar">
        <div class="sidebar-profile">
            <img src="<?= komplain_profile_photo_url($profileUser) ?>" alt="Foto profil">
            <div class="mt-2 font-weight-bold"><?= htmlspecialchars($profileUser['username']) ?></div>
            <small><?= htmlspecialchars(ucfirst($profileUser['role'])) ?></small>
        </div>
        <ul class="nav nav-pills nav-sidebar flex-column">
            <li class="nav-item"><a href="dashboard.php" class="nav-link"><i class="nav-icon fas fa-home"></i> Dashboard</a></li>
            <li class="nav-item"><a href="data_komplain.php?filter=total" class="nav-link"><i class="nav-icon fas fa-table"></i> Data Komplain</a></li>
            <li class="nav-item"><a href="absen.php" class="nav-link"><i class="nav-icon fas fa-user-check"></i> Absen</a></li>
            <li class="nav-item"><a href="data_absensi.php" class="nav-link"><i class="nav-icon fas fa-users"></i> Data Absensi</a></li>
            <li class="nav-item"><a href="gaji.php" class="nav-link"><i class="nav-icon fas fa-money-bill"></i> Gaji</a></li>
            <li class="nav-item"><a href="users.php" class="nav-link active"><i class="nav-icon fas fa-user-cog"></i> Akses User</a></li>
            <li class="nav-item"><a href="profil.php" class="nav-link"><i class="nav-icon fas fa-user-circle"></i> Profil</a></li>
            <li class="nav-item"><a href="notif.php" class="nav-link"><i class="nav-icon fas fa-bell"></i> Notifikasi</a></li>
            <li class="nav-item"><a href="cetak_pdf.php" class="nav-link"><i class="nav-icon fas fa-print"></i> Cetak PDF</a></li>
            <li class="nav-item"><a href="../middleware/logout.php" class="nav-link"><i class="nav-icon fas fa-sign-out-alt"></i> Logout</a></li>
        </ul>
    </div>
</aside>
<div class="content-wrapper p-3">
    <a href="dashboard.php" class="dashboard-back-button mb-3"><i class="fas fa-arrow-left"></i><span>Kembali</span></a>
    <div class="page-hero utility-page-hero">
        <h4 class="mb-1">Akses User Pelaksana</h4>
        <p class="mb-0">Halaman ini menampilkan ringkasan akun Anda. Pengaturan user tetap dikelola admin.</p>
    </div>
    <div class="card utility-page-card">
        <div class="card-body">
            <div class="utility-page-stats">
                <div class="utility-stat bg-light">
                    <div class="text-muted">Username</div>
                    <div class="h5 mb-0"><?= htmlspecialchars((string)($userRow['username'] ?? $_SESSION['username'])) ?></div>
                </div>
                <div class="utility-stat bg-light">
                    <div class="text-muted">Email</div>
                    <div class="h5 mb-0"><?= htmlspecialchars((string)($userRow['email'] ?? '-')) ?></div>
                </div>
                <div class="utility-stat bg-light">
                    <div class="text-muted">Role</div>
                    <div class="h5 mb-0"><?= htmlspecialchars((string)($userRow['role'] ?? $_SESSION['role'])) ?></div>
                </div>
                <div class="utility-stat bg-light">
                    <div class="text-muted">Gaji Harian</div>
                    <div class="h5 mb-0">Rp <?= number_format((float)($userRow['gaji_harian'] ?? 0),0,',','.') ?></div>
                </div>
            </div>
            <div class="alert alert-info mb-0">
                Jika yang Anda cari adalah detail absensi atau estimasi gaji, gunakan menu <b>Data Absensi</b> dan <b>Gaji</b>.
            </div>
        </div>
    </div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/js/bootstrap.bundle.min.js" integrity="sha384-FKyoEForCGlyvwx9Hj09JcYn3nv7wiPVlz7YYwJrWVcXK/BmnVDxM+D2scQbITxI" crossorigin="anonymous"></script>
<script src="../assets/bootstrap5-compat.js"></script>
<script src="../assets/sikompro-theme.js?v=20260722.11"></script>
<?php include '../partials/mobile_nav.php'; ?>
</body>
</html>















