<?php
$db = getDB(); // ✅ IMPORTANT
$stmt = $db->prepare("
    SELECT member_id, name, user_id,walletAddress
    FROM meddolic_user_details
    WHERE user_id = ?
    LIMIT 1
");

$stmt->execute([$_SESSION['admin_user_id'] ?? '']);
$valAccess = $stmt->fetch();

if ($valAccess) {
    $name = $valAccess['name'];
    $user_id = $valAccess['user_id'];
    $member_id = $valAccess['member_id'];
    $mainId = $valAccess['user_id'];
    $walletAddress = $valAccess['walletAddress'];
}

?>
<div id="left-sidebar" class="sidebar">
    <div class="sidebar-scroll">
        <div class="user-account">
            <img src="../assets/images/favicon.png" class="rounded-circle user-photo" alt="Hissho Global ">
            <div class="dropdown">
                <span>Hi, <?= $user_id ?></span>
                <a href="javascript:void(0);" class="dropdown-toggle user-name"
                    data-toggle="dropdown"><strong><?= $name ?></strong></a>
                <ul class="dropdown-menu dropdown-menu-right account">
                    <li><a href="adminProfile"><i class="icon-user"></i>My Profile</a></li>
                    <li><a href="changePassword"><i class="icon-envelope-open"></i>Change Password</a></li>
                    <li class="divider"></li>
                    <li><a href="logoutCode"><i class="icon-power"></i>Logout</a></li>
                </ul>
            </div>
            <hr>
        </div>
        <div class="tab-content p-l-0 p-r-0">
            <div class="tab-pane active" id="menu">
                <nav id="left-sidebar-nav" class="sidebar-nav">
                    <ul id="main-menu" class="metismenu">
                        <li id="dashboard">
                            <a href="dashboard.php"><i class="icon-home"></i> <span>Dashboard</span></a>
                        </li>
                        <li id="Members">
                            <a href="#Members" class="has-arrow"><i class="icon-user-follow"></i> <span>User
                                    Management</span></a>
                            <ul>
                                <li id="viewMember"><a href="viewMember.php">View Member</a></li>
                                <li id="searchMember"><a href="searchMember.php">Search Member</a></li>

                                <li id="activationHistory"><a href="activationHistory.php">User Invest History</a></li>

                            </ul>
                        </li>

                        <!-- <li id="fund">
                            <a href="#fund" class="has-arrow"><i class="icon-user-follow"></i> <span>Fund
                                    Management</span></a>
                            <ul>
                                <li id="paymentDetailsUpdate"><a href="paymentDetailsUpdate">Payment Details Update</a></li>
                                <li id="fundRequest"><a href="fundRequest.php">Fund Request</a></li>
                                <li id="fundTransfer"><a href="fundTransfer.php"><span>Fund Transfer</span></a></li>
                                <li id="fundTransferHistory"><a href="fundTransferHistory.php">Fund History</a></li>
                            </ul>
                        </li> -->

                        <!-- <li id="Withdraw">
                            <a href="#Withdraw" class="has-arrow"><i class="icon-folder"></i> <span>Withdraw</span></a>
                            <ul>
                                <li id="walletWithdrawStatus"><a href="walletWithdrawStatus">Approve Withdraw</a></li>
                                <li id="withdrawReleaseHistory"><a href="withdrawReleaseHistory">Withdraw History</a>
                                </li>
                            </ul>
                        </li> -->
                        <!-- <li id="Support">
                            <a href="#Support" class="has-arrow"><i class="icon-bubbles"></i> <span>Support</span></a>
                            <ul>
                                <li id="newSupportTicket"><a href="newSupportTicket.php"> New Tickets</a></li>
                                <li id="supportTicket"><a href="supportTicket.php"> Support Tickets</a></li>
                            </ul>
                        </li> -->
                        <li id="Team">
                            <a href="#Team" class="has-arrow"><i class="icon-users"></i> <span>Team & Report</span></a>
                            <ul>
                                <li id="myDirect"><a href="myDirect.php">My Direct</a></li>
                                <!-- <li id="myDownline"><a href="myDownline.php">My Downline</a></li> -->
                            </ul>
                        </li>
                        <!-- <li id="Wallet">
                            <a href="#Wallet" class="has-arrow"><i class="icon-puzzle"></i> <span>Wallet</span></a>
                            <ul>
                                <li id="walletStatement"><a href="walletStatement">Wallet Statement</a></li>
                                <li id="walletOutstanding"><a href="walletOutstanding.php">Wallet Outstanding</a></li>
                            </ul>
                        </li> -->
                        <!-- <li id="Setting">
                            <a href="#Setting" class="has-arrow"><i class="icon-diamond"></i> <span>Setting</span></a>
                            <ul>
                                <li id="noticeSetting"><a href="noticeSetting.php">Notice Setting</a></li>
                                <li id="popUpSetting"><a href="popUpSetting.php">Pop-Up Setting</a></li>
                                <li id="betSetting"><a href="betSetting">Bet Setting</a></li>

                                <li id="TradeHistory"><a href="TradeHistory">trade History</a></li>
                                <li id="referralSetting"><a href="referralSetting">Update Referral Percent</a></li>
                                <li id="binarySetting"><a href="binarySetting">Update Binary Percent</a></li>
                            </ul>
                        </li> -->
                        <li>
                            <a href="logoutCode"><i class="icon-power"></i> <span>Sign Out</span></a>
                        </li>
                    </ul>
                </nav>
            </div>
        </div>
    </div>
</div>